/* ================================================================
   ONYX AI ASSISTANT — REI Vault Pro
   Distinct from Ebonie's gold; uses cool silver/slate-blue palette
   ================================================================ */

/* ── WIDGET ROOT ──────────────────────────────────────────────── */
.onyx-widget {
  position: fixed;
  bottom: 24px;
  left: 20px;
  z-index: 9990;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
}

.onyx-widget > * { pointer-events: auto; }

/* ── FLOATING ACTION BUTTON ───────────────────────────────────── */
.onyx-fab {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #0d1117 0%, #161c28 100%);
  border: 1px solid rgba(100,116,139,0.45);
  border-radius: 28px;
  padding: 8px 14px 8px 10px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 0.22s cubic-bezier(0.34,1.56,0.64,1),
    box-shadow 0.22s ease,
    border-color 0.22s ease;
  box-shadow:
    0 4px 20px rgba(0,0,0,0.55),
    0 0 0 1px rgba(255,255,255,0.04) inset;
  color: #94a3b8;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  user-select: none;
}

.onyx-fab:hover {
  transform: translateY(-2px) scale(1.03);
  border-color: rgba(100,116,139,0.8);
  box-shadow:
    0 8px 28px rgba(0,0,0,0.65),
    0 0 20px rgba(100,116,139,0.12),
    0 0 0 1px rgba(255,255,255,0.06) inset;
  color: #cbd5e1;
}

.onyx-fab:active { transform: scale(0.97); }

/* ── GEM ICON ─────────────────────────────────────────────────── */
.onyx-fab-gem {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border: 1px solid rgba(100,116,139,0.55);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(100,116,139,0.2);
}

.onyx-fab-gem svg {
  width: 13px;
  height: 13px;
  filter: drop-shadow(0 0 4px rgba(148,163,184,0.6));
}

/* Pulse ring on fab when panel is closed */
@keyframes onyxFabPulse {
  0%,100% { box-shadow: 0 4px 20px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.04) inset; }
  50%      { box-shadow: 0 4px 20px rgba(0,0,0,0.55), 0 0 0 4px rgba(100,116,139,0.12), 0 0 0 1px rgba(255,255,255,0.04) inset; }
}
.onyx-fab.onyx-fab--idle {
  animation: onyxFabPulse 3.5s ease-in-out infinite;
}

/* ── TOUR HIGHLIGHT — Onyx widget pulsing gold ring during introduction ── */
@keyframes onyxTourGlow {
  0%,100% { box-shadow: 0 4px 20px rgba(0,0,0,0.55), 0 0 0 3px rgba(212,175,55,0.6), 0 0 24px rgba(212,175,55,0.35); }
  50%      { box-shadow: 0 4px 20px rgba(0,0,0,0.55), 0 0 0 6px rgba(212,175,55,0.25), 0 0 40px rgba(212,175,55,0.55); }
}
.ox-highlighted.onyx-fab,
.ox-highlighted .onyx-fab {
  animation: onyxTourGlow 1.6s ease-in-out infinite !important;
  border-color: rgba(212,175,55,0.8) !important;
}

/* ── CHAT PANEL ───────────────────────────────────────────────── */
.onyx-panel {
  width: 310px;
  max-height: 440px;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow:
    0 4px 6px rgba(0,0,0,0.07),
    0 24px 64px rgba(0,0,0,0.18);
  transform-origin: bottom left;
  transition:
    transform 0.32s cubic-bezier(0.34,1.56,0.64,1),
    opacity 0.22s ease;
}

.onyx-panel.onyx-panel--hidden {
  transform: translateY(12px) scale(0.95);
  opacity: 0;
  pointer-events: none;
}

/* Top accent line */
.onyx-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #1e293b, #475569, #1e293b);
  border-radius: 16px 16px 0 0;
}

/* ── PANEL HEADER ─────────────────────────────────────────────── */
.onyx-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 9px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  background: #f8fafc;
  flex-shrink: 0;
}

.onyx-header-info {
  display: flex;
  align-items: center;
  gap: 9px;
}

