/* ─────────────────────────────────────────────────────────────
   Quora Intelligence Hub — Enterprise Modern Design System
   WCAG AA Compliant • Mobile-First • Fluid Typography • Dark Mode
   ───────────────────────────────────────────────────────────── */

/* ──────────────────────────────────────────────
   1. Design Tokens (CSS Custom Properties)
   ────────────────────────────────────────────── */

:root {
  /* 60% Neutral Palette (Light Mode Base) */
  --bg: #f8fafc;              /* Slate 50 Page Background */
  --surface: #ffffff;         /* Pure White Surface */
  --surface-alt: #f1f5f9;     /* Slate 100 Subtle Section */
  --surface-hover: #f8fafc;   /* Slate 50 Hover */
  --card-bg: #ffffff;         /* Card Surface */
  --card-hover: #ffffff;
  
  /* Text Colors (Verified >= 4.5:1 on White/Slate-50) */
  --text: #0f172a;            /* Slate 900 — 16.1:1 Contrast */
  --text-body: #1e293b;       /* Slate 800 — 12.8:1 Contrast */
  --text-muted: #334155;      /* Slate 700 — 9.5:1 Contrast */
  --text-dim: #475569;        /* Slate 600 — 6.8:1 Contrast */

  /* 30% Secondary Palette (Borders & Dividers >= 3:1) */
  --border: #cbd5e1;          /* Slate 300 UI Boundary */
  --border-subtle: #e2e8f0;   /* Slate 200 Card Border */
  --border-hover: #94a3b8;    /* Slate 400 Hover Border */
  --border-focus: #1e3a8a;    /* Accessible Focus Boundary */

  /* 10% Accent Palette (Interactive, Links & CTAs) */
  --primary: #1e3a8a;         /* Deep Navy Primary CTA (10.2:1 contrast) */
  --primary-hover: #172554;   /* Navy 950 */
  --primary-text: #ffffff;    /* Text on Primary */
  --primary-subtle: #eff6ff;  /* Blue 50 */
  --primary-border: #bfdbfe;  /* Blue 200 */

  --accent: #0284c7;          /* Sky Blue Accent */
  --accent-hover: #0369a1;    /* Sky 700 */
  --accent-subtle: #f0f9ff;
  --accent-border: #bae6fd;

  --ring: #2563eb;            /* Focus Ring Indicator */

  /* Semantic Status Tokens (>= 4.5:1 text contrast) */
  --color-success: #047857;   /* Emerald 700 */
  --bg-success: #ecfdf5;      /* Emerald 50 */
  --border-success: #a7f3d0;  /* Emerald 200 */

  --color-warning: #b45309;   /* Amber 700 */
  --bg-warning: #fffbeb;      /* Amber 50 */
  --border-warning: #fde68a;  /* Amber 200 */

  --color-danger: #be123c;    /* Rose 700 */
  --bg-danger: #fff1f2;       /* Rose 50 */
  --border-danger: #fecdd3;   /* Rose 200 */

  --color-purple: #6d28d9;    /* Violet 700 */
  --bg-purple: #f5f3ff;       /* Violet 50 */
  --border-purple: #ddd6fe;   /* Violet 200 */

  --quora-red: #b92b27;

  /* Typography Scale */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Fluid Font Sizes using clamp() */
  --text-xs: clamp(0.75rem, 0.72rem + 0.15vw, 0.825rem);  /* 12-13px */
  --text-sm: clamp(0.85rem, 0.82rem + 0.15vw, 0.925rem);  /* 13-15px */
  --text-base: clamp(0.95rem, 0.92rem + 0.2vw, 1.05rem);  /* 15-17px */
  --text-lg: clamp(1.1rem, 1.05rem + 0.3vw, 1.25rem);     /* 18-20px */
  --text-xl: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);     /* 20-24px */
  --text-2xl: clamp(1.5rem, 1.3rem + 1vw, 2rem);          /* 24-32px */
  --text-3xl: clamp(1.85rem, 1.5rem + 1.8vw, 2.75rem);    /* 30-44px */

  /* Spacing Scale (4, 8, 16, 24, 32, 48, 64px) */
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 1rem;     /* 16px */
  --space-4: 1.5rem;   /* 24px */
  --space-5: 2rem;     /* 32px */
  --space-6: 3rem;     /* 48px */
  --space-7: 4rem;     /* 64px */

  /* Border Radius Scale (4, 8, 12, 16px, Pill) */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 9999px;

  /* Elevation Shadows (2 core levels + modal) */
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-hover: 0 12px 24px -4px rgba(15, 23, 42, 0.12), 0 4px 8px -2px rgba(15, 23, 42, 0.04);
  --shadow-modal: 0 24px 48px -12px rgba(15, 23, 42, 0.22);

  /* Transitions (150-250ms) */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ──────────────────────────────────────────────
   Dark Theme Tokens
   ────────────────────────────────────────────── */

