/* OpenCrab on-site agent widget — dark space theme, zero dependencies.
   Tokens match the main site: --bg #05070F, --orange #FF6B35, --cyan #22D3EE. */

.oca-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 60px;
  height: 60px;
  border: 2px solid rgba(255, 107, 53, 0.65);
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 24px rgba(255, 107, 53, 0.55), 0 8px 24px rgba(0, 0, 0, 0.45);
  animation: oca-pulse 2.6s ease-in-out infinite;
  transition: transform 0.2s ease;
  overflow: hidden;
  padding: 4px;
}
.oca-fab:hover { transform: scale(1.07); }
.oca-fab img { width: 100%; height: 100%; object-fit: contain; }
@keyframes oca-pulse {
  0%, 100% { box-shadow: 0 0 18px rgba(255,107,53,0.45), 0 8px 24px rgba(0,0,0,0.45); }
  50% { box-shadow: 0 0 34px rgba(255,107,53,0.8), 0 8px 24px rgba(0,0,0,0.45); }
}

.oca-panel {
  position: fixed;
  right: 22px;
  bottom: 94px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 130px);
  z-index: 2147483001;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 18px;
  background: rgba(10, 14, 26, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), 0 0 40px rgba(139, 92, 246, 0.12);
  font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: #f5f7fa;
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.oca-panel.oca-open { opacity: 1; transform: none; pointer-events: auto; }

.oca-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(135deg, rgba(139,92,246,0.18), rgba(34,211,238,0.1));
}
.oca-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #ffffff;
  display: flex; align-items: center; justify-content: center;
  flex: none; overflow: hidden;
}
.oca-avatar img { width: 32px; height: 32px; }
.oca-title { font-size: 15px; font-weight: 700; line-height: 1.3; }
.oca-subtitle { font-size: 11px; color: #9aa4b2; line-height: 1.35; }
.oca-status { font-size: 11px; color: #9aa4b2; display: flex; align-items: center; gap: 5px; }
.oca-dot { width: 7px; height: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 8px #34d399; }
.oca-close {
  margin-left: auto; background: none; border: none; color: #9aa4b2;
  font-size: 20px; cursor: pointer; line-height: 1; padding: 4px;
}
.oca-close:hover { color: #fff; }

.oca-body {
  flex: 1; overflow-y: auto; padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.oca-msg { max-width: 85%; padding: 9px 12px; border-radius: 14px; font-size: 13.5px; line-height: 1.65; word-wrap: break-word; }
.oca-msg strong { color: #ffb08a; }
.oca-msg ul { margin: 6px 0 2px; padding-left: 18px; }
.oca-msg li { margin: 2px 0; }
.oca-bot { align-self: flex-start; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08); border-bottom-left-radius: 4px; }
.oca-user { align-self: flex-end; background: linear-gradient(135deg, rgba(255,107,53,0.25), rgba(255,107,53,0.12)); border: 1px solid rgba(255,107,53,0.35); border-bottom-right-radius: 4px; }

.oca-typing { display: inline-flex; gap: 5px; padding: 12px 14px; }
.oca-typing span { width: 7px; height: 7px; border-radius: 50%; background: #9aa4b2; animation: oca-blink 1.2s infinite; }
.oca-typing span:nth-child(2) { animation-delay: 0.2s; }
.oca-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes oca-blink { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }

.oca-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 14px 10px; }
.oca-chip {
  font-size: 12px; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  background: rgba(34,211,238,0.08); border: 1px solid rgba(34,211,238,0.3); color: #a5f3fc;
  transition: background 0.2s ease;
}
.oca-chip:hover { background: rgba(34,211,238,0.18); }

.oca-foot { border-top: 1px solid rgba(255,255,255,0.08); padding: 10px 12px 8px; }
.oca-inputrow { display: flex; gap: 8px; }
.oca-input {
  flex: 1; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px; padding: 10px 12px; color: #f5f7fa; font-size: 13.5px; outline: none;
  font-family: inherit;
}
.oca-input:focus { border-color: rgba(255,107,53,0.6); }
.oca-send {
  flex: none; border: none; border-radius: 12px; padding: 0 16px; cursor: pointer;
  background: linear-gradient(135deg, #ff6b35, #e04e1a); color: #fff; font-size: 13.5px; font-weight: 700;
}
.oca-send:disabled { opacity: 0.5; cursor: default; }
.oca-actions { display: flex; gap: 8px; margin-top: 8px; }
.oca-leadbtn {
  flex: 1; border: 1px solid rgba(255,107,53,0.5); background: rgba(255,107,53,0.1);
  color: #ffb08a; border-radius: 10px; padding: 8px; font-size: 12.5px; cursor: pointer; font-weight: 600;
}
.oca-leadbtn:hover { background: rgba(255,107,53,0.2); }
.oca-note { text-align: center; font-size: 10.5px; color: #5c6675; padding: 6px 0 2px; }

/* Lead form */
.oca-leadform { padding: 4px 2px; display: flex; flex-direction: column; gap: 10px; }
.oca-leadform h4 { margin: 2px 0 4px; font-size: 14px; }
.oca-leadform label { font-size: 12px; color: #9aa4b2; display: flex; flex-direction: column; gap: 5px; }
.oca-leadform input, .oca-leadform textarea {
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px; padding: 9px 11px; color: #f5f7fa; font-size: 13px; font-family: inherit; outline: none;
}
.oca-leadform input:focus, .oca-leadform textarea:focus { border-color: rgba(255,107,53,0.6); }
.oca-leadform textarea { resize: vertical; min-height: 64px; }
.oca-formbtns { display: flex; gap: 8px; }
.oca-submit { flex: 1; border: none; border-radius: 10px; padding: 10px; background: linear-gradient(135deg,#ff6b35,#e04e1a); color: #fff; font-weight: 700; cursor: pointer; font-size: 13.5px; }
.oca-cancel { border: 1px solid rgba(255,255,255,0.15); border-radius: 10px; padding: 10px 16px; background: none; color: #9aa4b2; cursor: pointer; font-size: 13px; }

/* Toast */
.oca-toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(10px);
  background: rgba(10,14,26,0.97); border: 1px solid rgba(52,211,153,0.5); color: #a7f3d0;
  padding: 10px 18px; border-radius: 12px; font-size: 13px; z-index: 2147483002;
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease, transform 0.25s ease;
}
.oca-toast.oca-show { opacity: 1; transform: translateX(-50%); }

@media (max-width: 480px) {
  .oca-panel { right: 0; left: 0; bottom: 0; width: 100%; max-width: 100%; height: 82vh; max-height: 82vh; border-radius: 18px 18px 0 0; }
  .oca-fab { right: 16px; bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .oca-fab { animation: none; }
  .oca-typing span { animation: none; opacity: 0.7; }
}
