/**
 * Full-Page Chat Interface Styles
 * Modern, professional design for Twins Real Estate chatbot
 */

:root {
  /* Light Mode (Default) */
  --primary: #0c2340;
  --primary-dark: #0284c7;
  --primary-light: #1a3a5a;
  --surface: #ffffff;
  --surface-hover: #f8fafc;
  --surface-dark: #f1f5f9;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Dark Mode */
[data-theme="dark"] {
  --primary: #1a3a5a;
  --primary-dark: #0c2340;
  --primary-light: #7dd3fc;
  --surface: #1e293b;
  --surface-hover: #334155;
  --surface-dark: #0f172a;
  --border: #334155;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-light: #cbd5e1;
  --success: #34d399;
  --warning: #fbbf24;
  --error: #f87171;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.7);
}

/* Auto Dark Mode - System Preference (Fallback) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #1a3a5a;
    --primary-dark: #0c2340;
    --primary-light: #7dd3fc;
    --surface: #1e293b;
    --surface-hover: #334155;
    --surface-dark: #0f172a;
    --border: #334155;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --text-light: #cbd5e1;
    --success: #34d399;
    --warning: #fbbf24;
    --error: #f87171;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.7);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Container - Full Screen Fixed */
.chat-fullpage-container {
  display: flex;
  position: fixed;
  top: var(--site-header-height, 56px);
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: calc(100vh - var(--site-header-height, 56px));
  height: calc(100dvh - var(--site-header-height, 56px)); /* Dynamic viewport for mobile */
  overflow: hidden;
  background: var(--surface, #ffffff);
  z-index: 1000;
  box-sizing: border-box;
  /* Prevent body scroll */
  touch-action: none;
  overscroll-behavior: none;
}

/* Ultra-black dark mode background */
[data-theme="dark"] .chat-fullpage-container {
  background: #000000 !important; /* Ultra-black */
}

[data-theme="dark"] .messages-area {
  background: transparent !important;
}

[data-theme="dark"] .chat-main {
  background: #000000 !important; /* Ultra-black */
}

/* Professional Background Pattern - Removed to eliminate white background */
.chat-fullpage-container::before {
  display: none;
}

/* Dark mode background pattern */
[data-theme="dark"] .chat-fullpage-container::before {
  opacity: 0.15;
}

/* Light mode specific enhancements - Removed background */
[data-theme="light"] .chat-fullpage-container {
  background: transparent;
}

/* Sidebar - Hidden by default, show on toggle */
.chat-sidebar {
  width: 280px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  transform: translateX(-100%);
}

.chat-sidebar.open {
  transform: translateX(0);
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}

.company-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.company-logo .logo-image,
.company-logo .logo-image-dark {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}

[data-theme="light"] .company-logo .logo-image {
  display: block;
}

[data-theme="light"] .company-logo .logo-image-dark,
[data-theme="light"] .company-logo .logo-svg {
  display: none;
}

[data-theme="dark"] .company-logo .logo-image-dark {
  display: block;
}

[data-theme="dark"] .company-logo .logo-image,
[data-theme="dark"] .company-logo .logo-svg {
  display: none;
}

/* Fallback to SVG if images not loaded */
.company-logo .logo-svg {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.company-logo h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.company-logo p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--surface-hover);
}

.nav-item.active {
  background: var(--primary);
  color: white;
}

.nav-item svg {
  flex-shrink: 0;
}

.session-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  transition: all 0.2s ease;
  border-radius: 8px;
  margin: 2px 8px;
}

.session-item:hover {
  background: var(--surface-hover);
}

.session-item.active {
  background: var(--primary);
  color: white;
}

.session-item.active div {
  color: white;
}

.chat-history {
  margin-top: 24px;
}

.chat-history h4 {
  padding: 8px 20px;
  margin: 0 0 8px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#chat-sessions-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

/* Main Chat Area - Full Screen */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  overflow: hidden;
  position: relative;
  z-index: 1;
  height: 100%;
  min-height: 0;
}

/* Header - Compact */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  min-height: 56px;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

