/* Tab bar dimensions */
:root {
  --tab-bar-height: 80px;
  --expandable-tab-height: 80px;
  --electron-title-bar-height: 0px;
}

/* Electron desktop app: offset everything below the custom title bar */
body.electron-app {
  --electron-title-bar-height: 32px;
}

body.electron-app .MuiDrawer-paper {
  top: 0px !important;
  top: var(--electron-title-bar-height) !important;
  height: calc(100vh - 0px) !important;
  height: calc(100vh - var(--electron-title-bar-height)) !important;
}

body.electron-app .MuiModal-root {
  top: 0px !important;
  top: var(--electron-title-bar-height) !important;
}

body.electron-app main {
  margin-top: 0px !important;
  margin-top: var(--electron-title-bar-height) !important;
  min-height: calc(100vh - 0px) !important;
  min-height: calc(100vh - var(--electron-title-bar-height)) !important;
  height: calc(100vh - 0px) !important;
  height: calc(100vh - var(--electron-title-bar-height)) !important;
}

/* Fullscreen with hidden title bar: remove all offsets */
body.electron-app.electron-fullscreen {
  --electron-title-bar-height: 0px;
}

/* Mobile Browser UI Fixes */
html, body {
  /* Remove mobile browser UI colors */
  -webkit-touch-callout: none;
  
  /* Prevent mobile browser UI interference */
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
  
  /* Ensure full viewport coverage */
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  /* Black background like app */
  background-color: #fff;
  background-color: var(--bg-primary);
}

a {
  color: #667eea;
  color: var(--primary-color);
  text-decoration: none;
}

/* Safe area insets - only apply on desktop (mobile handles this in components) */
@supports (padding: max(0px)) {
  @media (min-width: 900px) {
    body {
      padding-top: env(safe-area-inset-top);
      padding-bottom: env(safe-area-inset-bottom);
      padding-left: env(safe-area-inset-left);
      padding-right: env(safe-area-inset-right);
    }
  }
}

/* CSS Variables for Theme System */
:root {
    /* Light theme variables - default theme */
    --bg-primary: #fff;
    --bg-sidebar: #1e293b;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f1f3f5;
    --bg-quaternary: #f7f8fc;
    --bg-overlay: rgba(0, 0, 0, 0.5);
    --bg-modal: rgba(0, 0, 0, 0.8);
    --text-primary: #333;
    --text-secondary: #666;
    --text-tertiary: #999;
    --text-heading: #111827;
    --text-body: #374151;
    --text-muted: #6b7280;
    --text-inverse: #ffffff;
    --border-color: rgba(0, 0, 0, 0.1);
    --border-light: #e5e7eb;
    --border-medium: #d1d5db;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.15);
    --header-bg: rgba(255, 255, 255, 0.95);
    --header-bg-scrolled: rgba(255, 255, 255, 0.98);
    --header-shadow: none;
    --header-shadow-scrolled: 0 2px 20px rgba(0, 0, 0, 0.1);
    --hero-bg: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --card-bg: #fff;
    --hover-bg: rgba(102, 126, 234, 0.1);
    --input-bg: #fff;
    --input-border: #e2e8f0;
    --input-text: #333;
    --input-placeholder: #999;
    --autofill-bg: #fff;
    --button-secondary-bg: #f9fafb;
    --button-secondary-text: #374151;
    --button-secondary-border: #d1d5db;
    
    /* Common variables (same for both themes) */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-color: #667eea;
    --primary-hover: #5a6fd6;
    --secondary-color: #6366f1;
    --secondary-hover: #5855eb;
    --info-color: #2196f3;
    --info-hover: #1976d2;
    --danger-color: #dc3545;
    --danger-hover: #dc2626;
    --error-color: #ef4444;
    --error-hover: #dc2626;
    --error-light: #fca5a5;
    --error-bg: #fee2e2;
    --error-text: #991b1b;
    --error-text-dark: #7f1d1d;
    --success-color: #28a745;
    --success-alt: #10b981;
    --success-bg: #d1fae5;
    --success-text: #065f46;
    --warning-color: #ffc107;
    --warning-alt: #f59e0b;
    --warning-bg: #fefce8;
    --warning-text: #92400e;
    --info-bg: #dbeafe;
    --info-text: #1e40af;
    --muted-text: #9e9e9e;
    --blue-text: #3b82f6;
}

