/* ===================================================================
   SFDA Copilot – Unified, WCAG-AA Compliant Stylesheet
   Optimized for Maintainability and Performance (February 2025)
   =================================================================== */

/* Custom Properties – Light Theme */
:root {
  /* Brand Colors */
  --primary-color: #89a8b2;
  --primary-color-rgb: 137 168 178;
  --accent-color: #b3c8cf;
  --accent-color-rgb: 179 200 207;
  --accent-color-hover: #7a939f;
  --accent-color-hover-rgb: 122 147 159;

  /* Base Colors */
  --color-success: #27ae60;
  --color-success-rgb: 39 174 96;
  --color-success-hover: #229954;
  --color-error: #e74c3c;
  --color-error-rgb: 231 76 60;
  --color-warning: #f39c12;
  --color-warning-rgb: 243 156 18;
  --color-warning-bg: rgba(241 196 15 / 0.2);

  /* Typography */
  --text-color-dark: #34495e;
  --text-color-dark-muted: #7f8c8d;
  --text-color-light: #89a8b2;
  --text-color-light-secondary: #b3c8cf;
  --text-color-light-muted: #bdc3c7;
  --font-primary: 'Open Sans', sans-serif;
  --font-headings: 'Roboto', sans-serif;
  --font-mono: monospace;

  /* Layout */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-msg: 18px;

  /* Borders */
  --border-color-light: #dcdfe4;
  --border-color-medium: #bdc3c7;
  --border-color-dark: #7f8c8d;
  --border-color-modal: rgba(189 195 199 / 0.3);

  /* Backgrounds */
  --background-light: #f1f0e8;
  --background-light-alt: #e5e1da;
  --background-dark-accent: rgba(44 62 80 / 0.8);
  --background-dark-accent-strong: rgba(44 62 80 / 0.95);
  --gradient-background: linear-gradient(135deg, #f1f0e8 0%, #e5e1da 100%);

  /* Toast */
  --toast-bg: var(--text-color-dark);
  --toast-text: var(--white-90);

  /* Focus */
  --focus-shadow-color: rgba(44 62 80 / 0.25);

  /* Transitions */
  --duration-s: .2s;
  --duration-m: .3s;
  --duration-l: .6s;
  --btn-transition: background var(--duration-s) ease,
                    border-color var(--duration-s) ease,
                    box-shadow var(--duration-s) ease,
                    color var(--duration-s) ease;

  /* Shadows */
  --shadow-sm: 0 2px 5px var(--black-10);
  --shadow-md: 0 4px 12px var(--black-08);
  --shadow-lg: 0 6px 15px var(--black-15);
  --shadow-xl: 0 8px 32px rgba(31 38 135 / 0.15);
  --shadow-chat-input: 0 -5px 15px var(--black-05);
  --shadow-chat-bubble: 0 3px 8px var(--black-06);
  --shadow-user-bubble: 0 4px 10px rgba(1 87 155 / 0.15);
  --shadow-landing-hero: 0 8px 32px rgba(31 38 135 / 0.10);
  --shadow-gateway-content: 0 10px 25px var(--black-08);
  --shadow-primary-btn-hover: 0 4px 12px rgba(0 121 107 / 0.2);

  /* Icons */
  --navbar-toggler-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255,255,255,.8%29' stroke-linecap='round' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
  --select-arrow-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3csvg%3e");
  --input-select-arrow-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2334495e' stroke-linecap='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3csvg%3e");

  /* Transparency Helpers */
  --white-05: rgba(255 255 255 / 0.05);
  --white-10: rgba(255 255 255 / 0.10);
  --white-15: rgba(255 255 255 / 0.15);
  --white-20: rgba(255 255 255 / 0.20);
  --white-25: rgba(255 255 255 / 0.25);
  --white-30: rgba(255 255 255 / 0.30);
  --white-40: rgba(255 255 255 / 0.40);
  --white-50: rgba(255 255 255 / 0.50);
  --white-60: rgba(255 255 255 / 0.60);
  --white-70: rgba(255 255 255 / 0.70);
  --white-80: rgba(255 255 255 / 0.80);
  --white-90: rgba(255 255 255 / 0.90);

  --black-05: rgba(0 0 0 / 0.05);
  --black-06: rgba(0 0 0 / 0.06);
  --black-08: rgba(0 0 0 / 0.08);
  --black-10: rgba(0 0 0 / 0.10);
  --black-15: rgba(0 0 0 / 0.15);
  --black-20: rgba(0 0 0 / 0.20);
  --black-25: rgba(0 0 0 / 0.25);
  --black-30: rgba(0 0 0 / 0.30);
  --black-40: rgba(0 0 0 / 0.40);

/* Glassmorphism */
--glass-bg-light: rgba(255 255 255 / 0.25);
--glass-bg-dark: rgba(15 23 30 / 0.4);
--glass-border-light: rgba(255 255 255 / 0.18);
--glass-border-dark: rgba(255 255 255 / 0.125);
--backdrop-blur: blur(12px) saturate(150%);
--shadow-glass-base: 0 8px 32px rgba(31 38 135 / 0.37);
--shadow-glass-hover: 0 16px 64px rgba(31 38 135 / 0.45);
--shadow-brand-accent: 0 4px 24px rgba(137 168 178 / 0.3);
--shadow-brand-glow: 0 0 20px rgba(137 168 178 / 0.15);
}

/* Dark Theme Variables */
[data-bs-theme="dark"] {
  /* Brand Colors */
  --primary-color: #2b7a78;
  --primary-color-rgb: 43 122 120;
  --accent-color: #419392;
  --accent-color-rgb: 65 147 146;
  --accent-color-hover: #1f5e5d;
  --accent-color-hover-rgb: 31 94 93;

  /* Layout */
  --background-light: #20303a;
  --background-light-alt: #2d414f;
  --border-color-light: #364652;
  --border-color-medium: #4d6473;
  --border-color-dark: #8fa1ad;
  --gradient-background: linear-gradient(135deg, #20303a 0%, #2d414f 100%);

  /* Typography */
  --text-color-dark: #f2f7f9;
  --text-color-dark-muted: #afc3cd;
  --text-color-light: #f2f7f9;
  --text-color-light-secondary: #afc3cd;
  --text-color-light-muted: #8fa1ad;

  /* UI Elements */
  --toast-bg: #4a5568;
  --toast-text: var(--text-color-light);
  --focus-shadow-color: rgba(43 122 120 / 0.25);
  --border-color-modal: rgba(79 96 110 / 0.30);

  /* Glassmorphism */
  --glass-bg-light: rgba(255 255 255 / 0.08);
  --glass-bg-dark: rgba(15 23 30 / 0.6);
  --glass-border-light: rgba(255 255 255 / 0.05);
  --glass-border-dark: rgba(255 255 255 / 0.08);
  --shadow-glass-base: 0 8px 32px rgba(0 0 0 / 0.4);
  --shadow-glass-hover: 0 16px 64px rgba(0 0 0 / 0.55);
  --shadow-brand-accent: 0 4px 24px rgba(43 122 120 / 0.3);
  --shadow-brand-glow: 0 0 20px rgba(43 122 120 / 0.15);

  /* Icons */
  --input-select-arrow-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3csvg%3e");
}

/* ---------------------------------------------------------
   3 ▸ Global Reset & Layout
   --------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  height: 100vh;
  margin: 0;
  padding: 0;
  font-family: var(--font-primary);
  color: var(--text-color-dark);
  background-color: var(--background-light);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-headings);
  font-weight: 500;
}

.container-fluid,
.row {
  height: 100%;
  margin: 0;
  padding: 0;
}

/* ---------------------------------------------------------
   4 ▸ Mobile Header (Bootstrap overrides)
   --------------------------------------------------------- */
.navbar.d-lg-none {
  color: var(--text-color-light);
  background: var(--gradient-background);
  box-shadow: var(--shadow-sm);
}

.navbar.d-lg-none .navbar-brand {
  font-weight: 600;
  color: var(--text-color-light);
}

.navbar.d-lg-none .navbar-toggler {
  border-color: var(--white-20);
}

.navbar.d-lg-none .navbar-toggler-icon {
  background-image: var(--navbar-toggler-icon);
}

/* ---------------------------------------------------------
   5 ▸ Sidebar & Off‑canvas
   --------------------------------------------------------- */
.sidebar,
.offcanvas.offcanvas-start {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 20px;
  overflow-y: auto;
  color: var(--text-color-light);
  background: var(--gradient-background);
  box-shadow: var(--shadow-md);
}

.offcanvas.offcanvas-start .offcanvas-header {
  border-bottom: 1px solid var(--white-20);
}

.offcanvas.offcanvas-start .offcanvas-body.sidebar {
  padding: 20px;
}

/* Sidebar header */
.sidebar-header {
  padding-bottom: 15px;
  margin-bottom: 25px;
  border-bottom: 1px solid var(--border-color-dark);
  opacity: 0;
  animation: headerFadeIn var(--duration-l) ease-out forwards;
}

.sidebar-header h3 {
  margin-bottom: 8px;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-color-dark);
}

.sidebar-header h3 i {
  font-size: 1.2rem;
  color: var(--primary-color);
}

.sidebar-header .text-muted {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: .5px;
  color: var(--text-color-light-secondary);
}

.sidebar-header .auth-status-container {
  padding: 8px 12px;
  margin-top: 15px;
  border-radius: 6px;
  background-color: var(--background-dark-accent);
}

.sidebar-header .auth-status-container .small {
  color: var(--text-color-light-secondary);
}

/* ---------------------------------------------------------
   6 ▸ FAQ Section
   --------------------------------------------------------- */
.faq-section {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  view-transition-name: faq-section;
}

.faq-section h4 {
  display: flex;
  align-items: center;
  padding-top: 15px;
  margin: 20px 0 15px;
  border-top: 1px solid var(--white-15);
  font-size: 1.1rem;
  color: var(--text-color-dark);
}

.faq-section h4 i {
  margin-right: 8px;
  font-size: 1rem;
  color: var(--text-color-dark);
}

.faq-section .nav-pills {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faq-section .nav-link.faq-button {
  padding: 8px 12px;
  margin-bottom: 5px;
  border: 1px solid var(--border-color-medium);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  color: var(--text-color-dark);
  text-align: left;
  background-color: var(--background-light);
  opacity: 0;
  transform-style: preserve-3d;
  animation: faqItemFadeIn linear forwards;
  animation-timeline: faq-scroll-timeline;
  animation-range: entry 20% cover 50%;
  transition: var(--btn-transition), transform var(--duration-s) ease;
  will-change: transform, opacity, background-color;
}

.faq-section .nav-link.faq-button:hover,
.faq-section .nav-link.faq-button:focus {
  background-color: var(--background-light-alt);
  box-shadow: var(--shadow-lg);
  transform: perspective(1000px) rotateX(5deg) rotateY(-5deg) scale(1.05);
  cursor: pointer;
}

.faq-section .nav-link.faq-button.active {
  border: 1px solid var(--accent-color);
  font-weight: 600;
  color: var(--text-color-dark);
  background-color: var(--background-light);
  box-shadow: 0 0 0 3px var(--accent-color), var(--shadow-lg);
  transform: none;
}

/* Override for disabled FAQ buttons.
  Using :where() gives this selector zero specificity, making it 
  easy to override later if needed, without specificity wars.
*/
.faq-section .nav-link:where(.faq-button:disabled) {
  color: var(--text-color-dark);
  background-color: var(--background-light-alt);
  opacity: 1;
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}

/* ---------------------------------------------------------
   7 ▸ Styled Selects
   --------------------------------------------------------- */
.styled-select-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-color-light-secondary);
}