/* Messages Area - Scrollable like widget */
.messages-area {
  flex: 1 1 auto;
  min-height: 0; /* Critical for scrollable flex children */
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  gap: 16px; /* Space between messages */
  /* Remove background completely to eliminate double container effect */
  background: transparent;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  /* Prevent scroll chaining to body */
  touch-action: pan-y;
  /* Allow messages to align themselves (left/right) */
  align-items: flex-start;
  align-content: flex-start;
  justify-content: flex-start;
}

.messages-area::-webkit-scrollbar {
  width: 6px;
}

.messages-area::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
}

.messages-area::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}

.messages-area::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

/* Welcome Section - Simplified */
.welcome-section {
  max-width: 600px;
  margin: 40px auto 20px;
  text-align: center;
  padding: 0 16px;
}

.welcome-icon {
  margin-bottom: 16px;
  display: flex;
  justify-content: center;
  animation: wave 2s ease-in-out infinite;
}

.welcome-icon span {
  font-size: 3rem;
}

@keyframes wave {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(14deg); }
  75% { transform: rotate(-14deg); }
}

.welcome-section h2 {
  margin: 0 0 12px 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.welcome-section p {
  margin: 0 0 24px 0;
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.6;
}

.welcome-section p strong {
  color: var(--primary);
  font-weight: 600;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  justify-content: center;
  max-width: 500px;
  margin: 0 auto;
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 12px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  text-align: center;
}

.quick-action-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.quick-action-btn:hover::before {
  transform: scaleY(1);
}

.quick-action-btn:hover {
  background: var(--surface-hover);
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(12, 35, 64, 0.2);
}

.quick-action-icon {
  font-size: 2rem;
  display: block;
}

.quick-action-text {
  display: block;
  text-align: center;
}

/* Messages - Simple, minimal like widget */
.message {
  display: flex;
  align-items: flex-end;
  animation: slideInMessage 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  margin-bottom: 0;
  clear: both;
  position: relative;
  min-height: 44px;
  z-index: 1;
  isolation: isolate;
  /* Prevent compression - critical fix */
  flex-shrink: 0;
  flex-grow: 0;
  /* Messages will align themselves via align-self */
  /* No background - only bubbles have backgrounds */
  background: transparent;
}

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

/* User messages - RIGHT side (like standard chat apps) */
.message.user {
  justify-content: flex-end;
  flex-direction: row-reverse;
  align-self: flex-end;
  /* Remove max-width restriction to prevent cutting */
  width: auto;
  max-width: 90%;
}

/* Bot/Assistant messages - LEFT side (like standard chat apps) */
.message.assistant,
.message.bot {
  justify-content: flex-start;
  flex-direction: row;
  align-self: flex-start;
  /* Remove max-width restriction to prevent cutting */
  width: auto;
  max-width: 90%;
}

/* Avatar - Match widget style */
.message-avatar,
.chatbot-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.1);
  transition: transform 0.2s ease;
}