/* Dark theme variables - only applied when data-theme="dark" is set */
[data-theme="dark"] {
    --bg-primary: #000000;
    --bg-sidebar: #000000;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #333333;
    --bg-quaternary: #1f1f1f;
    --bg-overlay: rgba(0, 0, 0, 0.7);
    --bg-modal: rgba(0, 0, 0, 0.9);
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-tertiary: #999999;
    --text-heading: #ffffff;
    --text-body: #e5e7eb;
    --text-muted: #9ca3af;
    --text-inverse: #1a1a1a;
    --border-color: rgba(255, 255, 255, 0.1);
    --border-light: rgba(255, 255, 255, 0.15);
    --border-medium: rgba(255, 255, 255, 0.2);
    --shadow-color: rgba(0, 0, 0, 0.3);
    --shadow-medium: rgba(0, 0, 0, 0.5);
    --header-bg: rgba(26, 26, 26, 0.95);
    --header-bg-scrolled: rgba(26, 26, 26, 0.98);
    --header-shadow: none;
    --header-shadow-scrolled: 0 2px 20px rgba(0, 0, 0, 0.3);
    --hero-bg: linear-gradient(135deg, #1f1f1f 0%, #2d2d2d 100%);
    --card-bg: #2d2d2d;
    --hover-bg: rgba(102, 126, 234, 0.2);
    --input-bg: #2d2d2d;
    --input-border: #404040;
    --input-text: #ffffff;
    --input-placeholder: #666666;
    --autofill-bg: #1E1E1E;
    --button-secondary-bg: #374151;
    --button-secondary-text: #e5e7eb;
    --button-secondary-border: #4b5563;
    
    /* Dark mode specific alert/status colors */
    --info-bg: rgba(59, 130, 246, 0.1);
    --info-text: #60a5fa;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --warning-text: #fbbf24;
    --error-bg: rgba(239, 68, 68, 0.1);
    --error-text: #f87171;
    --success-bg: rgba(34, 197, 94, 0.1);
    --success-text: #4ade80;
}

/* System dark mode - only applied when no data-theme attribute is set */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --bg-primary: #000000;
        --bg-secondary: #2d2d2d;
        --bg-tertiary: #333333;
        --bg-quaternary: #1f1f1f;
        --bg-overlay: rgba(0, 0, 0, 0.7);
        --bg-modal: rgba(0, 0, 0, 0.9);
        --text-primary: #ffffff;
        --text-secondary: #cccccc;
        --text-tertiary: #999999;
        --text-heading: #ffffff;
        --text-body: #e5e7eb;
        --text-muted: #9ca3af;
        --text-inverse: #1a1a1a;
        --border-color: rgba(255, 255, 255, 0.1);
        --border-light: rgba(255, 255, 255, 0.15);
        --border-medium: rgba(255, 255, 255, 0.2);
        --shadow-color: rgba(0, 0, 0, 0.3);
        --shadow-medium: rgba(0, 0, 0, 0.5);
        --header-bg: rgba(26, 26, 26, 0.95);
        --header-bg-scrolled: rgba(26, 26, 26, 0.98);
        --header-shadow: none;
        --header-shadow-scrolled: 0 2px 20px rgba(0, 0, 0, 0.3);
        --hero-bg: linear-gradient(135deg, #1f1f1f 0%, #2d2d2d 100%);
        --card-bg: #2d2d2d;
        --hover-bg: rgba(102, 126, 234, 0.2);
        --input-bg: #2d2d2d;
        --input-border: #404040;
        --input-text: #ffffff;
        --input-placeholder: #666666;
        --autofill-bg: #1E1E1E;
        --button-secondary-bg: #374151;
        --button-secondary-text: #e5e7eb;
        --button-secondary-border: #4b5563;
        
        /* Dark mode specific alert/status colors */
        --info-bg: rgba(59, 130, 246, 0.1);
        --info-text: #60a5fa;
        --warning-bg: rgba(245, 158, 11, 0.1);
        --warning-text: #fbbf24;
        --error-bg: rgba(239, 68, 68, 0.1);
        --error-text: #f87171;
        --success-bg: rgba(34, 197, 94, 0.1);
        --success-text: #4ade80;
    }
}