.styled-select {
  padding: 10px 15px;
  border: 1px solid var(--white-25);
  border-radius: var(--radius-sm);
  font-family: var(--font-primary);
  color: var(--text-color-light);
  background-color: var(--white-15);
  background-image: var(--select-arrow-icon);
  background-repeat: no-repeat;
  background-position: right .75rem center;
  background-size: 16px 12px;
  appearance: none;
  transition: var(--btn-transition);
}

.styled-select:hover {
  border-color: var(--white-40);
  background-color: var(--white-25);
}

.styled-select:focus {
  outline: none;
  border-color: var(--text-color-light);
  background-color: var(--white-25);
  box-shadow: 0 0 0 .2rem var(--white-30);
}

.styled-select option {
  color: var(--text-color-dark);
  background-color: var(--background-light);
}

.sidebar .category-selector {
  padding-top: 20px;
  margin-bottom: 25px;
  border-top: 1px solid var(--white-15);
}

/* ---------------------------------------------------------
   8 ▸ Chat Area
   --------------------------------------------------------- */
.chat-area {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 0;
  overflow: hidden;
  background-color: var(--background-light);
}

.chat-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 20px;
  overflow: hidden;
}

.messages {
  flex: 1;
  margin-bottom: 20px;
  padding-right: 10px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.message {
  max-width: 85%;
  margin-bottom: 15px;
  opacity: 0;
  animation: fadeIn var(--duration-m) ease-out forwards;
  transition: transform var(--duration-m);
}

.user-message {
  margin-left: auto;
}

.chatbot-message {
  margin-right: auto;
}

.message-bubble {
  position: relative;
  max-width: 100%;
  padding: 15px;
  border-radius: var(--radius-msg);
  word-wrap: break-word;
  box-shadow: var(--shadow-chat-bubble);
  transition: box-shadow var(--duration-m);
}

.user-message .message-bubble {
  border-bottom-right-radius: var(--radius-xs);
  color: var(--text-color-dark);
  background-color: var(--primary-color);
  box-shadow: var(--shadow-user-bubble);
}

.chatbot-message .message-bubble {
  border: 2px solid var(--border-color-dark);
  border-bottom-left-radius: var(--radius-xs);
  color: var(--text-color-dark);
  background: linear-gradient(135deg, var(--background-light) 0%, var(--background-light-alt) 100%);
  box-shadow: 0 8px 24px var(--black-25);
}

/* Dark Theme Component Overrides */
[data-bs-theme="dark"] {
  /* Base elements */
  body {
    color: var(--text-color-light);
  }

  /* Layout */
  .landing-page {
    background: var(--gradient-background);
  }

  .landing-hero,
  .gateway-content {
    border-color: var(--border-color-dark);
    color: var(--text-color-light);
  }

  .sidebar,
  .offcanvas.offcanvas-start,
  .sidebar-header {
    color: var(--text-color-light);
  }

  /* Chat components */
  .chatbot-message .message-bubble,
  .user-message .message-bubble {
    color: var(--text-color-light);
  }

  .chatbot-message .message-bubble {
    border-color: var(--border-color-dark);
  }

  /* FAQ components */
  .faq-section .nav-link.faq-button {
    color: var(--text-color-light);
  }

  .faq-section h4 {
    color: var(--text-color-light);
  }

  /* Input areas */
  .input-area {
    border-color: var(--border-color-medium);
    box-shadow: var(--shadow-chat-input);
  }

  #query-input {
    border-color: var(--border-color-medium);
    color: var(--text-color-light);
  }

  .input-area .category-selector label {
    color: var(--text-color-light);
  }

  .input-area .category-selector .form-select,
  .timestamp {
    color: var(--text-color-light-muted);
  }

  .user-message .timestamp {
    color: var(--white-70);
  }
}

