/* =========================================================
   ARBOR VITAE CHATBOT — Styles
   ========================================================= */

:root {
  --cb-primary: #D4AF37;
  --cb-primary-dark: #B8941C;
  --cb-secondary: #800020;
  --cb-bg: #0A0A0A;
  --cb-surface: #141414;
  --cb-surface-hover: #1A1A1A;
  --cb-text: #F0EDE6;
  --cb-text-muted: #7A7060;
  --cb-border: rgba(212, 175, 55, 0.12);
  --cb-radius: 20px;
  --cb-font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── FAB Button ─────────────────────────────────────── */
#arbor-chatbot-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #800020 0%, #4A0E0E 100%);
  box-shadow: 0 4px 24px rgba(128, 0, 32, 0.5), 0 0 0 0 rgba(212, 175, 55, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  animation: cb-fab-pulse 3s ease-in-out infinite;
}

#arbor-chatbot-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 32px rgba(128, 0, 32, 0.6), 0 0 0 8px rgba(212, 175, 55, 0.1);
}

#arbor-chatbot-fab:active {
  transform: scale(0.95);
}

#arbor-chatbot-fab svg {
  width: 30px;
  height: 30px;
  transition: transform 0.3s ease;
}

#arbor-chatbot-fab:hover svg {
  transform: scale(1.05) rotate(-3deg);
}

#arbor-chatbot-fab.cb-open svg {
  transform: rotate(90deg);
}

@keyframes cb-fab-pulse {
  0%, 100% { box-shadow: 0 4px 24px rgba(128, 0, 32, 0.5), 0 0 0 0 rgba(212, 175, 55, 0); }
  50% { box-shadow: 0 4px 24px rgba(128, 0, 32, 0.5), 0 0 0 6px rgba(212, 175, 55, 0.08); }
}

/* ── Notification Badge ─────────────────────────────── */
#arbor-chatbot-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--cb-primary);
  color: #050505;
  font-family: var(--cb-font);
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#arbor-chatbot-badge.cb-visible {
  opacity: 1;
  transform: scale(1);
}

/* ── Chat Container ─────────────────────────────────── */
#arbor-chatbot-container {
  position: fixed;
  bottom: 100px;
  right: 24px;
  z-index: 9999;
  width: 380px;
  height: 540px;
  border-radius: var(--cb-radius);
  background: var(--cb-bg);
  border: 1px solid var(--cb-border);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(212, 175, 55, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.92) translateY(16px);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#arbor-chatbot-container.cb-open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: all;
}

/* ── Header ─────────────────────────────────────────── */
.cb-header {
  background: linear-gradient(135deg, #800020 0%, #4A0E0E 100%);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.cb-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(212, 175, 55, 0.15);
  border: 1.5px solid rgba(212, 175, 55, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cb-header-avatar img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.cb-header-info {
  flex: 1;
  min-width: 0;
}

.cb-header-name {
  font-family: var(--cb-font);
  font-size: 14px;
  font-weight: 700;
  color: #F0EDE6;
  letter-spacing: -0.01em;
  margin: 0;
}

.cb-header-status {
  font-family: var(--cb-font);
  font-size: 11px;
  color: rgba(240, 237, 230, 0.6);
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0 0;
}

.cb-header-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  animation: cb-online-pulse 2s ease-in-out infinite;
}

@keyframes cb-online-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.cb-header-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.cb-header-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.cb-header-close svg {
  width: 14px;
  height: 14px;
  stroke: #F0EDE6;
  stroke-width: 2.5;
}

/* ── Messages Area ──────────────────────────────────── */
.cb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 175, 55, 0.15) transparent;
}

.cb-messages::-webkit-scrollbar {
  width: 4px;
}

.cb-messages::-webkit-scrollbar-track {
  background: transparent;
}

.cb-messages::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.15);
  border-radius: 4px;
}

/* ── Message Bubbles ────────────────────────────────── */
.cb-msg {
  max-width: 85%;
  padding: 10px 14px;
  font-family: var(--cb-font);
  font-size: 13px;
  line-height: 1.6;
  animation: cb-msg-in 0.3s ease-out;
}

.cb-msg-bot {
  align-self: flex-start;
  background: var(--cb-surface);
  color: var(--cb-text);
  border-radius: 4px 16px 16px 16px;
  border: 1px solid var(--cb-border);
}

.cb-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #800020 0%, #5a0018 100%);
  color: #F0EDE6;
  border-radius: 16px 4px 16px 16px;
}

.cb-msg a {
  color: var(--cb-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cb-msg strong {
  font-weight: 700;
  color: var(--cb-primary);
}

.cb-msg ul, .cb-msg ol {
  margin: 6px 0;
  padding-left: 18px;
}

.cb-msg li {
  margin-bottom: 3px;
}

@keyframes cb-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Typing Indicator ───────────────────────────────── */
.cb-typing {
  align-self: flex-start;
  background: var(--cb-surface);
  border: 1px solid var(--cb-border);
  border-radius: 4px 16px 16px 16px;
  padding: 12px 18px;
  display: flex;
  gap: 5px;
  align-items: center;
  animation: cb-msg-in 0.3s ease-out;
}

.cb-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cb-text-muted);
  animation: cb-typing-bounce 1.4s ease-in-out infinite;
}

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

@keyframes cb-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ── Quick Buttons ──────────────────────────────────── */
.cb-quick-buttons {
  padding: 8px 16px 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}

.cb-quick-btn {
  font-family: var(--cb-font);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid var(--cb-border);
  background: transparent;
  color: var(--cb-text-muted);
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.cb-quick-btn:hover {
  border-color: var(--cb-primary);
  color: var(--cb-primary);
  background: rgba(212, 175, 55, 0.06);
}

/* ── Input Area ─────────────────────────────────────── */
.cb-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--cb-border);
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-shrink: 0;
  background: var(--cb-bg);
}

.cb-textarea {
  flex: 1;
  font-family: var(--cb-font);
  font-size: 13px;
  color: var(--cb-text);
  background: var(--cb-surface);
  border: 1px solid var(--cb-border);
  border-radius: 14px;
  padding: 10px 14px;
  resize: none;
  outline: none;
  max-height: 100px;
  line-height: 1.5;
  transition: border-color 0.2s ease;
}

.cb-textarea::placeholder {
  color: var(--cb-text-muted);
}

.cb-textarea:focus {
  border-color: rgba(212, 175, 55, 0.3);
}

.cb-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--cb-primary) 0%, var(--cb-primary-dark) 100%);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.cb-send-btn:hover {
  transform: scale(1.08);
}

.cb-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.cb-send-btn svg {
  width: 16px;
  height: 16px;
}

/* ── Powered By ─────────────────────────────────────── */
.cb-powered {
  text-align: center;
  padding: 6px;
  font-family: var(--cb-font);
  font-size: 9px;
  color: var(--cb-text-muted);
  opacity: 0.5;
  flex-shrink: 0;
}

/* ── Mobile Responsive ──────────────────────────────── */
@media (max-width: 480px) {
  #arbor-chatbot-container {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    max-height: 100dvh;
  }

  #arbor-chatbot-fab {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
  }

  #arbor-chatbot-fab svg {
    width: 26px;
    height: 26px;
  }
}
