/* ==========================================================================
   Skyview Dental Chatbot — Premium CSS
   Theme: Deep Navy + Teal Gradient, Glassmorphism, Smooth Animations
   Font: Inter (Google Fonts)
   WCAG 2.1 AA compliant
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* --------------------------------------------------------------------------
   CSS Custom Properties (Design Tokens)
   -------------------------------------------------------------------------- */
:root {
  /* Brand Colors */
  --color-primary: #0a3d6b;         /* Deep navy */
  --color-primary-light: #0e5295;
  --color-accent: #00b4d8;          /* Teal */
  --color-accent-light: #48cae4;
  --color-accent-glow: rgba(0, 180, 216, 0.3);

  /* Surface Colors */
  --color-surface: rgba(255, 255, 255, 0.92);
  --color-surface-glass: rgba(255, 255, 255, 0.12);
  --color-surface-dark: #0d1f35;
  --color-bg-chat: #f0f6fb;

  /* Text Colors */
  --color-text-primary: #0d1f35;
  --color-text-secondary: #4a6080;
  --color-text-muted: #8ba0b8;
  --color-text-on-dark: #e8f4fd;
  --color-text-on-accent: #ffffff;

  /* Message Colors */
  --color-msg-user-bg: linear-gradient(135deg, #0e5295 0%, #00b4d8 100%);
  --color-msg-user-text: #ffffff;
  --color-msg-bot-bg: #ffffff;
  --color-msg-bot-text: #0d1f35;
  --color-msg-bot-border: rgba(0, 180, 216, 0.15);

  /* Status Colors */
  --color-success: #10b981;
  --color-error: #ef4444;
  --color-warning: #f59e0b;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(10, 61, 107, 0.08);
  --shadow-md: 0 8px 24px rgba(10, 61, 107, 0.12);
  --shadow-lg: 0 16px 48px rgba(10, 61, 107, 0.20);
  --shadow-bubble: 0 6px 32px rgba(0, 180, 216, 0.35);
  --shadow-window: 0 24px 72px rgba(10, 61, 107, 0.28), 0 4px 24px rgba(0, 180, 216, 0.12);

  /* Borders */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-full: 9999px;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-xs: 11px;
  --font-size-sm: 13px;
  --font-size-base: 14px;
  --font-size-md: 15px;
  --font-size-lg: 16px;
  --font-size-xl: 18px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Chat window dimensions */
  --chat-width: 400px;
  --chat-height: 620px;
  --bubble-size: 60px;

  /* Font size multiplier (accessibility) */
  --font-scale: 1;
}

/* High-contrast mode overrides */
.high-contrast {
  --color-primary: #003366;
  --color-accent: #0099bb;
  --color-text-primary: #000000;
  --color-text-secondary: #1a1a1a;
  --color-msg-bot-bg: #ffffff;
  --color-msg-bot-text: #000000;
  --color-surface: #ffffff;
  --shadow-window: 0 0 0 3px #000000;
}

/* --------------------------------------------------------------------------
   Base Reset
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* --------------------------------------------------------------------------
   Chat Bubble (Floating Trigger Button)
   -------------------------------------------------------------------------- */
#skyview-chat-bubble {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: var(--bubble-size);
  height: var(--bubble-size);
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
  box-shadow: var(--shadow-bubble);
  border: none;
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-slow), box-shadow var(--transition-base);
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

#skyview-chat-bubble:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow: 0 8px 40px rgba(0, 180, 216, 0.50);
}

#skyview-chat-bubble:focus-visible {
  outline: 3px solid var(--color-accent-light);
  outline-offset: 3px;
}

#skyview-chat-bubble:active {
  transform: scale(0.96);
}

#skyview-chat-bubble .bubble-icon {
  width: 28px;
  height: 28px;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

#skyview-chat-bubble .bubble-icon.hidden {
  opacity: 0;
  transform: scale(0.6) rotate(90deg);
  position: absolute;
}

#skyview-chat-bubble .bubble-icon.visible {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

/* Unread badge */
#skyview-chat-bubble .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: #ef4444;
  border-radius: var(--radius-full);
  border: 2px solid white;
  font-family: var(--font-family);
  font-size: 10px;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* Pulse ring animation for new visitors */
#skyview-chat-bubble::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: var(--radius-full);
  border: 2px solid var(--color-accent);
  opacity: 0;
  animation: pulseRing 3s ease-out infinite;
}

@keyframes pulseRing {
  0% { opacity: 0.6; transform: scale(0.95); }
  100% { opacity: 0; transform: scale(1.4); }
}

/* --------------------------------------------------------------------------
   Chat Window
   -------------------------------------------------------------------------- */