.message-code {
  margin: 5px 0;
  padding: 10px;
  overflow-x: auto;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  background-color: var(--black-05);
}

/* Knowledge Cutoff Notice Styling */
.knowledge-cutoff-notice {
  padding: 12px 16px;
  margin: 15px 0;
  border-left: 4px solid var(--primary-color);
  border-radius: var(--radius-xs);
  font-size: .88rem;
  line-height: 1.6;
  color: var(--text-color-dark-muted);
  background-color: rgba(var(--primary-color-rgb) / 0.08);
  box-shadow: 0 2px 6px var(--black-05);
  transition: background-color var(--duration-s) ease, box-shadow var(--duration-s) ease;
}

.knowledge-cutoff-notice:hover {
  background-color: rgba(var(--primary-color-rgb) / 0.12);
  box-shadow: 0 3px 10px var(--black-08);
}

.knowledge-cutoff-notice i {
  color: var(--primary-color);
  font-size: .95rem;
  vertical-align: middle;
}

.knowledge-cutoff-notice em {
  font-style: normal;
  font-weight: 500;
}

/* Dark theme adjustments for knowledge cutoff notice */
[data-bs-theme="dark"] .knowledge-cutoff-notice {
  border-left-color: var(--accent-color);
  color: var(--text-color-light-secondary);
  background-color: rgba(var(--accent-color-rgb) / 0.12);
}