[data-theme="dark"] {
  --bg: #090d16;              /* Very Dark Navy/Black */
  --surface: #0f172a;         /* Slate 900 Surface */
  --surface-alt: #131d31;     /* Elevated Dark Surface */
  --surface-hover: #1e293b;
  --card-bg: #111a2e;
  --card-hover: #16223d;

  --text: #f8fafc;            /* Slate 50 — 15.8:1 Contrast */
  --text-body: #e2e8f0;       /* Slate 200 — 13.5:1 Contrast */
  --text-muted: #cbd5e1;      /* Slate 300 — 10.4:1 Contrast */
  --text-dim: #94a3b8;        /* Slate 400 — 6.5:1 Contrast */

  --border: #223049;          /* Slate 700 Boundary */
  --border-subtle: #19253c;
  --border-hover: #334155;
  --border-focus: #38bdf8;

  --primary: #3b82f6;         /* Bright Blue Primary for Dark Mode */
  --primary-hover: #60a5fa;
  --primary-text: #ffffff;
  --primary-subtle: #172554;
  --primary-border: #1e40af;

  --accent: #38bdf8;          /* Bright Sky */
  --accent-hover: #7dd3fc;
  --accent-subtle: #082f49;
  --accent-border: #0369a1;

  --ring: #38bdf8;

  --color-success: #34d399;   /* Emerald 400 */
  --bg-success: #064e3b;
  --border-success: #065f46;

  --color-warning: #fbbf24;   /* Amber 400 */
  --bg-warning: #78350f;
  --border-warning: #92400e;

  --color-danger: #fb7185;    /* Rose 400 */
  --bg-danger: #881337;
  --border-danger: #9f1239;

  --color-purple: #c084fc;    /* Violet 400 */
  --bg-purple: #4c1d95;
  --border-purple: #5b21b6;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
  --shadow-hover: 0 12px 24px -4px rgba(0, 0, 0, 0.7);
  --shadow-modal: 0 24px 48px -12px rgba(0, 0, 0, 0.85);
}

/* ──────────────────────────────────────────────
   2. Reset & Base Styles
   ────────────────────────────────────────────── */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  text-size-adjust: 100%;
  overflow-x: clip;
}

body {
  background-color: var(--bg);
  color: var(--text-body);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Accessible Skip to Content Link */
.skip-link {
  position: absolute;
  top: -999px;
  left: 1rem;
  background: var(--primary);
  color: var(--primary-text);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--text-sm);
  z-index: 99999;
  text-decoration: none;
  box-shadow: var(--shadow-lg);
  transition: top var(--transition-fast);
}

.skip-link:focus-visible {
  top: 1rem;
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* Accessible Focus-Visible Across All Interactive Elements */
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
}

code, pre {
  font-family: var(--font-mono);
}

/* Screen-Reader Only Utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ──────────────────────────────────────────────
   3. Mobile-First Layout Architecture
   ────────────────────────────────────────────── */

/* ─── SHELL LAYOUT ─── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* keep legacy class alive so existing CSS rules don't crash */
.app-layout { display: flex; flex-direction: column; min-height: 100vh; }
.content-wrapper { flex: 1 0 auto; width: min(100% - 2rem, 1200px); margin-inline: auto; padding: var(--space-4) 0 var(--space-6) 0; }

/* ─── BODY ROW ─── */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* ─── SIDEBAR ─── */
.app-sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 64px);
  position: sticky;
  top: 64px;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width var(--transition-normal), min-width var(--transition-normal), transform var(--transition-normal);
  z-index: 50;
  flex-shrink: 0;
}