#skyview-chat-window {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: var(--chat-width);
  height: var(--chat-height);
  background: var(--color-bg-chat);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-window);
  z-index: 9998;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-family);
  font-size: calc(var(--font-size-base) * var(--font-scale));
  border: 1px solid rgba(0, 180, 216, 0.15);

  /* Hidden state */
  opacity: 0;
  transform: translateY(24px) scale(0.96);
  pointer-events: none;
  transition:
    opacity 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: bottom right;
}

#skyview-chat-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* --------------------------------------------------------------------------
   Chat Header
   -------------------------------------------------------------------------- */
.chat-header {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 60%, var(--color-accent) 100%);
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.chat-header::before {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 100px;
  height: 100px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.06);
  pointer-events: none;
}

.chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--color-surface-glass);
  border: 2px solid rgba(255,255,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-header-avatar svg {
  width: 22px;
  height: 22px;
  color: white;
}

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

.chat-header-name {
  font-size: var(--font-size-md);
  font-weight: 700;
  color: white;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.chat-header-status {
  font-size: var(--font-size-xs);
  color: rgba(255,255,255,0.75);
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: 2px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  background: #4ade80;
  display: inline-block;
  animation: statusPulse 2s ease infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.chat-header-actions {
  display: flex;
  gap: var(--space-2);
}

.header-btn {
  width: 32px !important;
  height: 32px !important;
  border-radius: var(--radius-sm) !important;
  background: rgba(255,255,255,0.12) !important;
  border: 1px solid rgba(255,255,255,0.20) !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: background var(--transition-fast);
  color: white !important;
  padding: 0 !important;
  box-shadow: none !important;
  text-decoration: none !important;
}

.header-btn:hover {
  background: rgba(255,255,255,0.22) !important;
}

.header-btn:focus-visible {
  outline: 2px solid rgba(255,255,255,0.8);
  outline-offset: 2px;
}

.header-btn svg {
  width: 16px !important;
  height: 16px !important;
  color: white !important;
  stroke: white !important;
  display: block !important;
}

/* --------------------------------------------------------------------------
   Messages Area
   -------------------------------------------------------------------------- */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  scroll-behavior: smooth;
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
  width: 4px;
}
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(0,180,216,0.25);
  border-radius: var(--radius-full);
}
.chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(0,180,216,0.45);
}

/* --------------------------------------------------------------------------
   Message Bubbles
   -------------------------------------------------------------------------- */
.message-wrapper {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  animation: messageSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes messageSlideIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.message-wrapper.user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
  font-size: 12px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.message-avatar svg {
  width: 14px;
  height: 14px;
}

.message-content {
  max-width: 78%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message-wrapper.user .message-content {
  align-items: flex-end;
}

.message-bubble {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: calc(var(--font-size-base) * var(--font-scale));
  line-height: 1.55;
  word-wrap: break-word;
  position: relative;
}

/* Bot message */
.message-wrapper.bot .message-bubble {
  background: var(--color-msg-bot-bg);
  color: var(--color-msg-bot-text);
  border: 1px solid var(--color-msg-bot-border);
  border-bottom-left-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

/* User message */
.message-wrapper.user .message-bubble {
  background: var(--color-msg-user-bg);
  color: var(--color-msg-user-text);
  border-bottom-right-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(14, 82, 149, 0.35);
}

/* Links in bot messages */
.message-wrapper.bot .message-bubble a {
  color: var(--color-primary-light);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.message-wrapper.bot .message-bubble a:hover {
  color: var(--color-accent);
}

/* Markdown in bot messages */
.message-wrapper.bot .message-bubble strong {
  font-weight: 600;
}

.message-wrapper.bot .message-bubble p {
  margin-bottom: var(--space-2);
}

.message-wrapper.bot .message-bubble p:last-child {
  margin-bottom: 0;
}

.message-wrapper.bot .message-bubble ul,
.message-wrapper.bot .message-bubble ol {
  padding-left: var(--space-4);
  margin: var(--space-1) 0 var(--space-2) 0;
}

.message-wrapper.bot .message-bubble li {
  margin-bottom: 2px;
  line-height: 1.45;
}

/* Rendered markdown tables inside bot messages */
.message-wrapper.bot .message-bubble .msg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
  margin: var(--space-2) 0;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.message-wrapper.bot .message-bubble .msg-table th {
  background: var(--color-accent);
  color: #fff;
  font-weight: 600;
  padding: 5px 8px;
  text-align: left;
  font-size: var(--font-size-xs);
  letter-spacing: 0.02em;
}

.message-wrapper.bot .message-bubble .msg-table td {
  padding: 4px 8px;
  vertical-align: top;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  line-height: 1.4;
}

.message-wrapper.bot .message-bubble .msg-table tr:last-child td {
  border-bottom: none;
}

.message-wrapper.bot .message-bubble .msg-table tr:nth-child(even) td {
  background: rgba(0,0,0,0.025);
}

.message-timestamp {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  padding: 0 var(--space-1);
}

/* --------------------------------------------------------------------------
   Typing Indicator
   -------------------------------------------------------------------------- */
.typing-wrapper {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  animation: messageSlideIn 0.25s ease both;
}

.typing-bubble {
  background: var(--color-msg-bot-bg);
  border: 1px solid var(--color-msg-bot-border);
  border-radius: var(--radius-lg);
  border-bottom-left-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 5px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  animation: typingBounce 1.2s ease infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.30s; }

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

/* --------------------------------------------------------------------------
   Welcome Screen
   -------------------------------------------------------------------------- */
.welcome-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  border: 1px solid var(--color-msg-bot-border);
  box-shadow: var(--shadow-sm);
  animation: messageSlideIn 0.4s ease both;
}

.welcome-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.welcome-logo-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  display: flex;
  align-items: center;
  justify-content: center;
}

.welcome-logo-icon svg {
  width: 24px;
  height: 24px;
  color: white;
}

.welcome-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
}

.welcome-subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.welcome-text {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-4);
}