[data-bs-theme="dark"] .knowledge-cutoff-notice:hover {
  background-color: rgba(var(--accent-color-rgb) / 0.18);
}

[data-bs-theme="dark"] .knowledge-cutoff-notice i {
  color: var(--accent-color);
}

/* Landing Page Knowledge Badge Styling */
.landing-knowledge-badge {
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  font-size: .8rem;
  font-weight: 500;
  color: var(--primary-color);
  background-color: rgba(var(--primary-color-rgb) / 0.1);
  border: 1px solid rgba(var(--primary-color-rgb) / 0.2);
  transition: all var(--duration-s) ease;
}

.landing-knowledge-badge i {
  color: var(--primary-color);
  font-size: .85rem;
}

.landing-knowledge-badge:hover {
  background-color: rgba(var(--primary-color-rgb) / 0.15);
  border-color: rgba(var(--primary-color-rgb) / 0.3);
}

/* Dark theme adjustments for landing knowledge badge */
[data-bs-theme="dark"] .landing-knowledge-badge {
  color: var(--accent-color);
  background-color: rgba(var(--accent-color-rgb) / 0.15);
  border-color: rgba(var(--accent-color-rgb) / 0.25);
}

[data-bs-theme="dark"] .landing-knowledge-badge i {
  color: var(--accent-color);
}

[data-bs-theme="dark"] .landing-knowledge-badge:hover {
  background-color: rgba(var(--accent-color-rgb) / 0.2);
  border-color: rgba(var(--accent-color-rgb) / 0.35);
}

.avatar img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
}

.timestamp {
  margin-top: 5px;
  font-size: .75rem;
  color: var(--text-color-dark-muted);
  text-align: right;
}

.user-message .timestamp {
  color: var(--white-70);
}

/* ---------------------------------------------------------
   9 ▸ Input Area
   --------------------------------------------------------- */
.input-area {
  position: sticky;
  bottom: 0;
  z-index: 10;
  padding: 20px;
  border-top: 1px solid var(--border-color-light);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  background: linear-gradient(to bottom, var(--background-light), var(--background-light-alt));
  box-shadow: var(--shadow-chat-input);
  transition: box-shadow var(--duration-m);
}

.input-area .input-group {
  box-shadow: 0 4px 10px var(--black-07);
  transition: box-shadow var(--duration-m);
}

#query-input {
  padding: 12px 20px;
  border: 1px solid var(--border-color-medium);
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  font-size: .95rem;
  color: var(--text-color-dark);
  background-color: var(--background-light);
  transition: var(--btn-transition);
}

#query-input:hover {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 .1rem var(--focus-shadow-color);
}

#query-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 .2rem var(--focus-shadow-color);
}

#send-button {
  padding: 12px 24px;
  border: none;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-weight: 500;
  color: var(--text-color-dark);
  background-color: var(--primary-color);
  transition: var(--btn-transition), transform var(--duration-s) ease;
  will-change: transform, box-shadow;
}

#send-button:hover:not(:disabled) {
  background-color: var(--accent-color);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px) scale(1.03);
}

.input-area .category-selector {
  margin-bottom: 15px;
}

.input-area .category-selector label {
  display: block;
  margin-bottom: 5px;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-color-dark);
}

.input-area .category-selector .form-select {
  padding: 6px 10px;
  border: 1px solid var(--border-color-medium);
  border-radius: var(--radius-xs);
  font-size: .9rem;
  color: var(--text-color-dark);
  background: var(--background-light) var(--input-select-arrow-icon) no-repeat right .75rem center / 16px 12px;
  appearance: none;
}

.input-area .category-selector .form-select:hover {
  border-color: var(--primary-color);
}

.input-area .category-selector .form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 .2rem var(--focus-shadow-color);
}

/* ---------------------------------------------------------
   10 ▸ Auth Modal
   --------------------------------------------------------- */
#authModal .modal-dialog {
  transition: transform var(--duration-m);
}

#authModal .modal-content {
  overflow: hidden;
  border: 1px solid var(--border-color-modal);
  border-radius: var(--radius-md);
  background: var(--gradient-background);
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
}

#authModal .modal-header {
  border-bottom: none;
  color: var(--text-color-light);
  background-color: var(--primary-color);
}

#authModal .modal-header .btn-close-white {
  filter: brightness(1.2);
}

#authModal .modal-body {
  padding: 0;
}

#authModal .nav-tabs {
  border-bottom: none;
}

#authModal .nav-tabs .nav-link {
  margin-bottom: -1px;
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  color: var(--white-80);
  background-color: transparent;
  transition: var(--btn-transition);
}

#authModal .nav-tabs .nav-link:hover {
  border-bottom-color: var(--white-60);
  color: var(--text-color-light);
}

#authModal .nav-tabs .nav-link.active {
  border-bottom-color: var(--text-color-light);
  font-weight: 600;
  color: var(--text-color-light);
}

#authModal .tab-content {
  padding: 1.5rem;
}

#authModal .tab-pane:not(.active) {
  position: absolute;
  width: calc(100% - 3rem);
  opacity: 0;
  pointer-events: none;
}

#authModal .form-floating > .form-control {
  padding: 1.625rem .75rem .625rem;
  border: 1px solid var(--border-color-medium);
  color: var(--text-color-dark);
  background-color: var(--background-light);
}

#authModal .form-floating > .form-control::placeholder {
  color: var(--text-color-dark-muted);
  opacity: 1;
}