.app-sidebar.collapsed {
  width: 0;
  min-width: 0;
  border-right: none;
}

.sidebar-nav {
  padding: var(--space-3) var(--space-2);
  flex: 1;
}

.sidebar-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0.6rem var(--space-2) 0.4rem;
  margin-top: 0.25rem;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.6rem var(--space-2);
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  text-align: left;
  transition: background var(--transition-fast), color var(--transition-fast);
  position: relative;
  min-height: 44px;
}

.sidebar-nav-item:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.sidebar-nav-item.active {
  background: var(--primary-subtle);
  color: var(--primary);
  font-weight: 600;
}

[data-theme="dark"] .sidebar-nav-item.active {
  background: var(--primary-subtle);
  color: var(--primary);
}

.sidebar-nav-item.active .sidebar-nav-icon {
  color: var(--primary);
}

.sidebar-nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: inherit;
  transition: color var(--transition-fast);
}

.sidebar-nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav-badge {
  font-size: 0.68rem;
  font-weight: 700;
  font-family: var(--font-mono);
  background: var(--surface-alt);
  color: var(--text-dim);
  border-radius: var(--radius-pill);
  padding: 1px 7px;
  min-width: 22px;
  text-align: center;
  border: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.sidebar-nav-badge--accent {
  background: var(--accent-subtle);
  color: var(--accent);
  border-color: var(--accent-border);
}

.sidebar-nav-badge--danger {
  background: var(--bg-danger);
  color: var(--color-danger);
  border-color: var(--border-danger);
}

.sidebar-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-2) var(--space-2);
}

.sidebar-info-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.4rem var(--space-2);
  color: var(--text-dim);
}

.sidebar-info-text {
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.sidebar-footer {
  padding: var(--space-2) var(--space-2) var(--space-3);
  border-top: 1px solid var(--border-subtle);
}

.sidebar-footer-text {
  font-size: 0.68rem;
  color: var(--text-dim);
  display: block;
  padding: 0.4rem var(--space-2);
}

/* ─── SIDEBAR TOGGLE BUTTON ─── */
.sidebar-toggle-btn {
  color: var(--text-muted);
}

/* ─── SIDEBAR MOBILE OVERLAY ─── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 49;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
  display: block;
}

/* ─── MAIN CONTENT PANEL ─── */
.app-main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-4) var(--space-5);
  min-width: 0;
}

@media (max-width: 900px) {
  .app-main {
    padding: var(--space-3) var(--space-3);
  }
}

/* ─── MODULE PANELS ─── */
.module-panel {
  animation: moduleFadeIn 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ─── MODULE PAGE HEADER ─── */
.module-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.module-page-header-left {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.module-page-icon {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}


.rejection-icon {
  background: linear-gradient(135deg, var(--color-danger) 0%, #fb7185 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(190, 18, 60, 0.2);
}

.module-page-title {
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 0.3rem;
}

.module-page-desc {
  font-size: var(--text-sm);
  color: var(--text-dim);
  line-height: 1.5;
}


/* ─── DAY-WISE SEPARATION ─── */
.day-group {
  margin-bottom: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  background: var(--surface-alt);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 0.35rem;
}

.day-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.day-header-badge svg {
  color: var(--primary);
  flex-shrink: 0;
}

.day-header-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 2px 10px;
}


/* ─── MOBILE SIDEBAR BEHAVIOR ─── */
@media (max-width: 860px) {
  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    box-shadow: var(--shadow-lg);
    width: 260px;
    min-width: 260px;
  }

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

  .app-sidebar.collapsed {
    width: 260px;
    min-width: 260px;
    transform: translateX(-100%);
  }

  .sidebar-overlay.active {
    display: block;
  }
}

/* ──────────────────────────────────────────────
   4. Sticky Professional Header Component
   ────────────────────────────────────────────── */

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

[data-theme="dark"] .app-header {
  background-color: rgba(15, 23, 42, 0.85);
}

.header-container {
  width: 100%;
  max-width: 100%;
  margin-inline: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  gap: var(--space-3);
  position: relative;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  min-width: 0;
}

.logo-badge {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--quora-red) 0%, #8b1814 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(185, 43, 39, 0.25);
  transition: transform var(--transition-fast);
}

.logo-badge:hover {
  transform: scale(1.04);
}