.message.assistant .message-avatar,
.message.bot .message-avatar,
.message.assistant .chatbot-avatar,
.message.bot .chatbot-avatar {
  background: linear-gradient(135deg, var(--primary, #0c2340), #1a3654);
  color: white;
  margin-right: 12px;
}

.message.user .message-avatar,
.message.user .chatbot-avatar {
  background: linear-gradient(135deg, var(--chatbot-accent, #d4af37), var(--accent-color-dark, #b49225));
  color: white;
  margin-left: 12px;
}

/* Message bubble - Match widget style - Improved UI */
.message-content,
.chatbot-bubble {
  padding: 14px 18px;
  border-radius: 18px;
  line-height: 1.6;
  font-size: 0.95rem;
  min-width: 60px;
  box-sizing: border-box;
  /* Prevent compression - critical fix */
  flex: 0 0 auto;
  flex-shrink: 0;
  /* Use fit-content but allow proper width calculation - prevent cutting */
  width: fit-content;
  max-width: min(calc(100vw - 140px), 650px);
  /* Ensure text doesn't get cut - add padding for safety */
  padding-right: 2px;
  position: relative;
  /* Enhanced shadow for depth */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(10px);
  /* Ensure content is not cut - CRITICAL FIX */
  overflow: visible;
  min-height: auto;
  /* Smooth transitions */
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  /* Text wrapping - prevent cutting */
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  white-space: normal;
  /* Ensure text content doesn't get clipped */
  text-overflow: clip;
}

/* Text content inside bubbles - prevent cutting */
.message-content *,
.chatbot-bubble * {
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
  overflow: visible;
  /* Ensure text doesn't get clipped */
  text-overflow: clip;
  white-space: normal;
}

/* Paragraphs inside messages - prevent cutting */
.message-content p,
.chatbot-bubble p,
.message-content .ar-paragraph,
.chatbot-bubble .ar-paragraph {
  margin: 0 0 8px 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  max-width: 100%;
  overflow: visible;
  /* Critical: prevent text from being cut */
  text-overflow: clip;
  white-space: normal;
}

.message-content p:last-child,
.chatbot-bubble p:last-child,
.message-content .ar-paragraph:last-child,
.chatbot-bubble .ar-paragraph:last-child {
  margin-bottom: 0;
}

/* Hover effect for better interactivity */
.message:hover .chatbot-bubble {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.message.user .message-content,
.message.user .chatbot-bubble {
  background: linear-gradient(135deg, var(--primary, #0c2340), #1a3654);
  color: white;
  border-bottom-right-radius: 6px;
  margin-right: 0;
  /* Enhanced shadow for user messages */
  box-shadow: 0 3px 10px rgba(12, 35, 64, 0.2), 0 1px 3px rgba(12, 35, 64, 0.15);
}

.message.user:hover .chatbot-bubble {
  box-shadow: 0 5px 15px rgba(12, 35, 64, 0.25), 0 2px 5px rgba(12, 35, 64, 0.2);
}

.message.assistant .message-content,
.message.bot .message-content,
.message.assistant .chatbot-bubble,
.message.bot .chatbot-bubble {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 249, 250, 0.95));
  color: var(--text, #333333);
  border-bottom-left-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  margin-left: 0;
  /* Subtle shadow for bot messages */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.05);
}

.message.bot:hover .chatbot-bubble,
.message.assistant:hover .chatbot-bubble {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.08);
}

/* Dark mode message bubbles - Enhanced */
[data-theme="dark"] .message.bot .chatbot-bubble,
[data-theme="dark"] .message.assistant .chatbot-bubble,
[data-theme="dark"] .message.bot .message-content,
[data-theme="dark"] .message.assistant .message-content {
  background: linear-gradient(135deg, #0a0a0a, #121212) !important;
  color: #ffffff !important;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.9), 0 1px 3px rgba(0, 0, 0, 0.7) !important;
  border: 1px solid #2a2a2a !important;
}

[data-theme="dark"] .message.bot:hover .chatbot-bubble,
[data-theme="dark"] .message.assistant:hover .chatbot-bubble {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.95), 0 2px 5px rgba(0, 0, 0, 0.8) !important;
}

[data-theme="dark"] .message.user .chatbot-bubble,
[data-theme="dark"] .message.user .message-content {
  background: linear-gradient(135deg, #d4af37, #b49225) !important;
  color: #000000 !important;
  box-shadow: 0 3px 10px rgba(212, 175, 55, 0.5), 0 1px 3px rgba(212, 175, 55, 0.3) !important;
}

[data-theme="dark"] .message.user:hover .chatbot-bubble {
  box-shadow: 0 5px 15px rgba(212, 175, 55, 0.6), 0 2px 5px rgba(212, 175, 55, 0.4) !important;
}

[data-theme="dark"] .message.user .chatbot-bubble *,
[data-theme="dark"] .message.user .message-content * {
  color: #000000 !important;
}

/* Message content formatting */
.message-content p.ar-paragraph {
  margin: 0 0 12px 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.message-content p.ar-paragraph:last-child {
  margin-bottom: 0;
}

/* Ensure proper text flow for longer messages */
.message-content {
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

.message-content strong {
  font-weight: 600;
}

.message-content em {
  font-style: italic;
}

/* Message links styling */
.message-link {
  color: #0c2340;
  text-decoration: underline;
  font-weight: 500;
  transition: all 0.2s ease;
  border-radius: 4px;
  padding: 2px 4px;
  display: inline-block;
}

.message-link:hover {
  color: #0284c7;
  text-decoration: none;
  background: rgba(12, 35, 64, 0.1);
  padding: 2px 6px;
  transform: translateY(-1px);
}

/* Dark theme link styling */
[data-theme="dark"] .message-link {
  color: #60a5fa;
}

[data-theme="dark"] .message-link:hover {
  color: #3b82f6;
  background: rgba(96, 165, 250, 0.1);
}

/* Lists in messages */
.message-content ul.ar-list,
.message-content ol.ar-list {
  margin: 12px 0;
  padding-left: 0;
  list-style: none;
}

.message-content ol.ar-list {
  counter-reset: message-counter;
  list-style: none;
  padding-left: 0;
  margin: 12px 0;
}

.message-content ul.ar-list li {
  position: relative;
  padding-left: 28px;
  margin-bottom: 8px;
}

.message-content ul.ar-list li::before {
  content: "â¢";
  position: absolute;
  left: 8px;
  color: var(--primary);
  font-weight: bold;
  font-size: 16px;
}

.message.user .message-content ul.ar-list li::before {
  color: rgba(255, 255, 255, 0.95);
}

.message-content ol.ar-list li {
  position: relative;
  padding-left: 32px;
  margin-bottom: 8px;
  counter-increment: message-counter;
  display: block;
}

.message-content ol.ar-list li::before {
  content: counter(message-counter) ".";
  position: absolute;
  left: 4px;
  color: var(--primary);
  font-weight: 600;
  min-width: 20px;
  text-align: right;
}

.message.user .message-content ol.ar-list li::before {
  color: rgba(255, 255, 255, 0.95);
}

/* Image Messages - Enhanced Display */
.message__image {
  max-width: 100%;
  max-height: 400px;
  width: auto;
  height: auto;
  border-radius: 12px;
  margin: 0 0 12px 0;
  display: block;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  transition: transform 200ms ease, box-shadow 200ms ease;
  cursor: pointer;
  object-fit: cover;
  background: var(--surface);
}

.message__image:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
}

.message__image-caption {
  font-size: 13px;
  color: var(--text-muted);
  padding: 4px 0;
  font-weight: 500;
  letter-spacing: 0.01em;
  margin-top: 8px;
}

.message.user .message__image-caption {
  color: rgba(255, 255, 255, 0.9);
}

/* Image Upload Progress/Loading */
.image-upload-progress {
  padding: 12px 16px;
  margin: 12px 0;
  background: var(--surface-dark);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.image-upload-progress__icon {
  width: 24px;
  height: 24px;
  border: 2px solid var(--primary);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spinner-rotate 0.8s linear infinite;
}

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

.image-upload-progress__text {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

/* Image Preview before Upload */
.image-preview-container {
  position: relative;
  max-width: 100%;
  margin: 12px 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-dark);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.image-preview-container img {
  max-width: 100%;
  max-height: 350px;
  display: block;
  object-fit: contain;
}

.image-preview-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: 500;
}

/* Error Message Styles */
.message-error {
  background: #fee2e2 !important;
  color: #991b1b !important;
  padding: 12px 16px !important;
  border-radius: 10px !important;
  font-size: 14px !important;
  border: 1px solid #fecaca !important;
  margin: 12px 0 !important;
  box-shadow: 0 2px 8px rgba(153, 27, 27, 0.1) !important;
  font-weight: 500;
}

[data-theme="dark"] .message-error {
  background: #7f1d1d !important;
  color: #fecaca !important;
  border-color: #991b1b !important;
}

.message-time {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
  padding: 0 4px;
}

/* Typing Indicator - Match widget style */
.typing-indicator-fullpage {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 0;
  animation: slideInMessage 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  /* Match message structure */
  justify-content: flex-start;
  flex-direction: row;
  align-self: flex-start;
  width: auto;
  max-width: 90%;
}

.typing-indicator-fullpage .chatbot-avatar {
  margin-right: 12px;
  flex-shrink: 0;
}

.typing-indicator-fullpage .chatbot-bubble {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 60px;
  /* Match bot message bubble style */
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(248, 249, 250, 0.9));
  border-bottom-left-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .typing-indicator-fullpage .chatbot-bubble {
  background: linear-gradient(135deg, #0a0a0a, #121212) !important;
  border: 1px solid #2a2a2a !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.8) !important;
}

.typing-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.typing-dots span {
  width: 10px;
  height: 10px;
  background-color: var(--text-muted, #94a3b8);
  border-radius: 50%;
  display: inline-block;
  animation: typing 1.4s infinite ease-in-out both;
}

[data-theme="dark"] .typing-dots span {
  background-color: #64748b;
}

.typing-dots span:nth-child(1) {
  animation-delay: 0s;
}

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

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

@keyframes typing {
  0%, 60%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  30% {
    transform: scale(1.1);
    opacity: 1;
  }
}

.typing-indicator-fullpage p {
  display: none; /* Hide text, show only dots */
}

/* Input Area - Thin, compact like proper chat */
.chat-input-area {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 8px 12px;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.05);
}

.input-container {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 6px 10px;
  transition: all 0.2s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.input-container:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(12, 35, 64, 0.08);
}

.input-action-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  padding: 0;
}

.input-action-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--primary);
}

.input-action-btn.recording {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

.input-wrapper {
  flex: 1;
  min-width: 0;
}

#message-input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 100px;
  line-height: 1.4;
  padding: 4px 8px;
  margin: 0;
}

/* Dark mode - ensure text is visible */
[data-theme="dark"] #message-input {
  color: #e2e8f0 !important; /* Explicit light color */
  background: transparent !important;
}

[data-theme="dark"] #message-input:focus {
  color: #f8fafb !important; /* Even brighter when focused */
}

#message-input::placeholder {
  color: var(--text-light);
}

/* Dark mode placeholder */
[data-theme="dark"] #message-input::placeholder {
  color: #cbd5e1 !important; /* Light placeholder */
}

.send-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  padding: 0;
  box-shadow: 0 2px 4px rgba(12, 35, 64, 0.2);
}