/* Quick topic chips */
.quick-topics {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.quick-topic-chip {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  background: #f0f6fb;
  border: 1px solid rgba(0, 180, 216, 0.20);
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-primary-light);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  font-family: var(--font-family);
}

.quick-topic-chip:hover {
  background: var(--color-accent);
  color: white;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 180, 216, 0.3);
}

.quick-topic-chip:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Callback Prompt Banner
   -------------------------------------------------------------------------- */
.callback-banner {
  background: linear-gradient(135deg, #e8f4fd 0%, #d4f0f7 100%);
  border: 1px solid rgba(0, 180, 216, 0.25);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-1);
  animation: messageSlideIn 0.3s ease both;
}

.callback-banner-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.callback-banner-text {
  flex: 1;
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.callback-banner-btn {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: white;
  font-size: var(--font-size-xs);
  font-weight: 600;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  font-family: var(--font-family);
}

.callback-banner-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 4px 16px rgba(0, 180, 216, 0.4);
}

/* --------------------------------------------------------------------------
   Chat Input Area
   -------------------------------------------------------------------------- */
.chat-input-area {
  padding: var(--space-3) var(--space-4) var(--space-4);
  background: white;
  border-top: 1px solid rgba(0, 180, 216, 0.12);
  flex-shrink: 0;
}

/* Action row above input */
.input-actions-row {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.action-pill {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  background: #f0f6fb;
  border: 1px solid rgba(0, 180, 216, 0.20);
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-primary-light);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-family);
  white-space: nowrap;
}

.action-pill:hover {
  background: var(--color-accent);
  color: white;
  border-color: transparent;
}

.action-pill:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.action-pill svg {
  width: 12px;
  height: 12px;
}

/* Input wrapper */
.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  background: #f7fafd;
  border: 1.5px solid rgba(0, 180, 216, 0.20);
  border-radius: var(--radius-lg);
  padding: var(--space-2) var(--space-3);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-wrapper:focus-within {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-glow);
}

#chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-family);
  font-size: calc(var(--font-size-base) * var(--font-scale));
  color: var(--color-text-primary);
  resize: none;
  max-height: 100px;
  min-height: 24px;
  line-height: 1.5;
  overflow-y: auto;
}

#chat-input::placeholder {
  color: var(--color-text-muted);
}

#chat-input::-webkit-scrollbar {
  width: 3px;
}
#chat-input::-webkit-scrollbar-thumb {
  background: rgba(0,180,216,0.2);
  border-radius: var(--radius-full);
}

.char-counter {
  font-size: 10px;
  color: var(--color-text-muted);
  align-self: flex-end;
  flex-shrink: 0;
  transition: color var(--transition-fast);
}

.char-counter.near-limit {
  color: var(--color-warning);
}

.char-counter.at-limit {
  color: var(--color-error);
  font-weight: 600;
}

#send-btn {
  width: 36px !important;
  height: 36px !important;
  border-radius: var(--radius-full) !important;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent)) !important;
  border: none !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-fast);
  box-shadow: 0 4px 12px rgba(0, 180, 216, 0.3) !important;
  padding: 0 !important;
  min-width: unset !important;
  min-height: unset !important;
}

#send-btn:hover:not(:disabled) {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(0, 180, 216, 0.45) !important;
}

#send-btn:focus-visible {
  outline: 3px solid var(--color-accent-light);
  outline-offset: 2px;
}