.onyx-header-gem {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border: 1px solid rgba(71,85,105,0.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(30,41,59,0.3);
}

.onyx-header-gem svg {
  width: 14px;
  height: 14px;
  filter: drop-shadow(0 0 5px rgba(148,163,184,0.7));
}

.onyx-name {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #1e293b;
}

.onyx-role {
  font-family: 'DM Sans', sans-serif;
  font-size: 9.5px;
  color: #64748b;
  letter-spacing: 0.04em;
  margin-top: 1px;
}

.onyx-status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34,197,94,0.8);
  margin-right: 5px;
  animation: onyxDotPulse 1.8s ease-in-out infinite;
  vertical-align: middle;
}

@keyframes onyxDotPulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.65); }
}

.onyx-close-btn {
  background: rgba(30,41,59,0.08);
  border: 1px solid rgba(30,41,59,0.15);
  border-radius: 6px;
  color: #475569;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  transition: all 0.15s ease;
  flex-shrink: 0;
  font-weight: 600;
}

.onyx-close-btn:hover {
  background: rgba(30,41,59,0.15);
  color: #1e293b;
  border-color: rgba(30,41,59,0.3);
}

/* ── MESSAGES AREA ────────────────────────────────────────────── */
.onyx-messages {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #ffffff;
  scrollbar-width: thin;
  scrollbar-color: rgba(100,116,139,0.2) transparent;
}

.onyx-messages::-webkit-scrollbar { width: 3px; }
.onyx-messages::-webkit-scrollbar-thumb { background: rgba(100,116,139,0.25); border-radius: 3px; }

/* ── MESSAGE BUBBLES ──────────────────────────────────────────── */
.onyx-msg {
  display: flex;
  flex-direction: column;
  max-width: 90%;
  gap: 2px;
  animation: onyxMsgIn 0.22s ease-out;
}

@keyframes onyxMsgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.onyx-msg--onyx { align-self: flex-start; }
.onyx-msg--user  { align-self: flex-end; }

.onyx-msg-bubble {
  padding: 7px 10px;
  border-radius: 11px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  line-height: 1.55;
}

.onyx-msg--onyx .onyx-msg-bubble {
  background: #f1f5f9;
  border: 1px solid rgba(30,41,59,0.1);
  color: #1e293b;
  border-bottom-left-radius: 4px;
}

.onyx-msg--user .onyx-msg-bubble {
  background: #1e293b;
  border: 1px solid rgba(30,41,59,0.8);
  color: #f1f5f9;
  border-bottom-right-radius: 4px;
}

/* ── TYPING INDICATOR ─────────────────────────────────────────── */
.onyx-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  background: #f1f5f9;
  border: 1px solid rgba(30,41,59,0.1);
  border-radius: 11px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.onyx-typing span {
  width: 5px;
  height: 5px;
  background: #94a3b8;
  border-radius: 50%;
  animation: onyxDot 1.2s ease-in-out infinite;
}

.onyx-typing span:nth-child(2) { animation-delay: 0.2s; }
.onyx-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes onyxDot {
  0%,60%,100% { transform: translateY(0); opacity: 0.5; }
  30%          { transform: translateY(-5px); opacity: 1; }
}

/* ── SUGGESTED PROMPTS ────────────────────────────────────────── */
.onyx-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 0 11px 6px;
  background: #ffffff;
}

.onyx-suggestion {
  background: #f1f5f9;
  border: 1px solid rgba(30,41,59,0.15);
  border-radius: 14px;
  padding: 4px 9px;
  font-family: 'DM Sans', sans-serif;
  font-size: 10.5px;
  color: #334155;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.onyx-suggestion:hover {
  background: #e2e8f0;
  border-color: rgba(30,41,59,0.3);
  color: #1e293b;
}

/* ── INPUT AREA ───────────────────────────────────────────────── */
.onyx-input-area {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px 10px;
  border-top: 1px solid rgba(0,0,0,0.08);
  background: #f8fafc;
  flex-shrink: 0;
}