#authModal .form-floating > label {
  padding: .8rem .75rem;
  font-weight: 600;
  color: var(--text-color-dark);
  background: none;
  transition: opacity var(--duration-s), transform var(--duration-s), color var(--duration-s);
}

#authModal .form-floating > .form-control:is(:focus, :not(:placeholder-shown))~label {
  font-weight: 500;
  color: var(--text-color-dark-muted);
  transform: scale(.85) translateY(-.5rem) translateX(.15rem);
}

#authModal .form-control:focus {
  border-color: var(--primary-color);
  color: var(--text-color-dark);
  background-color: var(--background-light-alt);
  box-shadow: 0 0 0 .25rem var(--focus-shadow-color);
}

#authModal .invalid-feedback {
  display: inline-block;
  padding: 2px 5px;
  margin-top: 4px;
  border-radius: 3px;
  font-weight: 600;
  color: var(--color-warning);
  background-color: var(--black-40);
}

#authModal .btn-primary {
  border-color: var(--primary-color);
  color: var(--text-color-dark);
  background-color: var(--primary-color);
  transition: var(--btn-transition);
}

#authModal .btn-primary:hover {
  border-color: var(--accent-color-hover);
  background-color: var(--accent-color-hover);
}

/* ---------------------------------------------------------
   11 ▸ Skeleton Loader
   --------------------------------------------------------- */
.skeleton {
  border-radius: var(--radius-xs);
  background: linear-gradient(90deg, var(--background-light) 25%, var(--background-light-alt) 50%, var(--background-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
}

.skeleton-message-container {
  display: flex;
  align-items: flex-start;
  width: 80%;
  padding: 15px;
  margin-bottom: 15px;
  border: 1px solid var(--border-color-light);
  border-radius: var(--radius-msg);
  border-bottom-left-radius: var(--radius-xs);
  background-color: var(--background-light);
  box-shadow: var(--shadow-chat-bubble);
}

.skeleton-avatar {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  margin-right: 10px;
  border-radius: 50%;
}

.skeleton-content {
  flex: 1;
}

.skeleton-line {
  width: 100%;
  height: 14px;
  margin-bottom: 10px;
}

.skeleton-line:last-child {
  margin-bottom: 0;
}

.skeleton-line.short {
  width: 60%;
}

.skeleton-line.medium {
  width: 90%;
}

/* ---------------------------------------------------------
   12 ▸ Landing Page
   --------------------------------------------------------- */
.landing-page {
  color: var(--text-color-dark);
  background: var(--gradient-background);
}

.landing-hero,
.gateway-content {
  padding: 3rem 2rem;
  border: 1px solid var(--border-color-light);
  border-radius: 1rem;
  text-align: center;
  background: var(--background-light);
}

.landing-hero {
  box-shadow: var(--shadow-landing-hero);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  position: relative; /* Needed for absolute positioning of overlay */
  overflow: hidden; /* Ensures overlay doesn't spill out */
}

.hero-visual {
  position: relative;
  width: 100%;
  max-width: 800px; /* Adjust as needed */
  margin: 0 auto 1.5rem; /* Center and add bottom margin */
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.hero-visual img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 400px; /* Maintain max height */
  object-fit: cover; /* Ensure image covers the area */
  border-radius: var(--radius-md);
  transition: transform var(--duration-m) ease-out;
}

.hero-visual::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.4) 100%); /* Darker gradient overlay */
  border-radius: var(--radius-md);
  z-index: 1;
  opacity: 1;
  transition: opacity var(--duration-m) ease;
}

.hero-visual:hover img {
  transform: scale(1.05); /* Subtle zoom on hover */
}

.hero-visual:hover::before {
  opacity: 0.8; /* Slightly more opaque on hover */
}

.gateway-content {
  box-shadow: var(--shadow-gateway-content);
}

.landing-header-utility {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 15px;
}

.utility-icon-link {
  font-size: 1.5rem;
  color: var(--text-color-dark);
  transition: color var(--duration-s) ease, transform var(--duration-s) ease;
}

.utility-icon-link:hover {
  color: var(--primary-color);
  transform: scale(1.1);
}

.hero-title-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
}

.hero-icon {
  font-size: 3rem;
  line-height: 1;
  color: var(--primary-color);
}

.landing-hero h1,
.gateway-content h1 {
  font-weight: 700;
  color: var(--text-color-dark);
}

.landing-hero h1 {
  margin: 0 0 0.5rem; /* Add some bottom margin */
  line-height: 1.2;
  font-size: 3.2rem; /* Larger font size for impact */
  text-shadow: 1px 1px 2px var(--black-10); /* Subtle text shadow for readability */
}

.landing-hero p.lead {
  font-size: 1.3rem; /* Slightly larger lead text */
  margin-bottom: 2rem; /* More space below subtitle */
  color: var(--text-color-dark-muted); /* Ensure good contrast */
  text-shadow: 0.5px 0.5px 1px var(--white-10); /* Subtle text shadow */
}

.gateway-image {
  color: var(--primary-color);
  opacity: .9;
  transition: transform var(--duration-m) ease;
}

.gateway-image:hover {
  transform: scale(1.05);
}

.unified-button {
  display: inline-block;
  padding: 1rem 2rem;
  border: 1px solid var(--primary-color);
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-color-dark);
  text-decoration: none;
  background-color: var(--primary-color);
  transition: var(--btn-transition), transform var(--duration-m) ease;
}

.unified-button:hover {
  border-color: var(--accent-color-hover);
  background-color: var(--accent-color-hover);
  box-shadow: var(--shadow-primary-btn-hover), 0 0 15px var(--primary-color); /* Add a glow effect */
  transform: translateY(-3px) scale(1.02); /* More pronounced lift and slight scale */
}

