/* ==========================================================================
   AARAB v3.0 – Complete Production-Ready CSS
   Final Unified Stylesheet – December 2025
   Fully documented, accessible, performant, responsive & future-proof
   Optimized for 100 Lighthouse scores (Performance, Accessibility, SEO, Best Practices)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties – Design Tokens (Dark-First, Fully Scalable)
   -------------------------------------------------------------------------- */
   :root {
    /* Brand Palette – Primary */
    --primary: #00d9c0;
    --primary-hover: #33e6d0;
    --primary-light: #66f0e0;
    --primary-glow: rgba(0, 217, 192, 0.35);
    --primary-glow-intense: rgba(0, 217, 192, 0.5);
  
     /* Z-Index Hierarchy (for reference) */
     --z-particle-bg: 1;
     --z-main-content: 10;
     --z-sticky-header: 80;
     --z-sidebar: 900;
     --z-sidebar-toggle: 1000;
     --z-dropdown: 999;
     --z-top-controls: 1000;
     --z-modal-overlay: 9999;
     --z-skip-link: 9999;
  
    /* Secondary & Accents */
    --accent-blue: #3b82f6;
    --accent-purple: #7c3aed;
    --accent-cyan: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
  
    /* Backgrounds & Surfaces */
    --bg-body: #0a0f1e;
    --bg-darker: #050912;
    --bg-surface: #1e293b;
    --bg-surface-light: #334155;
    --bg-card: rgba(30, 41, 59, 0.6);
    --bg-card-solid: #1e293b;
    --bg-overlay: rgba(10, 26, 63, 0.96);
  
    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-disabled: #64748b;
    --text-inverse: #0f172a;
  
    /* Borders & Dividers */
    --border: rgba(51, 65, 85, 0.7);
    --border-strong: #334155;
    --border-light: rgba(148, 163, 184, 0.2);
    --border-focus: var(--primary);
  
    /* Shadows */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 30px var(--primary-glow);
    --shadow-glow-intense: 0 0 50px var(--primary-glow-intense);
  
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;
  
    /* Transitions */
    --ease-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --ease-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --ease-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
  
    /* Typography */
    --font-base: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
    --text-5xl: 3rem;
  
    /* ↓↓↓ ADD THESE TWO LINES – restores full AI Core compatibility ↓↓↓ */
    --primary-color: var(--primary);
    --primary-glow: rgba(0, 217, 192, 0.35);
    /* or reuse your existing --primary-glow */
  }
  
  /* --------------------------------------------------------------------------
     2. Global Reset & Base Styles (Modern Reset + Accessibility)
     -------------------------------------------------------------------------- */
  *,
  *::before,
  *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
  
  html {
    font-size: 100%;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-scroll-padding-top: 6rem;
    scroll-padding-top: 6rem;
  }
  
  body {
    min-height: 100dvh;
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-body) 50%, #0d1425 100%);
    color: var(--text-primary);
    font-family: var(--font-base);
    font-size: var(--text-base);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
  }
  
  /* Visually Hidden (Screen Readers Only) */
  .visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }
  
  /* Skip Link – Accessibility */
  .skip-link {
    position: absolute;
    top: -9999px;
    left: 1rem;
    background: var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    z-index: 9999;
    transition: top var(--ease-fast);
  }
  
  .skip-link:focus {
    top: 1rem;
  }
  
  /* --------------------------------------------------------------------------
     3. Layout & Main Container
     -------------------------------------------------------------------------- */
  .container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* Fallback */
    min-height: 100dvh;
    width: 100%;
    position: relative;
    z-index: 10;
  }
  
  main {
    flex: 1;
    /* Allow main to grow and fill available space */
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Center content vertically */
    align-items: center;
    /* Center content horizontally */
    width: 100%;
    padding: 2rem 1.5rem;
  } 
  
  /* Remove container constraints from the old implementation */
  /*
  .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    width: 100%;
    position: relative;
    z-index: 10;
  }
  */
  
  /* --------------------------------------------------------------------------
     4. Particle Background (Decorative Only)
     -------------------------------------------------------------------------- */
  #particle-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
  }
  
  .particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0;
    animation: float 25s infinite linear;
  }
  
  @keyframes float {
    0% {
      transform: translateY(100vh) translateX(-50vw);
      opacity: 0;
    }
  
    10% {
      opacity: 0.4;
    }
  
    90% {
      opacity: 0.4;
    }
  
    100% {
      transform: translateY(-100px) translateX(100vw);
      opacity: 0;
    }
  }
  
  /* --------------------------------------------------------------------------
     5. Settings & Ecosystem Controls (Top-Right Corner)
     -------------------------------------------------------------------------- */
  .settings-wrapper {
    position: fixed;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.75rem;
    z-index: 1000;
  }.settings-wrapper { z-index: var(--z-top-controls); }
  
  .detail-header-sticky {
      position: sticky;
      top: 75px;
      z-index: 80;
  } 
  
  .settings-btn {
    width: 44px;
    height: 44px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all var(--ease-normal);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  
  .settings-btn:hover {
    background: rgba(0, 217, 192, 0.12);
    border-color: var(--primary);
    color: var(--text-primary);
    transform: translateY(-4px) scale(1.05);
    box-shadow: var(--shadow-glow);
  }
  
  .settings-btn[aria-expanded="true"] {
    background: var(--primary);
    color: var(--text-inverse);
    transform: scale(1.1);
    box-shadow: var(--shadow-glow-intense);
  }
  
  .settings-btn:focus-visible {
    outline: 3px solid var(--primary-light);
    outline-offset: 4px;
  }
  
  /* Dropdown Base */
  .settings-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    min-width: 300px;
    background: var(--bg-card-solid);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    padding: 1.25rem;
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-12px);
    transition: all var(--ease-normal);
    z-index: var(--z-dropdown);
  }
  
  .settings-dropdown.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
  
  .dropdown-title {
    margin: 0 0 1rem;
    padding-bottom: 0.75rem;
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
  }
  
  /* ==========================================================================
     ECOSYSTEM DROPDOWN – FINAL FIXED & PERFECTED (December 2025)
     ========================================================================== */
  
  .ecosystem-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 460px;
    max-height: 85dvh;
    background: var(--bg-card-solid);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-12px);
    transition: all var(--ease-normal);
    z-index: var(--z-dropdown);
  
    /* Flexbox layout to control child elements */
    display: flex;
    flex-direction: column;
  }
  
  .ecosystem-dropdown.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
  
  /* ==========================================================================
     ECO-ITEM & TASK-ITEM – DYNAMIC FULL-WIDTH FIX (PRODUCTION v3.0.9+)
     ========================================================================== */
  
  /* 1. Define the container layout using Flexbox for perfect item sizing. */
  .ecosystem-list,
  .task-list-body .ecosystem-list {
    display: flex;
    flex-direction: column;
    gap: 0.875rem; /* Consistent spacing between items */
    padding: 0.75rem 1rem 1.5rem 1rem; /* Breathing room, including right side */
    width: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  
  /* 2. Style the items to fill the container's width correctly. */
  .eco-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    width: 100%; /* Automatically fill the available space defined by parent's padding */
    flex-shrink: 0; /* Prevent items from shrinking unexpectedly */
    margin: 0; /* Remove any residual margins */
    max-width: 100%; /* Ensure it doesn't overflow */
    min-width: 0; /* CRITICAL: Allows flex items with text to shrink correctly */
    background: rgba(51, 65, 85, 0.4);
    border-radius: var(--radius-lg);
    border: 1px solid transparent;
    color: var(--text-secondary);
    text-decoration: none;
    box-sizing: border-box; /* Ensures padding is included in width calculation */
    transition: all var(--ease-fast);
  }
  
  .eco-item:hover {
    background: var(--primary);
    color: var(--text-inverse);
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 217, 192, 0.25);
  }
  
  .eco-item img {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
  }
  
  .eco-item strong {
    display: block;
    flex: 1; /* Allow strong tag to take available space */
    min-width: 0; /* Allow flex item to shrink and truncate */
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .eco-item:hover strong {
    color: var(--text-inverse);
  }
  
  .eco-item span {
    font-size: var(--text-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.9;
  }
  
  /* Settings Items */
  .setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-light);
  }
  
  .setting-item:last-child {
    border-bottom: none;
  }
  
  .setting-item label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: var(--text-base);
    color: var(--text-primary);
    cursor: pointer;
  }
  
  /* --------------------------------------------------------------------------
     6. AI CORE – PRESERVED EXACTLY AS REQUESTED
     -------------------------------------------------------------------------- */
  #ai-core-container {
    text-align: center;
    margin-bottom: 3rem;
    transition: all 0.5s ease;
  }
  
  .ai-core {
    width: 150px;
    height: 150px;
    position: relative;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1000px;
    transform-style: preserve-3d;
  }
  
  .ai-core .ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    opacity: 0;
  }
  
  .ai-core .ring:nth-child(1) {
    width: 100%;
    height: 100%;
    animation: pulse-ring 2.5s ease-out infinite;
  }

  .ai-core.communicating .ring:nth-child(1) {
    animation: rotate-3d-1 2s linear infinite, pulse-ring 2.5s ease-out infinite;
  }
  
  .ai-core .ring:nth-child(2) {
    width: 80%;
    height: 80%;
    animation: pulse-ring 2.5s ease-out infinite;
  }

  .ai-core.communicating .ring:nth-child(2) {
    animation: rotate-3d-2 2.5s linear infinite, pulse-ring 2.5s ease-out infinite;
  }
  
  .ai-core .ring:nth-child(3) {
    width: 60%;
    height: 60%;
    animation: pulse-ring 2.5s ease-out infinite;
  }

  .ai-core.communicating .ring:nth-child(3) {
    animation: rotate-3d-3 3s linear infinite, pulse-ring 2.5s ease-out infinite;
  }
  
  .core-center {
    content: '';
    width: 30px;
    height: 30px;
    background: var(--primary-color);
    border-radius: 50%;
    box-shadow: 0 0 20px var(--primary-color), 0 0 40px var(--primary-color);
    transition: all 0.3s ease;
  }
  
  .ai-core.thinking .core-center {
    animation: pulse-core 1.5s infinite;
  }
  
  .ai-core.complete .core-center {
    transform: scale(1.2);
    background: #10B981;
    box-shadow: 0 0 20px #10B981;
  }
  
  #status-text {
    font-size: 1.1rem;
    color: var(--text-secondary);
    transition: color 0.3s ease;
    max-width: 640px;
    margin: 0 auto;
  }
  
  /* AI Core Animations */
  @keyframes rotate {
    from {
      transform: rotate(0deg);
    }
  
    to {
      transform: rotate(360deg);
    }
  }

  @keyframes rotate-3d-1 {
    0% { transform: rotate3d(1, 1, 1, 0deg); }
    100% { transform: rotate3d(1, 1, 1, 360deg); }
  }

  @keyframes rotate-3d-2 {
    0% { transform: rotate3d(1, -1, 0, 0deg); }
    100% { transform: rotate3d(1, -1, 0, 360deg); }
  }

  @keyframes rotate-3d-3 {
    0% { transform: rotate3d(0, 1, -1, 0deg); }
    100% { transform: rotate3d(0, 1, -1, 360deg); }
  }
  
  @keyframes pulse-ring {
  
    0%,
    100% {
      opacity: 0.1;
    }
  
    50% {
      opacity: 0.6;
    }
  }
  
  @keyframes pulse-core {
  
    0%,
    100% {
      transform: scale(1);
    }
  
    50% {
      transform: scale(1.3);
    }
  }
  
  /* --------------------------------------------------------------------------
     7. Search Input Area
     -------------------------------------------------------------------------- */
  #search-area {
    max-width: 820px;
    margin: 0 auto 3rem;
    padding: 0 1.5rem;
    /* Add horizontal padding for spacing */
    width: 100%;
    box-sizing: border-box;
  }
  
  .input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 60px;
    padding: 0.5rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: all var(--ease-normal);
    width: 100%;
    box-sizing: border-box;
  }
  
  .input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 8px var(--primary-glow);
    transform: translateY(-3px);
  }
  
  .input-actions {
    display: flex;
    gap: 0.75rem;
    padding: 0 1rem;
    flex-shrink: 0;
    /* Prevent shrinking */
  }
  
  .input-action-btn {
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--ease-fast);
    flex-shrink: 0;
    /* Prevent shrinking */
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .input-action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    transform: scale(1.1);
  }
  
  .input-action-btn:active {
    transform: scale(0.95);
  }
  
  #query {
    flex: 1;
    min-width: 0;
    /* Allow flex item to shrink below content size */
    padding: 1.25rem 1rem;
    font-size: 1.125rem;
    font-weight: 500;
    background: transparent;
    color: var(--text-primary);
    border: none;
    outline: none;
    width: 100%;
    box-sizing: border-box;
    resize: none;
    overflow: hidden;
    height: auto;
  }
  
  #query::placeholder {
    color: var(--text-disabled);
  }
  
  .send-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%) scale(0.9);
    width: 56px;
    height: 56px;
    background: var(--primary);
    color: var(--text-inverse);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: all var(--ease-normal);
    box-shadow: var(--shadow-lg);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .send-btn.visible {
    opacity: 1;
    pointer-events: all;
    transform: translateY(-50%) scale(1);
  }
  
  .send-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-50%) scale(1.1);
    box-shadow: var(--shadow-glow-intense);
  }
  
  .send-btn:active {
    transform: translateY(-50%) scale(0.95);
  }
  
  /* --------------------------------------------------------------------------
     8. Results & Cards – Perfectly Scrollable List
     -------------------------------------------------------------------------- */
  /* Sidebar Container - Intelligent Responsiveness */
  /* Sidebar Container - Intelligent Responsiveness */
  .results-sidebar {
    /* Default Desktop State (Fixed Right Sidebar) */
    width: 380px;
    height: 100vh;
    /* Fallback */
    height: 100dvh;
    position: fixed;
    top: 0;
    right: 0;
    flex-shrink: 0;
    margin-left: 0;
  
    background: var(--bg-surface);
    border-radius: 0;
    /* Flush edges */
    border-left: 1px solid var(--border-light);
    border-top: none;
    border-right: none;
    border-bottom: none;
    box-shadow: var(--shadow-lg);
  
    /* Enable perfect scrolling */
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  
    display: flex;
    flex-direction: column;
    padding: 0;
    
    transition: transform var(--ease-normal), opacity var(--ease-normal), right var(--ease-normal);
    z-index: 90;
  
    contain: layout style paint;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
  }
  
  /* Firefox scrollbar */
  .results-sidebar {
    scrollbar-width: thin;
    scrollbar-color: var(--primary) rgba(51, 65, 85, 0.3);
  }
  
  /* Results wrapper for content inside scrollable container */
  .results-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
  }
  
  .result-card,
  .feature-card {
    background: transparent;
    /* Cleaner base */
    border-radius: var(--radius-lg);
    /* Rounded corners inside */
    padding: 1.25rem 1.5rem;
    margin: 0 0.5rem;
    /* Margin for spacing */
    border-bottom: 1px solid transparent;
    /* Use transparent border for layout consistency */
    box-shadow: none;
    flex-shrink: 0;
    transition: background var(--ease-fast), transform var(--ease-fast);
    cursor: pointer;
  }
  
  .result-card:last-child,
  .feature-card:last-child {
    border-bottom: none;
  }
  
  .result-card:hover,
  .feature-card:hover {
    background: rgba(51, 65, 85, 0.5);
    /* Darker hover for contrast */
    transform: scale(1.01);
    box-shadow: none;
    border-bottom-color: var(--border);
  }
  
  .animate-fade-in {
    opacity: 0;
    transform: translateX(-20px);
    animation: fadeInLeft 0.4s ease-out forwards;
  }
  
  @keyframes fadeInUp {
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  @keyframes fadeInLeft {
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }
  
  /* --------------------------------------------------------------------------
     9. Footer
     -------------------------------------------------------------------------- */
  footer {
    margin-top: 8rem;
    padding: 5rem 0 2rem;
    background: linear-gradient(180deg, transparent, var(--bg-darker));
    position: relative;
    overflow: hidden;
  }
  
  .footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    text-align: center;
  }
  
  .footer-bottom {
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
    color: var(--text-muted);
    font-size: var(--text-sm);
  }
  
  .footer-bottom strong {
    color: var(--primary);
    font-weight: 700;
  }
  
  .footer-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
  }
  
  /* --------------------------------------------------------------------------
     10. Responsive Design
     -------------------------------------------------------------------------- */
  @media (max-width: 1024px) {
  }
  
  @media (max-width: 480px) {
    .settings-btn {
      width: 48px;
      height: 48px;
    }
  
    .ai-core {
      width: 130px;
      height: 130px;
    }
  
    #search-area {
      margin: 1.5rem auto 2rem;
      padding: 0 0.75rem;
      /* Minimal padding on mobile */
    }
  
    .input-wrapper {
      padding: 0.35rem;
      border-radius: 40px;
      /* Smaller border radius on mobile */
    }
  
    .input-wrapper:focus-within {
      box-shadow: 0 0 0 4px var(--primary-glow);
      /* Smaller glow on mobile */
      transform: translateY(-2px);
      /* Less transform on mobile */
    }
  
    .input-actions {
      gap: 0.4rem;
      padding: 0 0.5rem;
    }
  
    .input-action-btn {
      width: 36px;
      height: 36px;
      font-size: 0.875rem;
    }
  
    /* Modified: Hide Voice (1), Show Camera (2) and Attach (3) on small screens */
    .input-action-btn:first-child {
      display: none;
    }
    
    .input-action-btn:nth-child(2),
    .input-action-btn:nth-child(3) {
      display: flex;
    }
  
    #query {
      font-size: 0.95rem;
      padding: 0.9rem 0.5rem;
      min-width: 0;
      /* Ensure it can shrink */
    }
  
    .send-btn {
      width: 44px;
      height: 44px;
      right: 4px;
      font-size: 0.9rem;
    }
  }
  
  /* Extra small screens (very small phones) */
  @media (max-width: 360px) {
    #search-area {
      padding: 0 0.5rem;
      margin: 1rem auto 1.5rem;
    }
  
    .input-wrapper {
      padding: 0.3rem;
      border-radius: 35px;
    }
  
    .input-actions {
      gap: 0.3rem;
      padding: 0 0.4rem;
    }
  
    .input-action-btn {
      width: 32px;
      height: 32px;
      font-size: 0.8rem;
    }
  
    /* Modified: Hide Voice, Show Camera/Attach on very small screens */
    .input-action-btn {
      display: none;
    }
  
    .input-action-btn:nth-child(2),
    .input-action-btn:nth-child(3) {
      display: flex;
    }
  
    #query {
      font-size: 0.9rem;
      padding: 0.85rem 0.4rem;
    }
  
    .send-btn {
      width: 40px;
      height: 40px;
      right: 3px;
      font-size: 0.85rem;
    }
  }
  
  .result-card,
  .feature-card {
    padding: 0.875rem;
  }
  
  .card-title {
    font-size: var(--text-lg);
  }
  
  .source-item {
    flex-direction: column;
  }
  
  
  /* --------------------------------------------------------------------------
     11. Print & Reduced Motion
     -------------------------------------------------------------------------- */
  @media (prefers-reduced-motion: reduce) {
  
    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      transition-duration: 0.01ms !important;
    }
  }
  
  @media print {
  
    .settings-wrapper,
    #particle-container,
    footer {
      display: none !important;
    }
  
    body {
      background: white;
      color: black;
    }
  }
  
  /* ==========================================================================
     Additional CSS for UIController Features
     ========================================================================== */
  
  /* Modal Overlay */
  .custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: var(--primary) rgba(51, 65, 85, 0.6);
  }
  
  .custom-scrollbar::-webkit-scrollbar {
    width: 8px;
  }
  
  .custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(51, 65, 85, 0.4);
    border-radius: 4px;
  }
  
  .custom-scrollbar::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
    border: 2px solid rgba(51, 65, 85, 0.4);
  }
  
  .custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
  }
  
  /* Apply the reusable class */
  .settings-list, .ecosystem-list, .logs-container, .results-sidebar {
    @apply custom-scrollbar; /* In a real preprocessor, or just add the class in HTML */
  }
  
  .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal-overlay);
    opacity: 0;
    animation: fadeIn 0.2s ease-out forwards;
  }
  
  @keyframes fadeIn {
    to {
      opacity: 1;
    }
  }
  
  .modal-content {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    animation: slideUp 0.3s ease-out forwards;
  }
  
  @keyframes slideUp {
    to {
      transform: translateY(0);
    }
  }
  
  .modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  .modal-header h2 {
    margin: 0;
    font-size: var(--text-xl);
    color: var(--text-primary);
  }
  
  .modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: all var(--ease-fast);
  }
  
  .modal-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
  }
  
  .modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
  }
  
  /* Logs Modal Specific */
  .logs-modal .modal-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }
  
  .logs-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
  }
  
  .log-level-filters {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
  }
  
  .log-level-filters label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
  }
  
  .log-level-filters input[type="radio"] {
    accent-color: var(--primary);
  }
  
  .log-actions {
    display: flex;
    gap: 0.5rem;
  }
  
  .log-actions button {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--ease-fast);
  }
  
  .log-actions button:hover {
    background: var(--primary);
    color: var(--text-inverse);
    border-color: var(--primary);
  }
  
  .logs-container {
    background: var(--bg-darker);
    border-radius: var(--radius-lg);
    padding: 1rem;
    flex: 1;
    overflow-y: auto; /* Now styled by .custom-scrollbar */
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: var(--text-sm);
  }
  
  .logs-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .log-entry {
    padding: 0.75rem;
    border-radius: var(--radius-md);
    border-left: 4px solid transparent;
    background: rgba(255, 255, 255, 0.03);
    display: grid;
    grid-template-columns: auto auto 1fr;
    gap: 1rem;
    align-items: start;
  }
  
  .log-entry.log-error {
    border-left-color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
  }
  
  .log-entry.log-warn {
    border-left-color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
  }
  
  .log-entry.log-info {
    border-left-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.1);
  }
  
  .log-timestamp {
    color: var(--text-muted);
    font-size: var(--text-xs);
    white-space: nowrap;
  }
  
  .log-level {
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    text-transform: uppercase;
  }
  
  .log-error .log-level {
    background: var(--danger);
    color: white;
  }
  
  .log-warn .log-level {
    background: var(--warning);
    color: black;
  }
  
  .log-info .log-level {
    background: var(--accent-blue);
    color: white;
  }
  
  .log-message {
    color: var(--text-secondary);
    word-break: break-word;
  }
  
  .log-details {
    grid-column: 1 / -1;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    color: var(--text-muted);
    overflow-x: auto;
  }
  
  .empty-logs {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-style: italic;
  }
  
  .logs-stats {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: var(--text-sm);
    padding-top: 1rem;
    border-top: 1px solid var(--border);
  }
  
  /* Review Modal Specific */
  .review-modal .modal-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }
  
  .modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
  }
  
  .modal-footer button {
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    transition: all var(--ease-fast);
  }
  
  .modal-footer button:hover {
    background: var(--primary);
    color: var(--text-inverse);
    border-color: var(--primary);
  }
  
  .task-summary {
    padding: 1rem;
    background: rgba(0, 217, 192, 0.08);
    border-radius: var(--radius-lg);
    border-left: 4px solid var(--primary);
  }
  
  .task-query {
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
  }
  
  .task-query strong {
    color: var(--text-primary);
  }
  
  .task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    font-size: var(--text-sm);
    color: var(--text-muted);
  }
  
  .task-meta strong {
    color: var(--text-secondary);
  }
  
  .status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
  }
  
  .status-badge.status-completed {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
  }
  
  .status-badge.status-processing {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-blue);
  }
  
  .status-badge.status-failed {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
  }
  
  .status-badge.status-queued {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
  }
  
  .task-section {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
  }
  
  .task-section h3 {
    margin: 0 0 1rem;
    font-size: var(--text-lg);
    color: var(--text-primary);
  }
  
  .task-section p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
  }
  
  .sources-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .sources-list .source-item {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.75rem;
    background: rgba(59, 130, 246, 0.08);
    border-radius: var(--radius-md);
  }
  
  .source-number {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    background: var(--accent-blue);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: 600;
  }
  
  .source-details {
    flex: 1;
  }
  
  .source-title {
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 0.25rem;
    font-size: var(--text-sm);
  }
  
  .source-snippet {
    color: var(--text-muted);
    font-size: var(--text-xs);
    margin-bottom: 0.5rem;
    line-height: 1.4;
  }
  
  .source-link {
    color: var(--primary);
    text-decoration: none;
    font-size: var(--text-xs);
    font-weight: 500;
  }
  
  .source-link:hover {
    text-decoration: underline;
  }
  
  .metrics-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
  }
  
  .metric {
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--primary);
  }
  
  .metric span {
    display: block;
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-bottom: 0.25rem;
  }
  
  .metric {
    color: var(--text-primary);
    font-weight: 600;
  }
  
  /* Results Cards */
  .results-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2rem;
  }
  
  .card-header {
    margin-bottom: 1rem;
  }
  
  .card-title {
    font-size: var(--text-xl);
    color: var(--text-primary);
    margin-bottom: 0.25rem;
  }
  
  .card-subtitle {
    color: var(--text-muted);
    font-size: var(--text-sm);
  }
  
  .card-content {
    color: var(--text-secondary);
    line-height: 1.6;
  }
  
  .card-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
    color: var(--text-muted);
    font-size: var(--text-sm);
  }
  
  .sources-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }
  
  .source-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-lg);
    border-left: 4px solid var(--accent-blue);
  }
  
  .source-number {
    width: 2rem;
    height: 2rem;
    background: var(--primary);
    color: var(--text-inverse);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
  }
  
  .source-content {
    flex: 1;
  }
  
  .source-title {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: var(--text-base);
  }
  
  .source-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
    font-size: var(--text-sm);
    color: var(--text-muted);
  }
  
  .source-snippet {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin-bottom: 0.5rem;
    line-height: 1.5;
  }
  
  .source-link {
    color: var(--primary);
    text-decoration: none;
    font-size: var(--text-sm);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
  }
  
  .source-link:hover {
    text-decoration: underline;
  }
  
  .metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
  }
  
  .metric-item {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-lg);
  }
  
  .metric-label {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
  }
  
  .metric-value {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
  }
  
  .metric-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-surface-light);
    border-radius: 4px;
    overflow: hidden;
  }
  
  .metric-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
  }
  
  .metric-number {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 3rem;
    text-align: right;
  }
  
  .metric-description {
    color: var(--text-muted);
    font-size: var(--text-sm);
  }
  
  .images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
  }
  
  .image-item {
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-darker);
  }
  
  .image-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
  }
  
  .image-item figcaption {
    padding: 0.75rem;
    color: var(--text-muted);
    font-size: var(--text-sm);
    text-align: center;
  }
  
  .error-card {
    text-align: center;
    padding: 3rem;
    border-color: var(--danger) !important;
  }
  
  .error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
  }
  
  .error-card .card-title {
    color: var(--danger);
  }
  
  .retry-button {
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    transition: all var(--ease-fast);
  }
  
  .retry-button:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
  }
  
  .notification-content {
    display: flex;
    align-items: center;
    gap: 1rem;
  }
  
  .notification-content i {
    font-size: 1.5rem;
    color: var(--primary);
  }
  
  .notification-content strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
  }
  
  .notification-content p {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin: 0;
  }
  
  /* Accessibility Improvements */
  .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;
  }
  
  /* Input state classes */
  .input-wrapper.has-value {
    box-shadow: 0 0 0 2px var(--primary-glow);
  }
  
  .input-wrapper.processing {
    opacity: 0.7;
    pointer-events: none;
  }
  
  /* Completion animation */
  .complete-animation {
    animation: pulseComplete 1s ease-in-out;
  }
  
  @keyframes pulseComplete {
  
    0%,
    100% {
      transform: scale(1);
    }
  
    50% {
      transform: scale(1.1);
    }
  }
  
  /* Responsive adjustments */
  @media (max-width: 768px) {
    .modal-content {
      width: 95%;
      margin: 1rem;
    }
  
    .logs-controls {
      flex-direction: column;
      align-items: stretch;
    }
  
    .log-level-filters {
      justify-content: center;
    }
  
    .log-actions {
      justify-content: center;
    }
  
    .log-entry {
      grid-template-columns: 1fr;
      gap: 0.25rem;
    }
  
    .log-timestamp,
    .log-level {
      font-size: var(--text-xs);
    }
  
    .metrics-grid {
      grid-template-columns: 1fr;
    }
  
    .images-grid {
      grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
  
    .feature-notification {
      left: 1rem;
      right: 1rem;
      max-width: none;
    }
  }
  
  @media (max-width: 480px) {
    .modal-header {
      padding: 1rem;
    }
  
    .modal-body {
      padding: 1rem;
    }
  
    .source-item {
      flex-direction: column;
      gap: 0.5rem;
    }
  
    .source-number {
      align-self: flex-start;
    }
  }
  
  /* ==========================================================================
     12. Live Research Preview & Task History Cards (V10.9.152)
     ========================================================================== */
  
  .task-history-card {
    border-color: var(--accent-purple);
  }
  
  .task-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
  }
  
  @media (max-width: 480px) {
    .task-list {
      /* Allow cards to fill the screen on small devices */
      grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
  }
  
  .ai-pulse {
    animation: pulse-dot 1.75s infinite cubic-bezier(0.45, 0, 0.2, 1);
    box-shadow: 0 0 0 0 rgba(var(--pulse-color, 255, 255, 255), 0.7);
  }
  
  @keyframes pulse-dot {
    to {
      box-shadow: 0 0 0 12px rgba(var(--pulse-color, 255, 255, 255), 0);
    }
  }
  
  .agent-badge {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-muted);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 500;
  }
  
  .research-input-preview {
    background: rgba(10, 15, 30, 0.7);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 1rem;
  }
  
  .text-muted-ai {
    color: var(--text-muted);
  }
  
  .fw-semibold {
    font-weight: 600;
  }
  
  .text-success {
    color: var(--success);
  }
  
  .text-warning {
    color: var(--warning);
  }
  
  .text-danger {
    color: var(--danger);
  }
  
  .text-info {
    color: var(--accent-blue);
  }
  
  .d-flex {
    display: flex;
  }
  
  .justify-content-between {
    justify-content: space-between;
  }
  
  .align-items-center {
    align-items: center;
  }
  
  .gap-2 {
    gap: 0.5rem;
  }
  
  .mb-4 {
    margin-bottom: 1.5rem;
  }
  
  /* Task History Filter & Action Buttons */
  .task-filters {
    display: flex;
    gap: 0.75rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  
  .task-filters::-webkit-scrollbar {
    display: none;
  }
  
  .task-filter-btn {
    padding: 0.5rem 1.25rem;
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--ease-fast);
    white-space: nowrap;
    flex-shrink: 0;
  }
  
  .task-filter-btn:hover {
    background: var(--bg-surface-light);
    border-color: var(--border-focus);
    color: var(--text-primary);
  }
  
  .task-filter-btn.active {
    background: var(--primary);
    color: var(--text-inverse);
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
  }
  
  .task-item .action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: var(--text-sm);
    font-weight: 500;
    transition: all var(--ease-fast);
  }
  
  .task-item .action-btn:not([disabled]):hover {
    color: var(--text-primary);
    transform: translateY(-2px);
  }
  
  .task-item .review-btn:not([disabled]):hover {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
  }
  
  .task-item .cancel-btn:not([disabled]):hover {
    background: var(--danger);
    border-color: var(--danger);
  }
  
  /* ==========================================================================
     AI SETTINGS DROPDOWN - SCROLLABLE UPGRADE (December 2025)
     ========================================================================== */
  
  .settings-dropdown {
    display: flex !important;
    flex-direction: column !important;
    max-height: 85dvh;
  }.settings-dropdown { z-index: var(--z-dropdown); }
  
  .settings-list {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-right: 0.5rem;
    margin-top: 0.5rem;
    transform: translateZ(0);
    contain: layout style paint;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
  }
  
  /* ==========================================================================
     SPLASH SCREEN SPECIFIC OVERRIDES
     ========================================================================== */
  
  /* Scoped body style to avoid affecting index.html */
  body.splash-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    margin: 0;
    overflow: hidden;
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-body) 50%, #0d1425 100%);
  }
  
  .splash-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  
  /* Intelligent Sizing & Centering for AI Core */
  .splash-core {
    /* Responsive size: min 150px, scalable preference 25vw, max 400px */
    width: clamp(150px, 25vw, 400px);
    height: clamp(150px, 25vw, 400px);
  
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1000px;
    transform-style: preserve-3d;
  }
  
  .splash-core .ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid var(--primary);
    opacity: 0;
  }
  
  .splash-core .ring:nth-child(1) {
    width: 100%;
    height: 100%;
    animation: pulse-ring 2.5s ease-out infinite;
  }

  .splash-core.communicating .ring:nth-child(1) {
    animation: rotate-3d-1 2s linear infinite, pulse-ring 2.5s ease-out infinite;
  }
  
  .splash-core .ring:nth-child(2) {
    width: 80%;
    height: 80%;
    animation: pulse-ring 2.5s ease-out infinite;
  }

  .splash-core.communicating .ring:nth-child(2) {
    animation: rotate-3d-2 2.5s linear infinite, pulse-ring 2.5s ease-out infinite;
  }
  
  .splash-core .ring:nth-child(3) {
    width: 60%;
    height: 60%;
    animation: pulse-ring 2.5s ease-out infinite;
  }

  .splash-core.communicating .ring:nth-child(3) {
    animation: rotate-3d-3 3s linear infinite, pulse-ring 2.5s ease-out infinite;
  }
  
  .splash-logo {
    /* Logo scales with the core container, keeping comfortable padding */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 15px var(--primary-glow));
    border-radius: 50%;
    z-index: 10;
  }
  
  /* ==========================================================================
     13. Dynamic Results Sidebar (Left & Collapsible) — FINAL PERFECT VERSION
     ========================================================================== */
  
  .sidebar-toggle-btn {
    position: fixed;
    top: 2rem;
    left: 2rem;
    z-index: var(--z-sidebar-toggle);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }
  
  .sidebar-toggle-btn:hover,
  .sidebar-toggle-btn[aria-expanded="true"] {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 15px var(--primary-glow);
    transform: scale(1.1);
  }
  
  .sidebar-toggle-btn.hidden {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
    pointer-events: none;
  }
  
  /* Main Sidebar — Full height of viewport */
  .results-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 380px;
    max-width: 90vw;
    height: 100dvh; /* Essential: full dynamic viewport height */
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0 8px 8px 0;
    overflow: hidden;
    z-index: var(--z-sidebar);
    display: flex;
    flex-direction: column;
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.5);
    transform: translateX(calc(-100% - 3rem));
    opacity: 0;
    visibility: hidden;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.3s ease,
                visibility 0s linear 0.4s;
  }
  
  .results-sidebar.visible {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.3s ease,
                visibility 0s linear 0s;
  }
  
  /* Inner container where JS injects content */
  .results-sidebar {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
  }
  
  /* Wrapper injected by renderTaskHistory() */
  .task-history-list {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
  }
  
  /* HEADER — Fixed size, never grows */
  .task-list-header {
    position: sticky;
    top: 0;
    flex-shrink: 0;
    padding: 1rem 1.5rem 0.75rem;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    z-index: var(--z-sticky-header);
    transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
    transform: translateY(0);
    /* Optional: subtle shadow when visible */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }
  
  .task-list-header.scrolled {
    transform: translateY(-100%);
    transition: transform 0.26s cubic-bezier(0.4, 0, 0.8, 1); /* faster hide */
  }
  
  .task-list-header:not(.scrolled) {
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1); /* springy show */
  }
  
  /* If you want the classic "content slides under header" effect */
  .task-list-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 100%;
    height: 20px;
    background: linear-gradient(to bottom, rgba(15, 23, 42, 0.9), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
  }
  
  .task-list-header.scrolled::after {
    opacity: 1;
  }
  
  .task-list-header-top {
    display: flex;
    /* Changed from space-between to group back button and title together. */
    justify-content: flex-start;
    align-items: center;
    gap: 2px; /* Adds a controlled space between the button and the title. */
    margin-bottom: 0.5rem;
    position: relative;
  }
  
  .task-list-body {
    flex: 1 1 0;              /* Grow and shrink properly */
    min-height: 0;            /* REQUIRED for scroll areas inside flex */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 100px; /* Default footer space */
    transition: margin-bottom 0.3s ease-in-out, margin-top 0.38s cubic-bezier(0.22, 1, 0.36, 1);
    padding-top: 0 !important; /* Remove any old padding hacks */
  
    /* This will be dynamically set via JS */
    --header-height: 0px;
    margin-top: calc(-1 * var(--header-height));
  }
  
  /* Optional: subtle fade edge when header is hidden */
  .task-list-body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(to bottom, rgba(15, 23, 42, 0.9), transparent);
    pointer-events: none;
    opacity: 0;
    z-index: 15;
    transition: opacity 0.4s;
  }
  
  .task-list-header.scrolled + .task-list-body::before {
    opacity: 1;
  }
  
  /* Class to apply when footer is hidden */
  .task-list-body.footer-hidden {
    margin-bottom: 16px; /* Minimal space when footer hidden */
  }
  
  /* FOOTER — Fixed size, never grows */
  .task-list-footer {
    flex-shrink: 0;
    padding: 1rem 1.5rem;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 10;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    transition: 
      transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
      opacity 0.35s ease, box-shadow 0.35s ease;
  }
  
  .task-list-footer.hidden {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none; /* Prevents interaction while hidden */
  }
  
  /* Close Button */
  .sidebar-close-btn {
    position: absolute;
    top: 0;
    right: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(219, 3, 3, 0.955);
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--text-primary);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    cursor: pointer;
    transition: all 0.2s ease; 
    z-index: 1001;
  }
  
  .sidebar-close-btn:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 0 15px rgba(239,68,68,0.4);
  }
  
  /* Cards */
  .result-card,
  .history-card, /* Added for consistency */
  .log-entry {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 1rem; /* Padding is on the card, which is fine */
    margin-bottom: 1rem;
    transition: all 0.2s ease;
  }
  
  .history-card {
      background: var(--bg-card-solid); /* Ensure solid background for dashboard */
  }
  
  .result-card:hover {
    background: rgba(255,255,255,0.08);
    transform: translateY(-2px);
    border-color: rgba(255,255,255,0.12);
  }
  
  /* ==========================================================================
     RESPONSIVE — Perfect on phones, tablets, desktops
     ========================================================================== */
  
  @media (max-width: 1200px) {
    .results-sidebar {
      width: 360px;
    }
  }
  
  @media (max-width: 992px) {
    .results-sidebar {
      position: fixed;
      top: 0;
      right: -110%; /* Fully off-canvas */
      bottom: 0;
      height: 100dvh;
      width: min(85vw, 400px);
      border-radius: 0;
      border: none;
      border-left: 1px solid var(--border);
      box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
      z-index: var(--z-sidebar);
      background: rgba(15, 23, 42, 0.98);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
    }
  }
  
  @media (max-width: 768px) {
    .results-sidebar {
      width: 360px;
    }
  }
  
  @media (max-width: 768px) {
    .sidebar-toggle-btn {
      top: 1rem;
      left: 1rem;
      width: 40px;
      height: 40px;
      font-size: 1.1rem;
    }
  
    .container {
      padding: 1.5rem 1rem;
    }
  
    .settings-wrapper {
      top: 1rem;
      right: 1rem;
    }
  
    .ecosystem-dropdown {
      width: 92vw;
      right: 4px;
      max-height: 78dvh;
    }
  
    .settings-dropdown {
      width: 92vw;
      right: 4px;
      max-height: 75dvh;
    }
  
    #search-area {
      margin: 2rem auto;
      padding: 0 1rem; /* Reduced padding on tablets */
    }
  
    .input-wrapper {
      padding: 0.45rem;
      border-radius: 50px;
    }
  
    .input-actions {
      gap: 0.5rem;
      padding: 0 0.75rem;
    }
  
    .input-action-btn {
      width: 40px;
      height: 40px;
      font-size: 0.95rem;
    }
  
    #query {
      font-size: 1.05rem;
      padding: 1.1rem 0.75rem;
    }
  
    .send-btn {
      width: 52px;
      height: 52px;
      right: 6px;
    }
  
    .results-sidebar {
      width: 100vw;
      max-width: 100vw;
      border-radius: 0;
      border-left: none;
      border-right: none;
      transform: translateX(-100%);
    }
  
    .results-sidebar.visible {
      transform: translateX(0);
    }
  
    .sidebar-close-btn {
      top: 1rem;
      right: 1rem;
      width: 32px;
      height: 32px;
    }
  
    .task-list-header,
    .task-list-footer {
      padding: 1rem;
    }
  
    .task-list-body .ecosystem-list {
      padding: 0 1rem 1.5rem;
    }
  
    .modal-content {
      width: 95%;
      margin: 1rem;
    }
  
    .logs-controls {
      flex-direction: column;
      align-items: stretch;
    }
  
    .log-level-filters {
      justify-content: center;
    }
  
    .log-actions {
      justify-content: center;
    }
  
    .log-entry {
      grid-template-columns: 1fr;
      gap: 0.25rem;
    }
  
    .log-timestamp, .log-level {
      font-size: var(--text-xs);
    }
  
    .metrics-grid {
      grid-template-columns: 1fr;
    }
  
    .images-grid {
      grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
  
    .feature-notification {
      left: 1rem;
      right: 1rem;
      max-width: none;
    }
  }
  
  @media (max-width: 480px) {
    .task-list-header h2 {
      font-size: 1.25rem;
    }
  
    .sidebar-close-btn {
      top: 0.75rem;
      right: 0.75rem;
    }
  
    .modal-header, .modal-body {
      padding: 1rem;
    }
  
    .source-item {
      flex-direction: column;
      gap: 0.5rem;
    }
  
    .source-number { align-self: flex-start; }
  }
  
  /* ==========================================================================
     14. Active Research Dashboard (Live Preview)
     ========================================================================== */
  
  .feature-card {
    /* If used inside sidebar, inherited. If standalone, needs backgrounds */
    height: 100%;
    color: var(--text-primary);
  }
  
  .ai-pulse {
    position: relative;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse-green 2s infinite;
  }
  
  @keyframes pulse-green {
    0% {
      transform: scale(0.95);
      box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
  
    70% {
      transform: scale(1);
      box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }
  
    100% {
      transform: scale(0.95);
      box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
  }
  
  .pulse-animation {
    animation: pulse-green 2s infinite;
  }
  
  .agent-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
  }
  
  .text-muted-ai {
    color: rgba(255, 255, 255, 0.6) !important;
  }
  
  .research-input {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
  }
  
  /* ==========================================================================
     15. Task Item Active State
     ========================================================================== */
  
  /* Existing active state for task items */
  .task-item.active {
    background: rgba(0, 217, 192, 0.15) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 20px rgba(0, 217, 192, 0.3);
  }
  
  .task-item.active:hover {
    background: rgba(0, 217, 192, 0.2) !important;
  }
  
  /* New styles for task cards with progress stages (for the list view) */
  .task-item {
    display: flex; /* Already set by eco-item, but good to be explicit */
    align-items: center; /* Already set by eco-item */
    gap: 1rem; /* Already set by eco-item */
    padding: 1rem; /* Already set by eco-item */
    position: relative; /* For absolute positioning of meta info if needed */
    flex-direction: row; /* Ensure horizontal layout */
    text-align: left; /* Ensure text alignment is left */
  }
  
  .task-icon-wrapper {
    flex-shrink: 0;
    width: 44px; /* Match ai-pulse size */
    height: 44px; /* Match ai-pulse size */
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .task-details-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0; /* Allow content to shrink */
  }
  
  .task-topic-title { /* This is a <strong> tag, so it inherits from .eco-item strong */
    display: block;
    font-size: var(--text-base);
    font-weight: 600; /* Already set by .eco-item strong */
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .task-progress-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 100%; /* Ensure this container takes full width */
    margin-bottom: 0.25rem;
  }
  
  .task-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    position: relative; /* For positioning the text */
  }
  
  .task-progress-fill {
    height: 100%;
    background: var(--primary); /* Default progress color */
    border-radius: 4px;
    transition: width 0.3s ease-out;
    display: flex;
    align-items: center;
    justify-content: flex-start; /* Align text to the left */
  }
  
  .task-progress-stage-text {
    position: absolute;
    left: 8px; /* Padding from the left edge of the bar */
    font-size: 10px;
    font-weight: 600;
    color: #000; /* Black text for contrast on light progress bars */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 4px; /* Match bar height */
    max-width: calc(100% - 16px); /* Prevent text from overflowing the bar */
  }
  
  .task-progress-text,
  .task-status-text,
  .task-date-text {
    font-size: var(--text-xs);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .task-date-text {
    text-overflow: ellipsis;
  }

  /* Custom Button Styles for Active Task Dashboard */
  .btn-outline-border {
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
  }

  .btn-outline-border:hover {
    border-color: var(--primary);
    color: var(--primary) !important; /* Override text-muted-ai */
    background: rgba(0, 217, 192, 0.08);
    box-shadow: 0 4px 12px rgba(0, 217, 192, 0.15);
  }

  .hover-lift {
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                box-shadow 0.2s ease, 
                border-color 0.2s ease, 
                background-color 0.2s ease,
                color 0.2s ease;
  }

  .hover-lift:hover {
    transform: translateY(-2px);
  }

  .hover-lift:active {
    transform: translateY(0);
  }

  /* Override task-item styles when used on a button to prevent layout issues */
  button.task-item {
    padding: 0.5rem 1rem;
    text-align: center;
    justify-content: center;
  }
  
  /* Spin animation for in-progress icons */
  .spin {
    animation: spin 1.5s linear infinite;
  }
  
  @keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }
  
  /* Sidebar splash screen styles (for the pre-existing HTML element) */
  .sidebar-splash-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    background: var(--bg-darker); /* Ensure it covers the background */
  }
  
  .sidebar-splash-screen .ai-core {
    width: 100px;
    height: 100px;
    margin-bottom: 1.5rem;
  }
  
  .sidebar-splash-screen p {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
  }
  
  .sidebar-splash-screen span {
    font-size: var(--text-sm);
    color: var(--text-muted);
  }
  
  /* Ensure the active-task-card has proper margin when rendered */
  .active-task-card {
    margin-bottom: 2rem; /* Add some space below the active dashboard */
  }
  
  /* ==========================================================================
     16. Task Detail View Styling
     ========================================================================== */
  
  #result-detail-view {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
  }
  
  .detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
  }
  
  .back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--ease-fast);
  }
  
  .back-link:hover {
    background: var(--bg-surface-light);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateX(-2px);
  }
  
  .badge-id {
    padding: 0.375rem 0.75rem;
    background: rgba(0, 217, 192, 0.1);
    border: 1px solid var(--primary);
    border-radius: var(--radius-full);
    color: var(--primary);
    font-size: var(--text-sm);
    font-weight: 600;
  }
  
  .task-content {
    color: var(--text-primary);
    line-height: 1.8;
    font-size: var(--text-base);
  }
  
  .task-content p {
    margin-bottom: 1rem;
  }
  
  #detail-content.markdown-body {
    color: var(--text-primary);
    line-height: 1.8;
  }
  
  #detail-content.markdown-body h1,
  #detail-content.markdown-body h2,
  #detail-content.markdown-body h3 {
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
  }
  
  #detail-content.markdown-body p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
  }
  
  #detail-content.markdown-body a {
    color: var(--primary);
    text-decoration: none;
  }
  
  #detail-content.markdown-body a:hover {
    text-decoration: underline;
  }
  
  @media (max-width: 768px) {
    #result-detail-view {
      padding: 1rem 0.5rem;
    }
  
    .detail-header {
      flex-direction: row;
      align-items: flex-start;
      gap: 1rem;
    }
  }
  
  /* ==========================================================================
     17. Fixed Footer Styling
     ========================================================================== */
  
  footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    background: rgba(10, 15, 30, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 0 calc(1rem + env(safe-area-inset-bottom));
  }
  
  .footer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
  }
  
  .footer-bottom {
    text-align: center;
  }
  
  .footer-bottom p {
    margin: 0;
    color: var(--text-muted);
    font-size: var(--text-sm);
  }
  
  .footer-bottom strong {
    color: var(--text-primary);
  }
  
  .footer-particles {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    opacity: 0.3;
  }
  
  /* ==========================================================================
     18. Sidebar Pagination Controls
     ========================================================================== */
  
  .pagination-controls {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem 1.5rem;
    background: rgba(15, 23, 42, 0.85);
    /* Match sidebar background */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    z-index: 20;
  }
  
  .pagination-btn {
    /* Reusing task-filter-btn styles */
    padding: 0.5rem 1.25rem;
    /* Aligned with .task-filter-btn */
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-full);
    /* Aligned with .task-filter-btn */
    /* Slightly less rounded for buttons */
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--ease-fast);
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 36px;
    /* Ensure number buttons have a decent size */
    text-align: center;
  }
  
  .pagination-btn:hover:not([disabled]) {
    background: var(--bg-surface-light);
    border-color: var(--border-focus);
    color: var(--text-primary);
  }
  
  .pagination-btn.active {
    background: var(--primary);
    color: var(--text-inverse);
    border-color: var(--primary);
    box-shadow: var(--shadow-glow); 
  }
  
  .pagination-btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
  }
  
  
  /* ==========================================================================
     18. Authentication Card Styles (Ported from landing-page.css)
     ========================================================================== */
  
  .auth-card {
    background-color: var(--bg-surface, #1e293b) !important;
    border: 1px solid var(--border, rgba(51, 65, 85, 0.7));
    border-radius: var(--radius-xl, 1rem);
    box-shadow: var(--shadow-xl, 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1));
  }
  
  .auth-card .form-control {
    background-color: var(--bg-body, #0a0f1e);
    color: var(--text-primary, #f8fafc);
    border: 1px solid var(--border-strong, #334155);
  }
  
  .auth-card .form-control:focus {
    background-color: var(--bg-darker, #050912);
    color: var(--text-primary, #f8fafc);
    border-color: var(--primary, #00d9c0);
    box-shadow: 0 0 0 0.25rem var(--primary-glow, rgba(0, 217, 192, 0.25));
  }
  
  .auth-card .form-floating>label {
    color: var(--text-muted, #94a3b8);
  }
  
  .auth-card .btn-primary {
    background-color: var(--primary, #00d9c0);
    border-color: var(--primary, #00d9c0);
    color: var(--text-inverse, #0f172a);
  }
  
  .auth-card .btn-primary:hover {
    background-color: var(--primary-hover, #33e6d0);
    border-color: var(--primary-hover, #33e6d0);
  }
  
  .auth-card .text-accent {
    color: var(--primary, #00d9c0) !important;
    text-decoration: none;
  }
  
  .auth-card .text-accent:hover {
    text-decoration: underline;
  }
  
  .auth-card .text-secondary {
    color: var(--text-secondary, #cbd5e1) !important;
  }
  
  .auth-card .input-group-text {
    background-color: var(--bg-body, #0a0f1e);
    border: 1px solid var(--border-strong, #334155);
    color: var(--text-muted, #94a3b8);
  }
  
  .auth-card .form-check-input:checked {
    background-color: var(--primary, #00d9c0);
    border-color: var(--primary, #00d9c0);
  }


  /* Report Generator Styles (from newReport.css) */
.report-surface * {
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}

.report-surface .report {
  margin-top: 30px;
  padding: 20px;
  border-radius: 8px;
}

.report-surface .add-img-bt-center-container {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  padding: 0% !important;
  margin: 10px;
}

.report-surface .add-attach-bt-center-container {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  padding: 0% !important;
  margin: 10px;
}

.report-surface .delimg {
  margin-left: -1rem !important;
  z-index: 1;
}

.report-surface .expre_barge {
  margin-left: -1rem !important;
  margin-bottom: -1.75rem  !important;
  padding-top: 5px;
}

.report-surface .add-photo-card {
  margin-left: 0%;
  margin-right: 0%;
}

.report-surface .imgUp {
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
  height: 150px;
  width: 130px;
  justify-content: center;
  align-items: center;
  display: flex;
}

.report-surface .imgUpinput {
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
  height: 150px;
  width: 130px;
  justify-content: center;
  align-items: center;
  display: flex;
}

.report-surface .text-size-h6 {
  font-size: 1em;
  color: #2E3162;
}

.report-surface .text-size-strong {
  font-size: 0.7em;
  color: #262ec4;
}

.report-surface .text-theme {
  font-size: 0.7em;
  color: #171716;
}

.report-surface .text-size-small {
  font-size: 0.5em;
  padding-top: 0%;
  padding-bottom: 0%;
}

.report-surface .text-size-header-small {
  font-size: 0.6em;
  padding: 0%;
  padding: 0%;
}

.report-surface .report-text-size-small span {
  padding-top: 0% !important;
  padding-bottom: 0% !important;
}

.report-surface .card-body h6 {
  font-size: 0.7em;
  padding-top: 0% !important;
  padding-bottom: 0% !important;
}

.report-surface .report-table td {
  font-size: 0.6em;
  padding-top: 0%;
  padding-bottom: 0%;
  background-color: transparent !important;
}

.report-surface .report-table-td {
  float: left;
  color: #2E3162 !important;
}

.report-surface .report-p-text {
  font-size: 0.6em;
  float: left;
  color: #2E3162 !important;
}

.report-surface .text-size-Value {
  font-size: 1em;
}

.report-surface .text-Value {
  font-size: 1.1em;
  color: #f93a3a !important;
}

.report-surface .report-title {
  font-size: clamp(0.85rem, 1.6vw, 1.35rem);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #2E3162 !important;

}

.report-surface .a4-card {
  width: 210mm;
  height: 297mm;
  margin: auto;
}

.report-surface .custom-overlay {
  top: 0;
  left: 0;
  padding: 0;
  background: rgba(0, 0, 0, 0.7);
}

.report-surface .custom-overlay h5,
.report-surface .custom-overlay p {
  margin: 0;
  padding: 2px 4px;
}

.report-surface .loogbookFormCard {
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
  height: 100%;
  width: 100%;
  justify-content: center;
  align-items: center;
  display: flex;
  padding: 2px !important;
  margin: 2px !important;
}

.report-surface .valuationFormCard {
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center center;
  height: 150px;
  width: 130px;
  justify-content: center;
  align-items: center;
  display: flex;
  padding: 2px !important;
  margin: 2px !important;
}

.report-surface .timestamp-wrapper {
  position: absolute;
  bottom: 5px;
  right: 5px;
}

.report-surface .main-spinner-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  z-index: 999;
}

.report-surface .signaturePng {
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
  height: 90px;
  width: 120px;
  justify-content: center;
  align-items: center;
  display: flex;
  padding: 0%;
  margin: 0%;
  background-color: #0a0a0a;
}

.report-surface .bg-valuationPro {
  background-color: #2E3162;
}

.report-surface .imagesRow {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

.report-surface .a4-card .card-footer {
  padding: 0;
  background: linear-gradient(to right, #e5e6ee, #c5c7f1);
  color: white;
  font-family: Arial, sans-serif;
  position: relative;
}

.report-surface .a4-card .card-body {
  padding: 0;
  background-color: rgba(255, 255, 255, 0.8);
  background-color: #e5e6ee;
  font-family: Arial, sans-serif;
  position: relative;
  height: inherit;
}

.report-surface .a4-card .card-body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: var(--background-image, url('https://autovaluationpro.arybit.co.ke/app/img/aarab_logo.png'));
  background-size: contain;
  background-size: var(--background-size);
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.05;
  z-index: 1;
}

.report-surface .a4-card .card-body > * {
  position: relative;
  z-index: 2;
}

.report-surface .a4-card .card-header {
  padding: 0;
  background: linear-gradient(to right, #2E3162, #c5c7f1);
  color: white !important;
  font-family: Arial, sans-serif;
  position: relative;
}

.report-surface .qr_code {
  position: absolute;
  right: 15px;
  width: 75px;
  height: 75px;
  top: 50%;
  transform: translateY(-50%);
}

.report-surface .snackbar {
  visibility: hidden;
  min-width: 250px;
  background-color: #333;
  color: #fff;
  text-align: center;
  border-radius: 16px;
  padding: 16px;
  position: fixed;
  z-index: 9999;
  left: 50%;
  top: 90%;
  transform: translate(-50%, -90%);
  font-size: 17px;
}

.report-surface .snackbar.show {
  visibility: visible;
  animation: fadein 0.5s, fadeout 0.5s 2.5s;
}

@keyframes fadein {
  from { bottom: 0; opacity: 0; }
  to { bottom: 30px; opacity: 1; }
}

@keyframes fadeout {
  from { bottom: 30px; opacity: 1; }
  to { bottom: 0; opacity: 0; }
}

.report-surface .progress {
  color: #262ec4;
}

.report-surface .toast-body::-webkit-scrollbar {
  display: none;
}

.report-surface .toast-body {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.report-surface .progress-bar {
  background-color: #2E3162;
}

.report-surface .text-danger {
  font-size: 1rem;
  font-weight: 500;
}

.report-surface .text-muted {
  color: #ccc !important;
}

.report-surface .a4-card.pdf-generating {
  margin: 0;
  box-shadow: none !important;
  border: none !important;
  transform: none !important;
  transition: none !important;
}

/* Ensure Fancybox appears above everything including high z-index modals */
.fancybox__container {
  z-index: 10000 !important;
}