.send-btn:hover {
  background: var(--primary-dark);
  transform: scale(1.05);
}

.send-btn:active {
  transform: scale(0.95);
}

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

.input-footer {
  margin-top: 4px;
  padding: 0 8px;
  display: none; /* Hide hint text for cleaner look */
}

.hint-text {
  margin: 0;
  font-size: 12px;
  color: var(--text-light);
}

kbd {
  padding: 2px 6px;
  background: var(--surface-dark);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  font-family: monospace;
}

/* Responsive - Full Screen Mobile */
@media (max-width: 768px) {
  .chat-fullpage-container {
    position: fixed;
    top: var(--site-header-height, 50px);
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: calc(100vh - var(--site-header-height, 50px));
    height: calc(100dvh - var(--site-header-height, 50px));
  }

  .chat-sidebar {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
    width: 280px;
  }

  .chat-sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .chat-main {
    flex: 1;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .chat-header {
    padding: 10px 16px;
    min-height: 48px;
  }

  .chat-header h1 {
    font-size: 16px;
  }

  .messages-area {
    flex: 1 1 auto;
    min-height: 0;
    padding: 16px 12px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0));
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    /* Allow messages to align themselves (left/right) on mobile */
    align-items: flex-start;
    align-content: flex-start;
    justify-content: flex-start;
    /* Remove background completely to eliminate double container effect on mobile */
    background: transparent !important;
  }

  .message.user {
    max-width: 90%;
  }

  .message.bot,
  .message.assistant {
    max-width: 90%;
  }

  .message-content,
  .chatbot-bubble {
    font-size: 14px;
    padding: 12px 16px;
    /* Prevent compression on mobile */
    flex: 0 0 auto;
    flex-shrink: 0;
    width: fit-content;
    min-width: 60px;
    /* Better width calculation for mobile - prevent cutting */
    max-width: min(calc(100vw - 100px), 85vw);
    /* Ensure content is not cut on mobile */
    overflow: visible;
    min-height: auto;
  }

  .message {
    /* Prevent compression on mobile */
    flex-shrink: 0;
    flex-grow: 0;
    /* No background - only bubbles have backgrounds */
    background: transparent;
  }

  /* Typing indicator mobile styles */
  .typing-indicator-fullpage {
    max-width: 90%;
  }

  .typing-indicator-fullpage .chatbot-bubble {
    padding: 12px 16px;
  }

  .typing-dots span {
    width: 8px;
    height: 8px;
  }

  /* Enhanced message boxes on mobile */
  .message-content,
  .chatbot-bubble {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.08);
  }

  .message.user .chatbot-bubble {
    box-shadow: 0 3px 8px rgba(12, 35, 64, 0.2), 0 1px 2px rgba(12, 35, 64, 0.15);
  }

  .message.bot .chatbot-bubble,
  .message.assistant .chatbot-bubble {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.05);
  }

  .message-avatar,
  .chatbot-avatar {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .welcome-section {
    margin: 20px auto;
    padding: 0 12px;
  }

  .welcome-section h2 {
    font-size: 20px;
    margin-bottom: 10px;
  }

  .welcome-section p {
    font-size: 14px;
    margin-bottom: 16px;
  }

  .welcome-icon {
    margin-bottom: 12px;
  }

  .welcome-icon span {
    font-size: 2.5rem !important;
  }

  .quick-actions {
    gap: 10px;
    max-width: 100%;
  }

  .quick-action-btn {
    padding: 12px 10px;
    font-size: 12px;
    gap: 6px;
  }

  .quick-action-icon {
    font-size: 1.2rem;
  }

  .chat-quick-actions-fullpage {
    padding: 8px 12px;
    gap: 6px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0));
  }

  .quick-action-btn-fullpage {
    font-size: 11px;
    padding: 8px 10px;
    min-width: calc(50% - 3px);
    max-width: calc(50% - 3px);
    gap: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .quick-action-btn-fullpage i {
    font-size: 12px;
  }

  .chat-input-area {
    padding: 6px 10px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0));
  }

  .input-container {
    padding: 4px 8px;
    border-radius: 20px;
    gap: 4px;
  }

  .input-action-btn,
  .send-btn {
    width: 28px;
    height: 28px;
  }

  .input-action-btn svg,
  .send-btn svg {
    width: 16px;
    height: 16px;
  }

  #message-input {
    font-size: 14px;
    padding: 4px 6px;
    max-height: 80px;
  }

  .input-footer {
    margin-top: 4px;
    padding: 0 2px;
  }

  .hint-text {
    font-size: 10px;
  }

  .input-footer {
    display: none; /* Hide hint on mobile to save space */
  }
}