.unified-button:active {
  transform: translateY(-1px) scale(0.98); /* Press down effect */
  box-shadow: var(--shadow-sm);
}

/* Why Use Our Platform? Section */
.why-use-platform-section .feature-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--glass-border-light);
  border-radius: var(--radius-md);
  background-color: var(--glass-bg-light);
  box-shadow: var(--shadow-glass-base);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  transform: translateZ(0); /* Hardware acceleration */
  will-change: transform, box-shadow, background-color, border-color;
  transition: transform var(--duration-m) ease-out,
              box-shadow var(--duration-m) ease-out,
              background-color var(--duration-m) ease-out,
              border-color var(--duration-m) ease-out;
}

.why-use-platform-section .feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: var(--radius-md);
  background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 70%);
  opacity: 0;
  transition: opacity var(--duration-m) ease-out;
  pointer-events: none;
}

.why-use-platform-section .feature-card:hover {
  transform: scale(1.05) rotateZ(1deg);
  box-shadow: var(--shadow-glass-hover), var(--shadow-brand-accent);
  border-color: var(--primary-color);
  background-color: var(--glass-bg-light); /* Ensure consistent glass effect on hover */
}

.why-use-platform-section .feature-card:hover::before {
  opacity: 1;
}

.why-use-platform-section .feature-card:active {
  transform: scale(1.02);
  box-shadow: var(--shadow-glass-base);
}

.why-use-platform-section .feature-icon-wrapper {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 70px;
  height: 70px;
  margin-bottom: 1rem;
  border: 1px solid var(--glass-border-light);
  border-radius: 50%;
  background-color: var(--glass-bg-light);
  box-shadow: var(--shadow-glass-base);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  transform: translateZ(0); /* Hardware acceleration */
  will-change: transform, box-shadow, background-color, border-color;
  transition: transform var(--duration-m) ease-out,
              box-shadow var(--duration-m) ease-out,
              background-color var(--duration-m) ease-out,
              border-color var(--duration-m) ease-out;
}

.why-use-platform-section .feature-card:hover .feature-icon-wrapper {
  transform: scale(1.1) rotateZ(-2deg);
  box-shadow: var(--shadow-glass-hover), var(--shadow-brand-glow);
  border-color: var(--accent-color);
  background-color: var(--glass-bg-light); /* Ensure consistent glass effect on hover */
}

.why-use-platform-section .feature-icon {
  font-size: 2.5rem;
  color: var(--primary-color);
  transition: color var(--duration-m) ease-out;
}

.why-use-platform-section .feature-card:hover .feature-icon {
  color: var(--accent-color);
}

.why-use-platform-section h3 {
  color: var(--text-color-dark);
  transition: color var(--duration-m) ease-out;
}

.why-use-platform-section .feature-card:hover h3 {
  color: var(--primary-color);
}

.why-use-platform-section p {
  color: var(--text-color-dark-muted);
  transition: color var(--duration-m) ease-out;
}

.why-use-platform-section .feature-card:hover p {
  color: var(--text-color-dark);
}

/* Dark theme specific adjustments for feature cards */
[data-bs-theme="dark"] .landing-hero h1,
[data-bs-theme="dark"] .landing-hero p.lead {
  color: var(--text-color-light); /* Ensure text is visible in dark mode */
  text-shadow: 1px 1px 2px var(--black-40); /* Darker shadow for dark mode */
}

[data-bs-theme="dark"] .hero-visual::before {
  background: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.6) 100%); /* Darker overlay for dark mode */
}

[data-bs-theme="dark"] .unified-button {
  color: var(--text-color-light);
  border-color: var(--primary-color);
  background-color: var(--primary-color);
}

[data-bs-theme="dark"] .unified-button:hover {
  border-color: var(--accent-color-hover);
  background-color: var(--accent-color-hover);
  box-shadow: var(--shadow-primary-btn-hover), 0 0 15px var(--primary-color);
}

[data-bs-theme="dark"] .why-use-platform-section .feature-card {
  border: 1px solid var(--glass-border-dark);
  background-color: var(--glass-bg-dark);
  box-shadow: var(--shadow-glass-base);
}

[data-bs-theme="dark"] .why-use-platform-section .feature-card:hover {
  border-color: var(--primary-color);
  background-color: var(--glass-bg-dark);
}

[data-bs-theme="dark"] .why-use-platform-section .feature-icon-wrapper {
  border: 1px solid var(--glass-border-dark);
  background-color: var(--glass-bg-dark);
}

[data-bs-theme="dark"] .why-use-platform-section .feature-card:hover .feature-icon-wrapper {
  border-color: var(--accent-color);
  background-color: var(--glass-bg-dark);
}

/* Responsive Adaptations */
@media (max-width: 768px) { /* Mobile */
  .hero-visual {
    max-width: 100%; /* Full width on mobile */
  }

  .landing-hero h1 {
    font-size: 2.5rem; /* Smaller font size for mobile */
  }

  .landing-hero p.lead {
    font-size: 1.1rem; /* Smaller lead text for mobile */
  }

  .unified-button {
    padding: 0.8rem 1.5rem; /* Smaller padding for mobile button */
    font-size: 1rem;
  }

  .why-use-platform-section .feature-card,
  .why-use-platform-section .feature-icon-wrapper {
    backdrop-filter: var(--backdrop-blur); /* Using custom property */
    -webkit-backdrop-filter: var(--backdrop-blur); /* Using custom property */
    box-shadow: 0 4px 16px rgba(31, 38, 135, 0.2);
  }

  .why-use-platform-section .feature-card:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.3);
  }

  .why-use-platform-section .feature-card:hover .feature-icon-wrapper {
    transform: scale(1.05);
  }
}