/* Force light theme when explicitly set */
[data-theme="light"] {
    --bg-primary: #fff !important;
    --bg-secondary: #f8f9fa !important;
    --bg-tertiary: #f1f3f5 !important;
    --bg-quaternary: #f7f8fc !important;
    --bg-overlay: rgba(0, 0, 0, 0.5) !important;
    --bg-modal: rgba(0, 0, 0, 0.8) !important;
    --text-primary: #333 !important;
    --text-secondary: #666 !important;
    --text-tertiary: #999 !important;
    --text-heading: #111827 !important;
    --text-body: #374151 !important;
    --text-muted: #6b7280 !important;
    --text-inverse: #ffffff !important;
    --border-color: rgba(0, 0, 0, 0.1) !important;
    --border-light: #e5e7eb !important;
    --border-medium: #d1d5db !important;
    --shadow-color: rgba(0, 0, 0, 0.1) !important;
    --shadow-medium: rgba(0, 0, 0, 0.15) !important;
    --header-bg: rgba(255, 255, 255, 0.95) !important;
    --header-bg-scrolled: rgba(255, 255, 255, 0.98) !important;
    --header-shadow: none !important;
    --header-shadow-scrolled: 0 2px 20px rgba(0, 0, 0, 0.1) !important;
    --hero-bg: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%) !important;
    --card-bg: #fff !important;
    --hover-bg: rgba(102, 126, 234, 0.1) !important;
    --input-bg: #fff !important;
    --input-border: #e2e8f0 !important;
    --input-text: #333 !important;
    --input-placeholder: #999 !important;
    --button-secondary-bg: #f9fafb !important;
    --button-secondary-text: #374151 !important;
    --button-secondary-border: #d1d5db !important;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Better touch scrolling on mobile */
  -webkit-overflow-scrolling: touch;
  /* Prevent horizontal scrolling */
  overflow-x: hidden;
  /* Improve touch scrolling on mobile */
  touch-action: manipulation;
  /* Use theme variables - pure black background like app */
  background-color: #fff;
  background-color: var(--bg-primary);
  color: #333;
  color: var(--text-primary);
}

/* Ensure html element also has black background */
html {
  background-color: #fff;
  background-color: var(--bg-primary);
}