.brand-text {
  min-width: 0;
}

.app-title {
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-subtitle {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.15rem;
}

.app-subtitle code {
  background: var(--surface-alt);
  color: var(--text);
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  border: 1px solid var(--border-subtle);
}

/* Mobile Hamburger Menu Toggle Button */
.mobile-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mobile-menu-btn:hover {
  background: var(--surface-alt);
  border-color: var(--border-hover);
}

/* Header Right Actions */
.header-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Mobile Drawer Behavior */
@media (max-width: 840px) {
  .mobile-menu-btn {
    display: flex;
  }

  .header-right {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: var(--space-4) 1rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    box-shadow: var(--shadow-lg);
    display: none;
    transform-origin: top;
  }

  .header-right.open {
    display: flex;
    animation: drawerSlide 200ms cubic-bezier(0, 0, 0.2, 1);
  }

  .header-right .live-pill {
    justify-content: center;
  }
}

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

@media (min-width: 841px) {
  .mobile-menu-btn {
    display: none;
  }

  .header-right {
    display: flex !important;
  }
}

/* ──────────────────────────────────────────────
   5. Buttons (Primary, Secondary, Ghost, Icon)
   ────────────────────────────────────────────── */

button {
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  min-height: 44px; /* WCAG 44x44px minimum target size */
  padding: 0 var(--space-3);
  user-select: none;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary Button */
.primary-btn {
  background-color: var(--primary);
  color: var(--primary-text);
  box-shadow: var(--shadow-sm);
}

.primary-btn:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.primary-btn:active {
  transform: translateY(0);
}

/* Secondary Button */
.secondary-btn {
  background-color: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.secondary-btn:hover {
  background-color: var(--surface-alt);
  border-color: var(--border-hover);
  color: var(--text);
}

.secondary-btn:active {
  background-color: var(--border-subtle);
}

/* Icon Only Button */
.icon-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}

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

/* Spinning Refresh Animation */
.refresh-icon.spinning {
  animation: spinIcon 750ms linear infinite;
}

@keyframes spinIcon {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Live Status Indicator Pill */
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-pill);
  background: var(--bg-success);
  border: 1px solid var(--border-success);
  color: var(--color-success);
  font-size: var(--text-xs);
  font-weight: 700;
  font-family: var(--font-mono);
  min-height: 38px;
}

.pulsing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-success);
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(4, 120, 87, 0.7);
  animation: pulseDot 2s infinite cubic-bezier(0.66, 0, 0, 1);
}

@keyframes pulseDot {
  to {
    box-shadow: 0 0 0 8px rgba(4, 120, 87, 0);
  }
}

/* ──────────────────────────────────────────────
   6. Key Metrics Stats Section (Grid)
   ────────────────────────────────────────────── */

.stats-section {
  margin-bottom: var(--space-5);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
  gap: var(--space-3);
}

.stat-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}

.stat-icon-wrapper {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon-wrapper.blue {
  background-color: var(--primary-subtle);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.stat-icon-wrapper.green {
  background-color: var(--bg-success);
  color: var(--color-success);
  border: 1px solid var(--border-success);
}

.stat-icon-wrapper.purple {
  background-color: var(--bg-purple);
  color: var(--color-purple);
  border: 1px solid var(--border-purple);
}

.stat-icon-wrapper.orange {
  background-color: var(--bg-danger);
  color: var(--color-danger);
  border: 1px solid var(--border-danger);
}

.stat-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 0.15rem;
}

.stat-val {
  font-size: clamp(1.4rem, 1.25rem + 0.6vw, 1.85rem);
  font-weight: 800;
  color: var(--text);
  line-height: 1.15;
  font-family: var(--font-mono);
}

.stat-val-group {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.stat-target-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  color: var(--color-success);
  border: 1px solid var(--border-subtle);
}

/* ──────────────────────────────────────────────
   7. Toolbar (Search, Filter Pills & Select)
   ────────────────────────────────────────────── */

.toolbar {
  background-color: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-dim);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  min-height: 48px;
  padding: 0 2.5rem 0 2.75rem;
  font-family: inherit;
  font-size: var(--text-sm);
  background-color: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.search-box input:focus {
  background-color: var(--surface);
  border-color: var(--primary);
  outline: 2px solid var(--ring);
  outline-offset: 1px;
}

.clear-btn {
  position: absolute;
  right: 0.65rem;
  min-height: 32px;
  width: 32px;
  padding: 0;
  background: transparent;
  border: none;
  font-size: 1.25rem;
  color: var(--text-dim);
}

.clear-btn:hover {
  color: var(--text);
}

.filter-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.filter-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.filter-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin-right: 0.25rem;
}