@media (min-width: 769px) and (max-width: 1024px) { /* Tablet */
  .landing-hero h1 {
    font-size: 2.8rem; /* Adjust font size for tablet */
  }

  .landing-hero p.lead {
    font-size: 1.2rem; /* Adjust lead text for tablet */
  }

  .why-use-platform-section .feature-card,
  .why-use-platform-section .feature-icon-wrapper {
    backdrop-filter: var(--backdrop-blur); /* Using custom property */
    -webkit-backdrop-filter: var(--backdrop-blur); /* Using custom property */
    box-shadow: 0 6px 24px rgba(31, 38, 135, 0.3);
  }

  .why-use-platform-section .feature-card:hover {
    transform: scale(1.03) rotateZ(0.5deg);
    box-shadow: 0 12px 48px rgba(31, 38, 135, 0.4);
  }

  .why-use-platform-section .feature-card:hover .feature-icon-wrapper {
    transform: scale(1.08) rotateZ(-1deg);
  }
}

/* Accessibility Enhancements */
@media (prefers-contrast: high) {
  .why-use-platform-section .feature-card {
    border: 2px solid var(--primary-color);
    background-color: var(--background-light);
    box-shadow: 0 0 0 3px var(--primary-color);
  }

  [data-bs-theme="dark"] .why-use-platform-section .feature-card {
    border: 2px solid var(--primary-color);
    background-color: var(--background-dark-accent);
    box-shadow: 0 0 0 3px var(--primary-color);
  }

  .why-use-platform-section .feature-card:hover {
    box-shadow: 0 0 0 4px var(--accent-color);
  }

  .why-use-platform-section .feature-icon-wrapper {
    border: 2px solid var(--primary-color);
    background-color: var(--background-light-alt);
    box-shadow: 0 0 0 2px var(--primary-color);
  }

  [data-bs-theme="dark"] .why-use-platform-section .feature-icon-wrapper {
    border: 2px solid var(--primary-color);
    background-color: var(--background-dark-accent-strong);
    box-shadow: 0 0 0 2px var(--primary-color);
  }

  .why-use-platform-section .feature-card:hover .feature-icon-wrapper {
    box-shadow: 0 0 0 3px var(--accent-color);
  }
}

@media (prefers-reduced-motion: reduce) {
  .why-use-platform-section .feature-card,
  .why-use-platform-section .feature-card::before,
  .why-use-platform-section .feature-icon-wrapper,
  .why-use-platform-section .feature-icon,
  .why-use-platform-section h3,
  .why-use-platform-section p {
    transition: none !important;
    animation: none !important;
    will-change: auto !important;
  }

  /* Keep hover transforms disabled */
  .why-use-platform-section .feature-card:hover {
    transform: none;
    box-shadow: var(--shadow-glass-base);
  }

  .why-use-platform-section .feature-card:hover .feature-icon-wrapper {
    transform: none;
    box-shadow: var(--shadow-glass-base);
  }

  /* Allow click feedback even in reduced motion mode */
  .why-use-platform-section .feature-card:active {
    transform: scale(0.98) !important;
    box-shadow: var(--shadow-glass-base);
    transition: transform 0.1s ease !important;
  }
}

/* ---------------------------------------------------------
   13 ▸ Animations & Experimental
   --------------------------------------------------------- */
@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

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

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

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

@scroll-timeline faq-scroll-timeline {
  source: auto;
  orientation: block;
}

/* -----------------------------------------------------------------
   Theme Toggle & Utilities
   ----------------------------------------------------------------- */
.theme-toggle-btn,
#simple-theme-toggle,
#sidebar-theme-toggle,
#offcanvas-theme-toggle {
  cursor: pointer;
  border: 2px solid transparent;
  outline: none;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.9) !important;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
}

.theme-toggle-btn:hover,
#simple-theme-toggle:hover,
#sidebar-theme-toggle:hover,
#offcanvas-theme-toggle:hover {
  background: rgba(255, 255, 255, 0.95) !important;
  transform: scale(1.05);
}

.theme-toggle-btn .bi,
#simple-theme-toggle .bi,
#sidebar-theme-toggle .bi,
#offcanvas-theme-toggle .bi {
  font-size: 16px;
  color: #2c3e50;
}

[data-bs-theme="dark"] .theme-toggle-btn,
[data-bs-theme="dark"] #simple-theme-toggle,
[data-bs-theme="dark"] #sidebar-theme-toggle,
[data-bs-theme="dark"] #offcanvas-theme-toggle {
  background: rgba(31, 41, 55, 0.8) !important;
  border-color: rgba(255, 255, 255, 0.2);
}

[data-bs-theme="dark"] .theme-toggle-btn:hover,
[data-bs-theme="dark"] #simple-theme-toggle:hover,
[data-bs-theme="dark"] #sidebar-theme-toggle:hover,
[data-bs-theme="dark"] #offcanvas-theme-toggle:hover {
  background: rgba(31, 41, 55, 0.9) !important;
}

[data-bs-theme="dark"] .theme-toggle-btn .bi,
[data-bs-theme="dark"] #simple-theme-toggle .bi,
[data-bs-theme="dark"] #sidebar-theme-toggle .bi,
[data-bs-theme="dark"] #offcanvas-theme-toggle .bi {
  color: #f39c12;
}