#send-btn:disabled {
  opacity: 0.5 !important;
  cursor: not-allowed;
  transform: none;
}

#send-btn svg {
  width: 16px !important;
  height: 16px !important;
  color: white !important;
  stroke: white !important;
  display: block !important;
}

/* Disclaimer */
.chat-disclaimer {
  font-size: 10px;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: var(--space-2);
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   Callback Modal
   -------------------------------------------------------------------------- */
#callback-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 61, 107, 0.60);
  backdrop-filter: blur(6px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

#callback-modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

#callback-modal {
  background: white;
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-window);
  transform: scale(0.94) translateY(16px);
  transition: transform var(--transition-slow);
  position: relative;
}

#callback-modal-overlay.open #callback-modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}



.modal-icon {
  font-size: 28px;
  margin-bottom: var(--space-2);
  display: block;
}

.modal-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
}

.modal-subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-top: var(--space-1);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: #f0f6fb;
  border: 1px solid rgba(0,0,0,0.08);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.modal-close:hover {
  background: #fee2e2;
  color: var(--color-error);
}

.modal-close:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Form fields */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.form-label .required {
  color: var(--color-error);
  margin-left: 2px;
}

.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid #e2eaf4;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--color-text-primary);
  background: #f7fafd;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-glow);
  background: white;
}

.form-input.error {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.form-input.success {
  border-color: var(--color-success);
}

.field-error {
  font-size: var(--font-size-xs);
  color: var(--color-error);
  margin-top: var(--space-1);
  display: none;
}

.field-error.visible {
  display: block;
}

.form-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234a6080' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.submit-btn {
  width: 100%;
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: white;
  font-family: var(--font-family);
  font-size: var(--font-size-md);
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-fast);
  box-shadow: 0 4px 16px rgba(0, 180, 216, 0.3);
  letter-spacing: 0.01em;
  margin-top: var(--space-2);
}

.submit-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 180, 216, 0.45);
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.submit-btn.loading {
  position: relative;
  color: transparent;
}

.submit-btn.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin: auto;
  border: 2px solid white;
  border-top-color: transparent;
  border-radius: var(--radius-full);
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Success state */
.modal-success {
  text-align: center;
  padding: var(--space-6) 0;
}

.success-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-success), #34d399);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-4);
  animation: successPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes successPop {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.success-icon svg {
  width: 32px;
  height: 32px;
  color: white;
}

.success-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.success-text {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  line-height: 1.6;
}

/* Privacy note */
.privacy-note {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-align: center;
  margin-top: var(--space-3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
}

/* --------------------------------------------------------------------------
   Accessibility Panel
   -------------------------------------------------------------------------- */
.a11y-panel {
  background: white;
  border-top: 1px solid rgba(0, 180, 216, 0.12);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.a11y-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.a11y-controls {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.a11y-btn {
  padding: 3px var(--space-2);
  border-radius: var(--radius-sm);
  background: #f0f6fb;
  border: 1px solid rgba(0,180,216,0.15);
  font-size: 11px;
  font-family: var(--font-family);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-weight: 500;
}

.a11y-btn:hover {
  background: var(--color-accent);
  color: white;
  border-color: transparent;
}

.a11y-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.a11y-btn.active {
  background: var(--color-primary);
  color: white;
  border-color: transparent;
}

/* --------------------------------------------------------------------------
   Toast Notifications
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  background: white;
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--color-accent);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  color: var(--color-text-primary);
  max-width: 320px;
  animation: toastSlide 0.3s ease both;
  pointer-events: all;
}

.toast.error { border-left-color: var(--color-error); }
.toast.success { border-left-color: var(--color-success); }
.toast.warning { border-left-color: var(--color-warning); }

@keyframes toastSlide {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast.exiting {
  animation: toastFade 0.25s ease both;
}

@keyframes toastFade {
  to { opacity: 0; transform: translateX(20px); }
}

/* --------------------------------------------------------------------------
   Responsive — Mobile
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  :root {
    --chat-width: 100vw;
    --chat-height: 100dvh;
    --bubble-size: 56px;
  }

  #skyview-chat-window {
    bottom: 0;
    right: 0;
    left: 0;
    top: 0;
    border-radius: 0;
    width: 100%;
    height: 100%;
  }

  #skyview-chat-bubble {
    bottom: 20px;
    right: 20px;
  }
}

/* --------------------------------------------------------------------------
   Reduced Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------------------------------
   Print (hide chatbot entirely)
   -------------------------------------------------------------------------- */
@media print {
  #skyview-chat-bubble,
  #skyview-chat-window,
  #callback-modal-overlay,
  .toast-container {
    display: none !important;
  }
}