code {
  font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
    monospace;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  
  /* Better tap highlighting */
  * {
    -webkit-tap-highlight-color: rgba(102, 126, 234, 0.1);
  }
  
  /* Prevent zoom on input focus */
  input, 
  textarea, 
  select {
    font-size: 16px !important;
  }
  
  /* Smooth scrolling */
  html {
    scroll-behavior: smooth;
    /* Enable proper touch scrolling */
    -webkit-overflow-scrolling: touch;
    touch-action: manipulation;
  }
  
  /* Optimize text rendering on mobile */
  body {
    text-rendering: optimizeLegibility;
    -webkit-text-size-adjust: 100%;
    /* Prevent body-level scrolling - components handle their own scroll */
    overflow: hidden;
    /* Fix momentum scrolling issues */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  
  /* Note: removed wildcard * { overscroll-behavior: contain } — it broke scroll on Android Chrome.
     Body already has overscroll-behavior: contain (line 327) which is sufficient. */
  
  /* Fix Material-UI components for mobile scrolling */
  .MuiDialog-paper,
  .MuiModal-root,
  .MuiDrawer-paper {
    touch-action: pan-y pan-x;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  
}

/* Tablet optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
  /* Slightly larger touch targets for tablets */
  
  /* Ensure proper touch scrolling on tablets */
  html, body {
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y pan-x;
  }
  
  /* Fix Material-UI components for tablet scrolling */
  .MuiDialog-paper,
  .MuiModal-root,
  .MuiDrawer-paper {
    touch-action: pan-y pan-x;
    -webkit-overflow-scrolling: touch;
  }
  
}

/* Prevent text selection on UI elements */
.MuiButton-root,
.MuiIconButton-root,
.MuiListItemButton-root {
  -webkit-user-select: none;
  user-select: none;
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(102, 126, 234, 0.2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(102, 126, 234, 0.3);
}

/* Hide scrollbar on mobile for cleaner look */
@media (max-width: 768px) {
  ::-webkit-scrollbar {
    width: 0px;
    background: transparent;
  }
}

/* Ensure proper viewport on mobile */
@viewport {
  width: device-width;
  initial-scale: 1;
  maximum-scale: 5;
  user-scalable: yes;
}

/* Focus styles for accessibility */
*:focus {
  outline: 2px solid rgba(102, 126, 234, 0.5);
  outline-offset: 2px;
}

/* Remove default focus outline on mouse users */
.js-focus-visible *:focus:not(.focus-visible) {
  outline: none;
}

/* Material-UI specific mobile optimizations */
.MuiDrawer-paper {
  /* Prevent momentum scrolling issues on iOS */
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y pan-x;
}

/* Improve modal backdrop on mobile */
.MuiModal-backdrop {
  /* Prevent body scroll when modal is open */
  -webkit-overflow-scrolling: auto;
  touch-action: pan-y pan-x;
}

/* Global scrolling fixes for React components */
.MuiBox-root,
.MuiContainer-root,
.MuiPaper-root {
  -webkit-overflow-scrolling: touch;
}

/* Better menu positioning on mobile */
@media (max-width: 768px) {
  .MuiMenu-paper {
    max-height: 70vh !important;
    margin: 8px !important;
  }
  
  .MuiPopover-paper {
    max-width: calc(100vw - 32px) !important;
    margin: 16px !important;
  }
}

/* Shared Loading Spinner Animation */
@keyframes loading-spin {
  to { transform: rotate(360deg); }
}

/* Math copy tooltip animation */
@keyframes mathTooltipFadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(4px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* CAPTCHA Badge Animation */
@keyframes captchaBadgeSlideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Mobile Kanban Layout - Remove all padding for full width */
@media (max-width: 899px) {
  /* Override safe area insets for Kanban mobile layout */
  .kanban-mobile-layout {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin: 0 !important;
  }
  
  /* Ensure full width for mobile Kanban */
  .kanban-mobile-layout .MuiContainer-root {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
}

/* Disable drawer animations for instant open/close - MOBILE ONLY */
@media (max-width: 899px) {
  .MuiDrawer-root,
  .MuiSwipeableDrawer-root,
  .MuiDrawer-paper,
  .MuiSwipeableDrawer-paper {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  /* Disable drawer backdrop animations on mobile */
  .MuiDrawer-root .MuiBackdrop-root,
  .MuiSwipeableDrawer-root .MuiBackdrop-root {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  /* Disable drawer content animations on mobile */
  .MuiDrawer-paper *,
  .MuiSwipeableDrawer-paper * {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  /* Disable all drawer transition states on mobile */
  .MuiDrawer-paperAnchorLeft,
  .MuiSwipeableDrawer-paperAnchorLeft,
  .MuiDrawer-paperAnchorLeft-enter,
  .MuiDrawer-paperAnchorLeft-enterActive,
  .MuiDrawer-paperAnchorLeft-exit,
  .MuiDrawer-paperAnchorLeft-exitActive,
  .MuiSwipeableDrawer-paperAnchorLeft-enter,
  .MuiSwipeableDrawer-paperAnchorLeft-enterActive,
  .MuiSwipeableDrawer-paperAnchorLeft-exit,
  .MuiSwipeableDrawer-paperAnchorLeft-exitActive {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  /* CRITICAL: Force instant close by disabling all possible close animations */
  .MuiDrawer-root[aria-hidden="true"],
  .MuiSwipeableDrawer-root[aria-hidden="true"],
  .MuiDrawer-paper[aria-hidden="true"],
  .MuiSwipeableDrawer-paper[aria-hidden="true"] {
    transition: none !important;
    animation: none !important;
    transform: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
  }

  /* Force instant close for backdrop */
  .MuiDrawer-root[aria-hidden="true"] .MuiBackdrop-root,
  .MuiSwipeableDrawer-root[aria-hidden="true"] .MuiBackdrop-root {
    transition: none !important;
    animation: none !important;
    transform: none !important;
    opacity: 0 !important;
  }
}

/* ===== MOBILE BOTTOM TAB BAR STYLES ===== */
@media (max-width: 899px) {
  /* Ensure body accounts for bottom tab bar */
  body {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* Bottom tab bar container */
  .bottom-tab-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(80px + env(safe-area-inset-bottom, 0px));
    height: calc(var(--tab-bar-height) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    z-index: 1301;
    display: flex;
    align-items: center;
    justify-content: space-around;
  }

  /* Tab item styling */
  .bottom-tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1 1;
    height: 100%;
    cursor: pointer;
    padding: 8px 4px;
    border-radius: 12px;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .bottom-tab-item:active {
    transform: scale(0.95);
  }

  /* More button special styling */
  .bottom-tab-more-button {
    min-width: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .bottom-tab-more-button .more-icon-wrapper {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
  }

  .bottom-tab-more-button.expanded .more-icon-wrapper {
    transform: rotate(45deg);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  }

  /* Expandable area */
  .expandable-tab-area {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    bottom: calc(var(--tab-bar-height) + env(safe-area-inset-bottom, 0px));
    z-index: 1300;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Drag handle for expandable area */
  .expandable-drag-handle {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    margin: 12px auto 8px;
  }

  /* Tab grid in expandable area */
  .expandable-tab-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 12px;
    gap: 12px;
    padding: 16px 12px 24px;
  }

  /* Individual expandable tab */
  .expandable-tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .expandable-tab-item:active {
    transform: scale(0.95);
  }

  .expandable-tab-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 2px solid #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  }

  /* Usage display bar in expandable area */
  .usage-display-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
  }

  /* Hide desktop sidebar elements on mobile */
  .desktop-sidebar-only {
    display: none !important;
  }
}

/* Desktop - hide mobile bottom tab bar */
@media (min-width: 900px) {
  .mobile-bottom-tabs-only {
    display: none !important;
  }
}

/* ===== PANEL RESIZE DRAG — disable transitions globally ===== */
body.panel-resizing {
  -webkit-user-select: none !important;
          user-select: none !important;
  cursor: col-resize !important;
}
body.panel-resizing * {
  transition: none !important;
}
body.panel-resizing .divider-indicator {
  opacity: 1 !important;
}
/* Contain sidebar Paper layout during drag so internal reflow of MUI nav items
   doesn't affect the rest of the page's layout budget. */
body.panel-resizing .MuiDrawer-paper {
  contain: content !important;
}
body.panel-resizing [data-sidebar-dependent] {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
/* Suppress expensive box-shadow repaints on sub-panels during drag */
body.panel-resizing [data-sidebar-dependent="left-panel"],
body.panel-resizing [data-sidebar-dependent="left-panel"] > * {
  box-shadow: none !important;
}
/* During drag, contain layout on main tool containers so layout changes
   don't propagate to parent or siblings. will-change promotes to own
   compositor layer for cheaper repositioning. */
body.panel-resizing [data-sidebar-dependent="left"] {
  contain: layout style !important;
  will-change: left, width !important;
}
/* Kanban board view needs right changes during split view / settings drag — disable containment */
body.panel-resizing [data-kanban-board-view] {
  contain: none !important;
  will-change: left, right !important;
}
body.panel-resizing [data-sidebar-dependent="left-panel"] {
  contain: layout style !important;
  will-change: left !important;
}
body.panel-resizing [data-sidebar-dependent="left-divider"] {
  contain: layout style !important;
  will-change: left !important;
}
/* Contain split view panel internals during drag so content reflow
   doesn't cascade when the panel width changes. */
body.panel-resizing [id^="split-view-panel-"] {
  contain: strict !important;
}

/* ===== FIX: Vertical centering for small outlined inputs (search bars etc.) =====
   MUI's CSS-in-JS injects component styles after theme overrides when lazy-loaded
   components mount, breaking specificity. This CSS rule has consistent specificity. */
.MuiOutlinedInput-root.MuiInputBase-sizeSmall .MuiOutlinedInput-input.MuiInputBase-inputSizeSmall {
  padding-top: 8.5px;
  padding-bottom: 8.5px;
  line-height: 1.4375em;
}

/* ===== DRAG OPTIMIZED — reduce paint cost during resize (test8) ===== */
body.drag-optimized * {
  box-shadow: none !important;
  border-radius: 0 !important;
  transition: none !important;
}

/* ===== NAV DRAGGING — global grabbing cursor during sidebar drag ===== */
body.nav-dragging,
body.nav-dragging * {
  cursor: grabbing !important;
}

/* ===== VAUL DRAWER FIXES ===== */
/* Hide the black ::after pseudo-element that Vaul adds below the drawer */
[vaul-drawer]::after,
[data-vaul-drawer]::after,
[vaul-drawer-wrapper]::after {
  display: none !important;
  content: none !important;
  background: transparent !important;
} 
/* Cookie Overlay - Blocks all interactions */
.cookie-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100000;
    -webkit-backdrop-filter: blur(2px);
            backdrop-filter: blur(2px);
    pointer-events: all;
}

/* Cookie Popup Styles - Modern Design */
.cookie-popup {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--shadow-color);
    z-index: 100001;
    max-width: 95%;
    width: 800px;
    max-height: 90vh;
    border: 1px solid var(--border-light);
    overflow: hidden;
    display: none;
    flex-direction: column;
}

/* When settings are open, ensure popup can accommodate scrolling */
.cookie-popup.settings-open {
    max-height: 90vh;
}

/* Cookie Content */
.cookie-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Cookie Header */
.cookie-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.cookie-icon {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.cookie-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-heading);
}

.cookie-description {
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

/* Read Policy Link Button */
.cookie-btn-link {
    background: transparent;
    color: var(--primary-color);
    padding: 0.5rem 0;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.cookie-btn-link:hover {
    color: var(--primary-color);
    color: var(--primary-hover, var(--primary-color));
    text-decoration: underline;
}

.cookie-btn-link svg {
    width: 16px;
    height: 16px;
}

/* Cookie Policy Content */
.cookie-policy-content {
    max-height: 55vh;
    overflow: hidden;
    padding: 0;
    margin-bottom: 1.5rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

/* Cookie Policy Iframe */
.cookie-policy-iframe {
    width: 100%;
    height: 55vh;
    border: none;
    display: block;
    background: transparent;
}

.cookie-policy-content::-webkit-scrollbar {
    width: 8px;
}

.cookie-policy-content::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}

.cookie-policy-content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
    opacity: 0.5;
}

.cookie-policy-content::-webkit-scrollbar-thumb:hover {
    opacity: 0.8;
}

/* Policy Sections */
.policy-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.policy-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.policy-section h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-heading);
    margin: 0 0 0.75rem 0;
}

.policy-section p {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0 0 0.75rem 0;
}

.policy-section p:last-child {
    margin-bottom: 0;
}

.policy-section strong {
    color: var(--text-primary);
}

/* Cookie Buttons */
.cookie-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.cookie-btn {
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.cookie-btn-primary {
    background: var(--primary-gradient);
    color: #ffffff;
}

@media (hover: hover) {
  .cookie-btn-primary:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  }
}

.cookie-btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-light);
}

.cookie-btn-secondary:hover {
    background: var(--hover-bg);
    border-color: var(--primary-color);
}

.cookie-btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 2px solid var(--border-light);
}

.cookie-btn-outline:hover {
    background: var(--hover-bg);
    border-color: var(--primary-color);
}

/* Hide Accept All and Decline All buttons when settings are open (all screen sizes) */
.cookie-popup.settings-open .cookie-buttons .cookie-btn-accept,
.cookie-popup.settings-open .cookie-buttons .cookie-btn-decline {
    display: none;
}

/* Settings Panel */
.cookie-settings-panel {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-light);
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1;
    min-height: 0;
    display: none;
    /* Smooth scrolling for better UX */
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    /* Better scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
}

.cookie-settings-panel.open {
    display: block;
}

/* Custom scrollbar for webkit browsers */
.cookie-settings-panel::-webkit-scrollbar {
    width: 8px;
}

.cookie-settings-panel::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}

.cookie-settings-panel::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
    opacity: 0.5;
}

.cookie-settings-panel::-webkit-scrollbar-thumb:hover {
    opacity: 0.8;
}

.cookie-settings-content h4 {
    margin: 0 0 1.5rem 0;
    font-size: 1.1rem;
    color: var(--text-heading);
}

/* Cookie Categories */
.cookie-category {
    margin-bottom: 1.25rem;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

.cookie-category:last-child {
    margin-bottom: 0;
}

.cookie-category-header {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
}

.cookie-category-info {
    flex: 1 1;
    min-width: 0; /* Prevents text overflow */
}

.cookie-category-info strong {
    display: block;
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.cookie-category-info p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    word-wrap: break-word;
}

/* Toggle Switch */
.cookie-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    margin-top: 2px;
    flex-shrink: 0; /* Prevents shrinking */
}

.cookie-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cookie-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-light);
    transition: 0.3s;
    border-radius: 28px;
}

