/* ================================================================
 * chatbot.css - FAQ Chatbot Styles (White Theme)
 * ================================================================ */

/* ── Bubble Button ──────────────────────────── */
#chatbot-bubble {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 999;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #ff6b00, #ff9a3c);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(255, 107, 0, 0.4);
  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;
}
#chatbot-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(255, 107, 0, 0.55);
}
#chatbot-bubble .cb-icon {
  width: 26px;
  height: 26px;
  transition: opacity 0.25s ease, transform 0.25s ease;
  position: absolute;
}
#chatbot-bubble .cb-icon-chat {
  opacity: 1;
  transform: scale(1);
}
#chatbot-bubble .cb-icon-close {
  opacity: 0;
  transform: scale(0.5) rotate(-90deg);
}
#chatbot-bubble.active .cb-icon-chat {
  opacity: 0;
  transform: scale(0.5) rotate(90deg);
}
#chatbot-bubble.active .cb-icon-close {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

/* Badge */
.cb-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e53e3e;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  animation: cb-badge-pulse 2s ease-in-out infinite;
}
@keyframes cb-badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ── Chat Window (White Theme) ──────────────── */
#chatbot-window {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: 999;
  width: 380px;
  max-height: 520px;
  border-radius: 16px;
  background: var(--surface-card, #ffffff);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12), 0 0 0 1px var(--surface-border, rgba(0, 0, 0, 0.06));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#chatbot-window.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header */
.cb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, #ff6b00, #ff9a3c);
  color: #fff;
}
.cb-header-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.cb-header-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  width: 24px;
  height: 24px;
  padding: 0;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.cb-header-close:hover { opacity: 1; }
.cb-header-close svg { width: 20px; height: 20px; }

/* Messages Area */
.cb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 300px;
  max-height: 400px;
  background: var(--surface-alt, #f8f9fb);
}
.cb-messages::-webkit-scrollbar { width: 4px; }
.cb-messages::-webkit-scrollbar-track { background: transparent; }
.cb-messages::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.12); border-radius: 2px; }

/* Message Bubbles */
.cb-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  animation: cb-msg-in 0.3s ease;
}
@keyframes cb-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cb-msg-bot {
  align-self: flex-start;
  background: var(--surface-card, #ffffff);
  color: var(--surface-text, #1a1f2e);
  border: 1px solid var(--surface-border, rgba(0, 0, 0, 0.08));
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.cb-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #ff6b00, #ff9a3c);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Option Buttons */
.cb-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: cb-msg-in 0.3s ease;
}
.cb-opt-btn {
  background: var(--surface-card, #ffffff);
  border: 1px solid rgba(255, 107, 0, 0.3);
  color: #ff6b00;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.cb-opt-btn:hover:not(:disabled) {
  background: rgba(255, 107, 0, 0.06);
  border-color: #ff6b00;
  box-shadow: 0 2px 8px rgba(255, 107, 0, 0.12);
}
.cb-opt-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Link Button */
.cb-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  background: rgba(255, 107, 0, 0.08);
  color: #ff6b00;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s;
  animation: cb-msg-in 0.3s ease;
}
.cb-link-btn:hover { background: rgba(255, 107, 0, 0.15); }
.cb-link-btn::after { content: ' →'; }

/* Reset Button */
.cb-reset-btn {
  align-self: center;
  margin-top: 6px;
  background: var(--surface-card, #ffffff);
  border: 1px solid var(--surface-border, rgba(0, 0, 0, 0.12));
  color: var(--surface-muted, #6b7a99);
  padding: 6px 18px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  animation: cb-msg-in 0.3s ease;
}
.cb-reset-btn:hover {
  background: var(--surface-alt, #f4f6fa);
  color: var(--surface-text, #1a1f2e);
  border-color: rgba(0, 0, 0, 0.2);
}

/* ── Hide back-to-top (replaced by chatbot) ── */
#back-to-top { display: none !important; }

/* ── Mobile Responsive ──────────────────────── */
@media (max-width: 480px) {
  #chatbot-bubble {
    bottom: 20px;
    right: 16px;
    width: 50px;
    height: 50px;
  }
  #chatbot-bubble .cb-icon { width: 22px; height: 22px; }

  #chatbot-window {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 70vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }
  #chatbot-window.active {
    transform: translateY(0);
  }
}