/* ============================================
   ENHANCED LIGHT MODE STYLING
   ============================================ */

[data-theme="light"] .chat-sidebar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .chat-main {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
}

[data-theme="light"] .chat-header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .message.assistant .message-content {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid rgba(12, 35, 64, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .message.user .message-content {
  background: linear-gradient(135deg, #0c2340 0%, #0284c7 100%);
  box-shadow: 0 4px 12px rgba(12, 35, 64, 0.25);
}

[data-theme="light"] .welcome-section h2 {
  background: linear-gradient(135deg, #0c2340 0%, #0284c7 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .quick-action-btn {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(12, 35, 64, 0.2);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .quick-action-btn:hover {
  background: rgba(12, 35, 64, 0.05);
  border-color: rgba(12, 35, 64, 0.4);
  box-shadow: 0 4px 12px rgba(12, 35, 64, 0.15);
  transform: translateY(-2px);
}

[data-theme="light"] .chat-input-area {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .input-container {
  background: rgba(248, 250, 252, 0.8);
  border: 1px solid rgba(12, 35, 64, 0.2);
}

[data-theme="light"] .input-container:focus-within {
  border-color: rgba(12, 35, 64, 0.5);
  box-shadow: 0 0 0 3px rgba(12, 35, 64, 0.1);
}

[data-theme="light"] .send-btn {
  background: linear-gradient(135deg, #0c2340 0%, #0284c7 100%);
  box-shadow: 0 4px 12px rgba(12, 35, 64, 0.3);
}

[data-theme="light"] .send-btn:hover {
  box-shadow: 0 6px 16px rgba(12, 35, 64, 0.4);
  transform: translateY(-1px);
}

[data-theme="light"] .nav-item.active {
  background: linear-gradient(135deg, rgba(12, 35, 64, 0.1) 0%, rgba(12, 35, 64, 0.05) 100%);
  border-left: 3px solid #0c2340;
}

[data-theme="light"] .nav-item:hover {
  background: rgba(12, 35, 64, 0.05);
}

/* ============================================
   ENHANCED DARK MODE STYLING
   ============================================ */

[data-theme="dark"] .chat-sidebar {
  background: #000000 !important; /* Ultra-black */
  backdrop-filter: blur(20px);
}

[data-theme="dark"] .chat-main {
  background: #000000 !important; /* Ultra-black */
  backdrop-filter: blur(10px);
}

[data-theme="dark"] .chat-header {
  background: #000000 !important; /* Ultra-black */
  backdrop-filter: blur(20px);
  border-bottom: 1px solid #1a1a1a;
}

[data-theme="dark"] .message.assistant .message-content {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .message.user .message-content {
  background: linear-gradient(135deg, #1a3a5a 0%, #0c2340 100%);
  box-shadow: 0 4px 12px rgba(26, 58, 90, 0.3);
}

[data-theme="dark"] .welcome-section h2 {
  background: linear-gradient(135deg, #1a3a5a 0%, #7dd3fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Quick Action Buttons - Compact */
.chat-quick-actions-fullpage {
  padding: 10px 16px;
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--border);
  background: transparent;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: center;
}

[data-theme="dark"] .chat-quick-actions-fullpage {
  background: transparent !important;
  border-top: 1px solid #1a1a1a;
}

.quick-action-btn-fullpage {
  flex: 1;
  min-width: calc(50% - 4px);
  max-width: calc(50% - 4px);
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.quick-action-btn-fullpage i {
  font-size: 14px;
  flex-shrink: 0;
}

.quick-action-btn-fullpage:hover {
  background: var(--surface-hover);
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(12, 35, 64, 0.15);
}

.quick-action-btn-fullpage:active {
  transform: translateY(0);
}

/* Dark theme for quick actions */
[data-theme="dark"] .quick-action-btn-fullpage {
  background: rgba(51, 65, 85, 0.6);
  border-color: rgba(75, 85, 99, 0.3);
  color: var(--text);
}

[data-theme="dark"] .quick-action-btn-fullpage:hover {
  background: linear-gradient(135deg, #4b5563 0%, #6b7280 100%);
  color: white;
  border-color: #4b5563;
}

[data-theme="dark"] .quick-action-btn {
  background: rgba(51, 65, 85, 0.8);
  border: 1px solid rgba(26, 58, 90, 0.2);
}

[data-theme="dark"] .quick-action-btn:hover {
  background: rgba(26, 58, 90, 0.1);
  border-color: rgba(26, 58, 90, 0.4);
  box-shadow: 0 4px 12px rgba(26, 58, 90, 0.2);
  transform: translateY(-2px);
}

[data-theme="dark"] .chat-input-area {
  background: #000000 !important; /* Ultra-black */
  backdrop-filter: blur(20px);
  border-top: 1px solid #1a1a1a;
}

[data-theme="dark"] .input-container {
  background: rgba(51, 65, 85, 0.6);
  border: 1px solid rgba(26, 58, 90, 0.2);
}

[data-theme="dark"] .input-container:focus-within {
  border-color: rgba(26, 58, 90, 0.5);
  box-shadow: 0 0 0 3px rgba(26, 58, 90, 0.1);
}

[data-theme="dark"] .send-btn {
  background: linear-gradient(135deg, #1a3a5a 0%, #0c2340 100%);
  box-shadow: 0 4px 12px rgba(26, 58, 90, 0.3);
}

[data-theme="dark"] .send-btn:hover {
  box-shadow: 0 6px 16px rgba(26, 58, 90, 0.4);
  transform: translateY(-1px);
}

[data-theme="dark"] .nav-item.active {
  background: linear-gradient(135deg, rgba(26, 58, 90, 0.1) 0%, rgba(26, 58, 90, 0.05) 100%);
  border-left: 3px solid #1a3a5a;
}

[data-theme="dark"] .nav-item:hover {
  background: rgba(26, 58, 90, 0.05);
}