.onyx-input {
  flex: 1;
  background: #ffffff;
  border: 1px solid rgba(30,41,59,0.2);
  border-radius: 10px;
  padding: 7px 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  color: #1e293b;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.onyx-input::placeholder { color: rgba(30,41,59,0.35); }

.onyx-input:focus {
  border-color: rgba(30,41,59,0.45);
  box-shadow: 0 0 0 2px rgba(30,41,59,0.08);
}

.onyx-send-btn {
  width: 32px;
  height: 32px;
  background: #1e293b;
  border: 1px solid #1e293b;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
  flex-shrink: 0;
  color: #ffffff;
}

.onyx-send-btn:hover {
  background: #334155;
  border-color: #334155;
  color: #ffffff;
}

.onyx-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.onyx-send-btn svg { width: 13px; height: 13px; }

/* ── CONTEXT BADGE ────────────────────────────────────────────── */
.onyx-context-badge {
  font-family: 'DM Sans', sans-serif;
  font-size: 9px;
  color: rgba(100,116,139,0.5);
  padding: 0 11px 2px;
  letter-spacing: 0.03em;
}

/* ── SECTION 16 — CONCIERGE NUDGE ──────────────────────────── */
.onyx-concierge-nudge {
  margin: 6px 0;
  padding: 7px 12px;
  background: #fffbeb;
  border: 1px solid rgba(212,175,55,0.35);
  border-radius: 10px;
  font-size: 11px;
  color: #78350f;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
}

.onyx-concierge-nudge.visible {
  opacity: 1;
  transform: translateY(0);
}

.onyx-concierge-nudge strong {
  color: #92400e;
  font-weight: 700;
}

/* ── KNOWLEDGE BASE RESOURCE LINKS ─────────────────────────── */
.onyx-resources {
  margin: 6px 0 2px;
  padding: 10px 12px;
  background: #f0fdf4;
  border: 1px solid rgba(16,185,129,0.25);
  border-radius: 10px;
}

.onyx-resources-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #059669;
  margin-bottom: 7px;
}

.onyx-resource-link {
  display: block;
  font-size: 11.5px;
  color: #065f46;
  text-decoration: none;
  padding: 4px 0;
  cursor: pointer;
  transition: color 0.15s ease;
  border-bottom: 1px solid rgba(16,185,129,0.15);
}

.onyx-resource-link:last-child {
  border-bottom: none;
}

.onyx-resource-link:hover {
  color: #047857;
}

/* ── UPGRADE PROMPT ───────────────────────────────────────── */
.onyx-upgrade-prompt {
  margin: 8px 0;
  padding: 12px 14px;
  background: linear-gradient(135deg, #fef9e7 0%, #fffbeb 100%);
  border: 1px solid rgba(212,175,55,0.45);
  border-radius: 12px;
  text-align: center;
}

.onyx-upgrade-title {
  font-size: 12px;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 4px;
}

.onyx-upgrade-desc {
  font-size: 11px;
  color: #78350f;
  line-height: 1.5;
  margin-bottom: 10px;
}

.onyx-upgrade-btn {
  display: inline-block;
  padding: 7px 18px;
  background: linear-gradient(135deg, #b8960c 0%, #d4af37 50%, #f6c90e 100%);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #0a0a0f;
  text-decoration: none;
  transition: brightness 0.15s ease;
}

.onyx-upgrade-btn:hover {
  filter: brightness(1.1);
}

/* ── MOBILE RESPONSIVE ─────────────────────────────────────── */
@media (max-width: 640px) {
  .onyx-widget {
    bottom: 16px;
    left: 12px;
  }

  .onyx-panel {
    width: calc(100vw - 24px);
    max-width: 320px;
    max-height: 70vh;
  }

  .onyx-fab {
    padding: 8px 12px 8px 9px;
    font-size: 11.5px;
  }
}

@media (max-width: 380px) {
  .onyx-widget {
    bottom: 12px;
    left: 8px;
  }

  .onyx-panel {
    width: calc(100vw - 16px);
    max-height: 65vh;
  }
}