/* Responsive adjustments for theme toggles */
@media (max-width: 768px) {
  .theme-toggle-btn,
  #simple-theme-toggle,
  #sidebar-theme-toggle,
  #offcanvas-theme-toggle {
    min-width: 28px;
    min-height: 28px;
  }

  .theme-toggle-btn .bi,
  #simple-theme-toggle .bi,
  #sidebar-theme-toggle .bi,
  #offcanvas-theme-toggle .bi {
    font-size: 14px;
  }
}

/* ---------------------------------------------------------
   15 ▸ Toast Notification
   --------------------------------------------------------- */
.toast-notification {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1056;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  color: var(--toast-text);
  background-color: var(--toast-bg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: opacity var(--duration-m) ease, transform var(--duration-m) ease, visibility 0s var(--duration-m);
  /* Accessibility: Announce toast messages to screen readers */
  aria-live: polite;
  role: status;
}

.toast-notification:not(.hidden) {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition-delay: 0s;
}

.toast-notification.hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  pointer-events: none;
}

.toast-notification.success {
  color: var(--white-95);
  background-color: var(--color-success);
}

.toast-notification.error {
  color: var(--white-95);
  background-color: var(--color-error);
}

/* ---------------------------------------------------------
   16 ▸ Enhanced Suggested Question Buttons
   --------------------------------------------------------- */
.suggested-question-enhanced {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 12px 20px;
  margin: 0 8px 8px 0;
  border: 2px solid var(--primary-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-primary);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.3px;
  color: var(--text-color-dark);
  text-decoration: none;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
  box-shadow: var(--shadow-md);
  transition: var(--btn-transition), transform var(--duration-s) ease;
  will-change: transform, box-shadow;
  cursor: pointer;
}

.suggested-question-enhanced:hover {
  border-color: var(--accent-color-hover);
  color: var(--text-color-dark);
  background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-color-hover) 100%);
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px) scale(1.02);
}

.suggested-question-enhanced:focus {
  outline: none;
  box-shadow: var(--shadow-lg), 0 0 0 3px var(--focus-shadow-color);
}

.suggested-question-enhanced:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.suggested-question-enhanced:active {
  transform: translateY(-1px) scale(0.98);
  transition-duration: 0.1s;
}

.suggested-question-icon {
  margin-right: 8px;
  font-size: 0.9em;
  transition: transform var(--duration-s) ease;
}

.suggested-question-enhanced:hover .suggested-question-icon {
  transform: rotate(15deg) scale(1.1);
}

/* Pulse animation for enhanced visual appeal */
@keyframes suggestedQuestionPulse {
  0% {
    box-shadow: var(--shadow-md);
  }
  50% {
    box-shadow: var(--shadow-lg), 0 0 0 4px rgba(137, 168, 178, 0.2);
  }
  100% {
    box-shadow: var(--shadow-md);
  }
}

.suggested-question-enhanced.pulse {
  animation: suggestedQuestionPulse 2s ease-in-out infinite;
}

/* Loading state for suggested questions */
.suggested-question-enhanced.loading {
  opacity: 0.7;
  background: linear-gradient(90deg, var(--primary-color) 25%, var(--accent-color) 50%, var(--primary-color) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  pointer-events: none;
}

/* Dark theme specific adjustments */
[data-bs-theme="dark"] .suggested-question-enhanced {
  border-color: var(--primary-color);
  color: var(--text-color-light);
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
}

[data-bs-theme="dark"] .suggested-question-enhanced:hover {
  border-color: var(--accent-color-hover);
  color: var(--text-color-light);
  background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-color-hover) 100%);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .suggested-question-enhanced {
    border-width: 3px;
    font-weight: 600;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .suggested-question-enhanced,
  .suggested-question-icon {
    transition: none;
    animation: none;
  }

  .suggested-question-enhanced:hover {
    transform: none;
  }

  .suggested-question-enhanced:hover .suggested-question-icon {
    transform: none;
  }
}

/* Responsive design for mobile devices */

@media (max-width: 768px) {
  .suggested-question-enhanced {
    padding: 10px 16px;
    margin: 0 6px 6px 0;
    font-size: 0.9rem;
  }

  .suggested-question-enhanced:hover {
    transform: translateY(-2px) scale(1.01);
  }
}

/* ============================================================
   Markdown table styling for chat messages
   Ensures visible borders, spacing and mobile responsiveness
   ============================================================ */
.message-content table,
.message-content thead,
.message-content tbody,
.message-content tr,
.message-content th,
.message-content td {
  border-collapse: collapse;
  border-spacing: 0;
}

.message-content table {
  width: 100%;
  margin: 0.5rem 0;
  table-layout: auto;
  overflow: visible;
}

/* Visible cell borders and padding */
.message-content th,
.message-content td {
  border: 1px solid var(--border-color-medium);
  padding: 0.5rem 0.75rem;
  text-align: left;
  vertical-align: top;
  background: transparent;
  font-size: 0.95rem;
}

/* Header styling for table head */
.message-content thead th {
  background: var(--background-light-alt);
  font-weight: 600;
}

/* Make long tables scroll horizontally on small screens */
.message-content .table-responsive,
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Optional helper class applied by JS post-processing */
.message-table {
  width: 100%;
}

/* Code and pre styling inside messages */
.message-content pre,
.message-content code {
  font-family: var(--font-mono);
  font-size: 0.92rem;
}

/* Dark theme adjustments */
[data-bs-theme="dark"] .message-content th,
[data-bs-theme="dark"] .message-content td {
  border: 1px solid var(--border-color-dark);
}

[data-bs-theme="dark"] .message-content thead th {
  background: rgba(255,255,255,0.03);
}