.filter-pill {
  min-height: 38px;
  padding: 0.35rem 0.85rem;
  font-size: var(--text-xs);
  font-weight: 600;
  background-color: var(--surface-alt);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
}

.filter-pill:hover {
  background-color: var(--border-subtle);
  color: var(--text);
  border-color: var(--border);
}

.filter-pill.active {
  background-color: var(--primary);
  color: var(--primary-text);
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(30, 58, 138, 0.25);
}

[data-theme="dark"] .filter-pill.active {
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

.score-filter-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.custom-select {
  min-height: 40px;
  padding: 0 1.75rem 0 0.85rem;
  font-family: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  background-color: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  outline: none;
  transition: all var(--transition-fast);
}

.custom-select:focus-visible {
  border-color: var(--primary);
  outline: 2px solid var(--ring);
}

/* Datewise Calendar Filter */
.date-filter-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.date-input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.calendar-icon {
  position: absolute;
  left: 0.75rem;
  color: var(--text-dim);
  pointer-events: none;
}

.custom-date-input {
  min-height: 40px;
  padding: 0 2rem 0 2.25rem;
  font-family: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  background-color: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.custom-date-input:focus-visible {
  border-color: var(--primary);
  outline: 2px solid var(--ring);
}

.custom-date-input::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}

.custom-date-input::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

[data-theme="dark"] .custom-date-input::-webkit-calendar-picker-indicator {
  filter: invert(0.85);
}

.clear-date-btn {
  position: absolute;
  right: 0.35rem;
  min-height: 28px;
  width: 28px;
  padding: 0;
  background: transparent;
  border: none;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.clear-date-btn:hover {
  color: var(--text);
  background-color: var(--border-subtle);
}

/* ──────────────────────────────────────────────
   8. Feed & Post Cards Component
   ────────────────────────────────────────────── */

.feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.feed-title {
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.item-count-badge {
  font-size: var(--text-xs);
  font-weight: 700;
  font-family: var(--font-mono);
  background: var(--surface-alt);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-pill);
}

.sort-label {
  font-size: var(--text-xs);
  color: var(--text-dim);
}

.sort-label code {
  color: var(--text);
  font-weight: 600;
}

.posts-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Post Card Component */
.post-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
  cursor: pointer;
  position: relative;
}

.post-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border-hover);
}

.card-header,
.post-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.card-badges,
.post-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.card-date {
  font-size: var(--text-xs);
  color: var(--text-dim);
  font-weight: 600;
  white-space: nowrap;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1.25;
}

.badge-posted,
.badge-status-posted {
  background-color: var(--bg-success);
  color: var(--color-success);
  border: 1px solid var(--border-success);
}

.badge-status-dry {
  background-color: var(--primary-subtle);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.badge-status-rejected {
  background-color: var(--bg-danger);
  color: var(--color-danger);
  border: 1px solid var(--border-danger);
}

.badge-mention {
  background-color: var(--bg-purple);
  color: var(--color-purple);
  border: 1px solid var(--border-purple);
}

.badge-score-high {
  background-color: var(--primary-subtle);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.badge-score-mid,
.badge-score-med {
  background-color: var(--bg-warning);
  color: var(--color-warning);
  border: 1px solid var(--border-warning);
}

.badge-score-low {
  background-color: var(--surface-alt);
  color: var(--text-dim);
  border: 1px solid var(--border-subtle);
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  background-color: var(--surface-alt);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
}

/* Question / Post Title */
.card-title,
.question-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
}

.card-title a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.card-title a:hover {
  color: var(--primary);
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.card-answer-preview {
  background-color: var(--surface-alt);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  font-size: var(--text-sm);
  color: var(--text-body);
  line-height: 1.6;
}

.card-answer-preview p {
  margin: 0;
}

/* Quora Link Bar */
.quora-link-bar {
  margin-bottom: var(--space-3);
}

.quora-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--accent);
  background: var(--accent-subtle);
  border: 1px solid var(--accent-border);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-md);
  max-width: 100%;
  word-break: break-all;
  min-height: 38px;
}