.cookie-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.cookie-switch input:checked + .cookie-slider {
    background-color: var(--primary-color);
}

.cookie-switch input:focus + .cookie-slider {
    box-shadow: 0 0 1px var(--primary-color);
}

.cookie-switch input:checked + .cookie-slider:before {
    transform: translateX(22px);
}

.cookie-switch input:disabled + .cookie-slider {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Animations */
.cookie-popup.cookie-popup-show {
    display: flex;
    animation: slideUp 0.3s ease-out;
}

.cookie-popup.cookie-popup-hide {
    animation: slideDown 0.3s ease-in;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
    to {
        transform: translateX(-50%) translateY(100%);
        opacity: 0;
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .cookie-popup {
        width: 95%;
        bottom: 10px;
        max-height: 90vh;
    }

    .cookie-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }

    .cookie-btn {
        width: 100%;
        justify-content: center;
    }

    .cookie-settings-panel {
        max-height: 50vh;
        padding: 1rem;
    }

    .cookie-category-header {
        gap: 1rem;
    }

    .cookie-category {
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    .cookie-popup {
        bottom: 0;
        left: 0;
        right: 0;
        transform: none;
        width: 100%;
        max-width: 100%;
        border-radius: 12px 12px 0 0;
    }

    .cookie-popup.cookie-popup-show {
        animation: slideUpMobile 0.3s ease-out;
    }

    .cookie-popup.cookie-popup-hide {
        animation: slideDownMobile 0.3s ease-in;
    }

    @keyframes slideUpMobile {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    @keyframes slideDownMobile {
        from {
            transform: translateY(0);
            opacity: 1;
        }
        to {
            transform: translateY(100%);
            opacity: 0;
        }
    }

    .cookie-content {
        padding: 1.25rem;
    }

    .cookie-header {
        margin-bottom: 0.75rem;
    }

    .cookie-description {
        margin-bottom: 1.25rem;
        font-size: 0.9rem;
    }

    .cookie-settings-panel {
        padding: 1rem;
        max-height: 50vh;
        /* Ensure smooth touch scrolling on mobile */
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .cookie-category {
        padding: 0.75rem;
        margin-bottom: 1rem;
    }

    .cookie-category-header {
        gap: 0.75rem;
    }
}

.tier-limit-progress-bar {
  margin-bottom: 16px;
}

.tier-limit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.tier-limit-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.tier-limit-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.progress-bar-bg {
  height: 8px;
  border-radius: 4px;
  background-color: var(--border-color);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-bar-fill.low {
  background-color: #10B981; /* Green */
}

.progress-bar-fill.medium {
  background-color: #F59E0B; /* Orange/Yellow */
}

.progress-bar-fill.high {
  background-color: #EF4444; /* Red */
}

.progress-bar-fill.unlimited {
  background-color: var(--primary-color); /* Blue */
}

.unlimited-bar {
  height: 8px;
  border-radius: 4px;
  opacity: 0.3;
}

.unlimited-bar.unlimited {
  background-color: var(--primary-color);
}

.display-value {
  color: var(--primary-color);
  display: flex;
  align-items: center;
  gap: 4px;
}

.display-icon {
  font-size: 16px;
  display: flex;
  align-items: center;
}

.reset-info {
  font-size: 12px;
  margin-top: 4px;
  font-style: italic;
  color: var(--text-secondary);
}

.context-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  padding: 20px;
}

.context-dialog {
  background-color: #1e1e1e;
  background-color: var(--bg-primary, #1e1e1e);
  border-radius: 16px;
  max-width: 550px;
  width: 100%;
  height: 85vh;
  max-height: 85vh;
  transition: max-width 0.25s ease;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.context-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border-color);
}

.context-dialog-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.context-dialog-close {
  background: none;
  border: none;
  font-size: 32px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s;
}

.context-dialog-close:hover {
  background-color: var(--hover-bg);
  color: var(--text-primary);
}

.context-header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.context-dialog-content {
  padding: 20px 24px 24px;
  overflow-y: auto;
  flex: 1 1;
}

/* Loading State */
.context-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
}


.context-loading p {
  color: var(--text-secondary);
  margin: 0;
}

/* Global Toggle */
.context-global-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.15));
  border: 1px solid rgba(102, 126, 234, 0.3);
  border-radius: 12px;
}

