/* ===== SUPPORT CHAT WIDGET ===== */
:root {
  --chat-primary: #0a2d4e;
  --chat-primary-light: #e0ecf7;
  --chat-primary-hover: #0d3a63;
  --chat-accent: #53d65e;
  --chat-bg: #ffffff;
  --chat-surface: #f7f8fa;
  --chat-text: #1a1a2e;
  --chat-text-muted: #6b7280;
  --chat-border: #e5e7eb;
  --chat-radius: 14px;
  --chat-shadow: 0 8px 40px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
  --chat-bubble-bot: #f0f3f7;
  --chat-bubble-user: var(--chat-primary);
}

/* Launcher Button */
.chat-launcher {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--chat-primary);
  border: solid 2px #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(10,45,78,0.35), 0 2px 6px rgba(0,0,0,0.1);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.3s ease,
              background 0.2s ease;
  z-index: 9999;
}

.chat-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(10,45,78,0.45), 0 3px 10px rgba(0,0,0,0.12);
  background: var(--chat-primary-hover);
}

.chat-launcher:active { transform: scale(0.96); }

.chat-launcher svg {
  width: 28px;
  height: 28px;
  fill: white;
  transition: opacity 0.2s, transform 0.3s;
}

.chat-launcher .icon-close {
  position: absolute;
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

.chat-launcher.open .icon-chat {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

.chat-launcher.open .icon-close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Unread badge pulse */
.chat-launcher::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--chat-accent);
  border: 3px solid #f0f2f5;
  animation: pulse-badge 2s infinite;
  transition: opacity 0.3s;
}

.chat-launcher.open::after { opacity: 0; pointer-events: none; }

@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* Chat Window */
.chat-window {
  position: fixed;
  bottom: 104px;
  right: 28px;
  width: 390px;
  max-height: 760px;
  height: calc(100vh - 140px);
  background: var(--chat-bg);
  border-radius: var(--chat-radius);
  box-shadow: var(--chat-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9998;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header */
.chat-header {
  background: var(--chat-primary);
  padding: 20px 22px 18px;
  position: relative;
  overflow: hidden;
}

.chat-header::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
}

.chat-header-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: white;
  margin-bottom: 3px;
}

.chat-header-subtitle {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.75);
  font-weight: 400;
}

.chat-header-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  margin-right: 6px;
  vertical-align: middle;
  box-shadow: 0 0 6px rgba(74,222,128,0.5);
}

/* Chat Body */
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--chat-surface);
  scroll-behavior: smooth;
}

.chat-body::-webkit-scrollbar { width: 5px; }
.chat-body::-webkit-scrollbar-track { background: transparent; }
.chat-body::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; }

/* Chat Bubbles */
.chat-bubble {
  max-width: 88%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  animation: bubble-in 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes bubble-in {
  from { opacity: 0; transform: translateY(8px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-bubble.bot {
  background: var(--chat-bubble-bot);
  color: var(--chat-text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-bubble.user {
  background: var(--chat-bubble-user);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-bubble a {
  color: var(--chat-primary);
  font-weight: 600;
  font-size: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(10,45,78,0.3);
  transition: border-color 0.2s;
}

.chat-bubble a:hover { border-color: var(--chat-primary); }
.chat-bubble.user a { color: #bfdbfe; border-bottom-color: rgba(191,219,254,0.4); }

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 14px 18px;
  align-self: flex-start;
  background: var(--chat-bubble-bot);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  animation: bubble-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.typing-indicator span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9ca3af;
  animation: typing-dot 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Question Options */
.chat-options {
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-self: flex-start;
  max-width: 92%;
  animation: bubble-in 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.chat-option-btn {
  background: white;
  border: 1.5px solid var(--chat-border);
  border-radius: 12px;
  padding: 11px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.87rem;
  color: var(--chat-text);
  cursor: pointer;
  text-align: left;
  line-height: 1.4;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-option-btn:hover {
  border-color: var(--chat-primary);
  background: var(--chat-primary-light);
  color: var(--chat-primary);
  transform: translateX(3px);
}

.chat-option-btn:active { transform: translateX(1px) scale(0.99); }

.chat-option-btn .opt-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--chat-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

.chat-option-btn:hover .opt-icon { background: rgba(10,45,78,0.15); }

/* "None of these" / fallback button */
.chat-fallback-btn {
  background: transparent;
  border: 1.5px dashed var(--chat-border);
  border-radius: 12px;
  padding: 10px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.84rem;
  color: var(--chat-text-muted);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
  margin-top: 2px;
}

.chat-fallback-btn:hover {
  border-color: var(--chat-text-muted);
  color: var(--chat-text);
  background: rgba(0,0,0,0.02);
}

/* Restart Button */
.chat-restart-btn {
  background: transparent;
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  color: var(--chat-primary);
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 8px;
  align-self: center;
  transition: background 0.2s;
  font-weight: 500;
  margin-top: 4px;
  animation: bubble-in 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.chat-restart-btn:hover { background: var(--chat-primary-light); }

/* Footer */
.chat-footer {
  padding: 12px 16px;
  background: white;
  border-top: 1px solid var(--chat-border);
  text-align: center;
}

.chat-footer-text {
  font-size: 0.75rem;
  color: var(--chat-text-muted);
}

/* Responsive */
@media (max-width: 440px) {
  .chat-window {
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
  }
  .chat-launcher { bottom: 18px; right: 18px; }
}