.quora-link-btn:hover {
  background: var(--surface-alt);
  color: var(--accent-hover);
  border-color: var(--accent);
}

/* Rejection Alert Box */
.rejection-alert-box {
  background-color: var(--bg-danger);
  border: 1px solid var(--border-danger);
  color: var(--color-danger);
  padding: 0.65rem 0.95rem;
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 600;
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Answer Container */
.answer-container {
  background-color: var(--surface-alt);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
}

.answer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.answer-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.answer-text {
  font-size: var(--text-sm);
  color: var(--text-body);
  line-height: 1.7;
  max-width: 72ch; /* Ergonomic Reading Line-Length */
}

.answer-text.collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.read-more-btn {
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 0.35rem 0;
  min-height: auto;
  cursor: pointer;
  margin-top: 0.35rem;
}

.read-more-btn:hover {
  text-decoration: underline;
}

/* Post Card Footer */
.card-footer,
.post-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-subtle);
}

.card-footer-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.icon-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.icon-link-btn:hover {
  color: var(--primary);
  border-color: var(--border-hover);
  background: var(--surface-hover);
}

.author-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--space-6) var(--space-4);
  background-color: var(--card-bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  margin-top: var(--space-4);
}

.empty-icon-box {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface-alt);
  color: var(--text-dim);
}

/* ──────────────────────────────────────────────
   9. Accessible Modals (Inspector & Audit Log)
   ────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
  animation: fadeIn 150ms ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-dialog {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-modal);
  animation: slideUp 200ms cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.modal-dialog.modal-large {
  max-width: 960px;
}

@keyframes slideUp {
  from { transform: translateY(16px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-alt);
  flex-shrink: 0;
}

.modal-header-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.modal-close {
  width: 40px;
  height: 40px;
  min-height: 40px;
  min-width: 40px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 1.5rem;
  line-height: 1;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background-color: var(--surface-hover);
  color: var(--text);
}

.modal-body {
  padding: var(--space-4);
  overflow-y: auto;
  flex: 1 1 auto;
}

.modal-section {
  margin-bottom: var(--space-4);
}

.section-tag {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  display: block;
  margin-bottom: 0.35rem;
}

.modal-title {
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 0.65rem;
}

.modal-url-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: var(--space-2);
}

.section-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.answer-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.word-count-badge {
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

.answer-box {
  background-color: var(--surface-alt);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-body);
  line-height: 1.75;
}

.answer-box p + p {
  margin-top: 1rem;
}

/* JSON Code Block */
.json-code-block {
  background-color: #0f172a;
  color: #38bdf8;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  overflow-x: auto;
  max-height: 280px;
  border: 1px solid #1e293b;
}

.modal-footer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
  margin-top: var(--space-4);
}

.timestamp-text {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-dim);
}

/* ──────────────────────────────────────────────
   10. Rejections Audit Table (Scroll Wrapper)
   ────────────────────────────────────────────── */

.rejections-intro {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.table-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  -webkit-overflow-scrolling: touch;
}

.rejections-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: var(--text-xs);
}

.rejections-table th {
  background-color: var(--surface-alt);
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.rejections-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-body);
  vertical-align: middle;
}

.rejections-table tr:hover {
  background-color: var(--surface-hover);
}

/* ──────────────────────────────────────────────
   11. Professional Site Footer Component
   ────────────────────────────────────────────── */

.app-footer {
  background-color: var(--surface);
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-5) 0 var(--space-4) 0;
  margin-top: auto;
}

.footer-container {
  width: min(100% - 2rem, 1200px);
  margin-inline: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}

.brand-col .footer-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.65rem;
}

.footer-desc {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 45ch;
}

.footer-heading {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  margin-bottom: 0.85rem;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-links li {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.footer-links code {
  color: var(--text);
  background: var(--surface-alt);
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.footer-bottom {
  width: min(100% - 2rem, 1200px);
  margin-inline: auto;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-dim);
}

/* ──────────────────────────────────────────────
   12. Accessibility: Reduced Motion Media Query
   ────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