.context-global-toggle-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.context-global-toggle-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.context-global-toggle-status {
  font-size: 12px;
  color: #667eea;
  color: var(--primary-color, #667eea);
  font-weight: 500;
}

/* Header Info */
.context-header-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.context-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.context-status-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 4px 0;
}

.context-status-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-color);
  margin: 0;
}

.context-status-size {
  display: inline-block;
  font-size: 14px;
  font-weight: 600;
  color: #667eea;
  color: var(--primary-color, #667eea);
  margin: 6px 0 0 0;
  padding: 4px 12px;
  background-color: rgba(102, 126, 234, 0.12);
  border-radius: 6px;
}

.context-description {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 20px 0;
  line-height: 1.5;
}

/* Tool Cards */
.context-tools-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.context-tool-card {
  background-color: rgba(255, 255, 255, 0.05);
  background-color: var(--card-bg, rgba(255, 255, 255, 0.05));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.context-tool-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  border-color: var(--border-hover, rgba(255, 255, 255, 0.2));
}


.context-tool-card.disabled {
  opacity: 0.6;
}

.context-tool-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
  gap: 12px;
}

.context-tool-card.disabled .context-tool-header {
  cursor: default;
}

.context-tool-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #667eea;
  color: var(--primary-color, #667eea);
}

.context-tool-icon svg {
  font-size: 22px;
}

.context-tool-info {
  flex: 1 1;
  min-width: 0;
}

.context-tool-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.context-tool-summary {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.context-tool-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
}

.context-tool-time {
  font-size: 13px;
  color: var(--text-secondary);
}

.context-tool-size {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 2px 8px;
  background-color: rgba(102, 126, 234, 0.12);
  border-radius: 4px;
}

/* Expanded Preview */
.context-tool-preview {
  padding: 0 16px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  margin-top: 0;
  padding-top: 12px;
}

.context-images-preview {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.context-image-thumbnail {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}

.context-image-thumbnail:hover {
  transform: scale(1.05);
  border-color: #667eea;
  border-color: var(--primary-color, #667eea);
}

.context-images-more {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  background-color: rgba(102, 126, 234, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #667eea;
  color: var(--primary-color, #667eea);
}

.context-text-preview {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
  background-color: rgba(0, 0, 0, 0.2);
  background-color: var(--bg-tertiary, rgba(0, 0, 0, 0.2));
  padding: 12px;
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
}

/* Empty State */
.context-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.context-empty-icon {
  font-size: 48px;
  margin: 0 0 12px 0;
}

.context-empty-text {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  max-width: 280px;
  line-height: 1.5;
}

/* Detail View Header */
.context-detail-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.context-back-button {
  color: var(--text-secondary);
}

.context-back-button:hover {
  color: var(--text-primary);
  background-color: var(--hover-bg);
}

/* Detail View Content */
.context-detail-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.context-detail-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background-color: rgba(255, 255, 255, 0.05);
  background-color: var(--card-bg, rgba(255, 255, 255, 0.05));
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
}

.context-detail-meta-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.context-detail-meta-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.context-detail-status {
  font-size: 13px;
  font-weight: 600;
  color: #667eea;
  color: var(--primary-color, #667eea);
  padding: 4px 10px;
  background-color: rgba(102, 126, 234, 0.15);
  border-radius: 6px;
}

.context-detail-time {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  color: var(--text-muted, rgba(255, 255, 255, 0.4));
}

.context-detail-size {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 3px 10px;
  background-color: rgba(102, 126, 234, 0.12);
  border-radius: 5px;
}

/* Detail Sections */
.context-detail-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.context-detail-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
}

.context-detail-images {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.context-detail-image-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.context-detail-image-label {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-detail-image {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}

.context-detail-image:hover {
  transform: scale(1.02);
  border-color: #667eea;
  border-color: var(--primary-color, #667eea);
}

/* Fullscreen image overlay */
.context-image-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  cursor: pointer;
  padding: 24px;
}

.context-image-overlay-img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  border-radius: 8px;
  cursor: default;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.context-detail-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  background-color: rgba(0, 0, 0, 0.2);
  background-color: var(--bg-tertiary, rgba(0, 0, 0, 0.2));
  padding: 16px;
  border-radius: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-y: auto;
}

.context-detail-summary {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: rgba(102, 126, 234, 0.1);
  padding: 16px;
  border-radius: 10px;
  border: 1px solid rgba(102, 126, 234, 0.2);
}

/* ===== DETAIL MODE - WIDER ON DESKTOP ===== */
.context-dialog.detail-mode {
  max-width: 80vw;
}

.context-dialog.detail-mode .context-dialog-header {
  padding: 20px 24px 16px;
}

.context-dialog.detail-mode .context-dialog-content {
  padding: 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

/* Larger images in fullscreen detail mode */
.context-dialog.detail-mode .context-detail-image {
  width: 180px;
  height: 180px;
}

/* Larger text in fullscreen detail mode */
.context-dialog.detail-mode .context-detail-text {
  font-size: 15px;
  line-height: 1.7;
  max-height: none;
  padding: 20px;
}

.context-dialog.detail-mode .context-detail-summary {
  font-size: 16px;
  line-height: 1.7;
  padding: 20px;
}

.context-dialog.detail-mode .context-detail-section-title {
  font-size: 16px;
  padding-bottom: 12px;
  margin-bottom: 4px;
}

.context-dialog.detail-mode .context-detail-meta {
  padding: 16px 20px;
}

.context-dialog.detail-mode .context-detail-content {
  gap: 28px;
}

/* Responsive - Mobile Fullscreen */
@media (max-width: 899px) {
  .context-dialog-overlay {
    padding: 0;
    align-items: stretch;
  }

  .context-dialog {
    max-width: 100%;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    margin: 0;
  }

  .context-dialog-header {
    padding: 20px 16px 12px;
  }

  .context-dialog-title {
    font-size: 20px;
  }

  .context-dialog-content {
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .context-tool-header {
    padding: 12px 14px;
  }

  .context-tool-icon {
    width: 36px;
    height: 36px;
  }

  .context-tool-icon svg {
    font-size: 20px;
  }
}

