/* =========================================
   LIGHT THEME (default)
========================================= */
:root,
html[data-theme="light"] {
  /* Brand constants — CMU official red: #C41230 */
  --primary-color: #C41230;
  --cmu-red: #C41230;
  --cmu-red-hover: #8b0a20;
  --cmu-red-active: #6e0819;
  --secondary-color: #6d6e71;
  --font-base: 'Open Sans', Arial, Helvetica, sans-serif;

  /* Semantic: main content area */
  --bg-page: #fff;
  --bg-surface: #fafafa;
  --bg-surface-hover: #f8f9fa;
  --text-primary: #222;
  --text-secondary: #555;
  --text-muted: #666;
  --border-color: #e5e5e5;
  --border-light: #eee;
  --border-medium: #dee2e6;

  /* Components */
  --card-bg: #fff;
  --access-box-bg: #fafafa;
  --table-row-hover: #f8f9fa;
  --link-color: var(--cmu-red);
  --link-hover-color: var(--cmu-red-hover);
  --focus-ring-color: var(--cmu-red);

  /* Components */
  --bg-card: #fff;
  --bg-footer: #2d2d2d;
  --text-on-dark: #fff;

  /* Elevation */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --radius: 6px;

  /* Status badges */
  --badge-active: #28a745;
  --badge-completed: #6c757d;
  --badge-planned: #ffc107;
  --badge-current: #007bff;

  /* Accent red: icons / text on surface backgrounds (CMU red in light mode) */
  --accent-red: #C41230;

  /* Dark-bar elements (brandbar, contact, footer — always dark) */
  --bg-dark-bar: #000;
  --bg-dark-bar-hover: #222;
  --bg-dropdown: #111;
  --bg-dropdown-hover: #222;
  --text-on-dark: #fff;
  --text-on-dark-muted: #ccc;
  --border-on-dark: #555;
  --link-on-dark: #f2717f;
  --link-on-dark-hover: #ff8a9a;

  /* File-type icon colors */
  --icon-word: #2563eb;
  --icon-zip: #2563eb;
  --icon-excel: #16a34a;
  --icon-data: #7c3aed;

  /* Badge type colors */
  --badge-type-journal: #2196F3;
  --badge-type-conference: #FF9800;
  --badge-type-book: #9C27B0;
  --badge-type-working: #607D8B;
  --badge-type-chapter: #795548;
  --badge-type-preprint: #3F51B5;
  --badge-type-thesis: #455A64;
  --badge-text-on-light: #333;

  /* Alert overrides */
  --alert-danger-bg: #f8d7da;
  --alert-danger-text: #842029;
  --alert-danger-border: #f5c2c7;

  /* Legacy aliases (backward compat) */
  --background-light: var(--bg-surface);
  --text-color: var(--text-primary);
}

/* =========================================
   DARK THEME
========================================= */
html[data-theme="dark"] {
  /* Brand stays the same — CMU official red */
  --primary-color: #C41230;
  --cmu-red: #C41230;
  --cmu-red-hover: #e0253f;
  --cmu-red-active: #ff3a57;
  --secondary-color: #6d6e71;

  /* Semantic: main content area */
  --bg-page: #1a1a1a;
  --bg-surface: #242424;
  --bg-surface-hover: #2e2e2e;
  --text-primary: #e0e0e0;
  --text-secondary: #aaa;
  --text-muted: #999;
  --border-color: #3a3a3a;
  --border-light: #333;
  --border-medium: #444;

  /* Components */
  --card-bg: #242424;
  --bg-card: #2a2a2a;
  --access-box-bg: #242424;
  --table-row-hover: #2e2e2e;
  --link-color: #f2717f;
  --link-hover-color: #ff8a9a;
  --focus-ring-color: #f2717f;
  --bg-footer: #111;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);

  /* Accent red: softer for dark backgrounds */
  --accent-red: #d94452;

  /* Dark-bar elements — in dark mode these stay dark */
  --bg-dark-bar: #000;
  --bg-dark-bar-hover: #222;
  --bg-dropdown: #111;
  --bg-dropdown-hover: #222;
  --text-on-dark: #fff;
  --text-on-dark-muted: #ccc;
  --border-on-dark: #555;

  /* File-type icon colors — softer in dark mode */
  --icon-word: #60a5fa;
  --icon-zip: #60a5fa;
  --icon-excel: #4ade80;
  --icon-data: #a78bfa;

  /* Badge type colors — softer in dark mode */
  --badge-type-journal: #64b5f6;
  --badge-type-conference: #ffb74d;
  --badge-type-book: #ce93d8;
  --badge-type-working: #90a4ae;
  --badge-type-chapter: #a1887f;
  --badge-type-preprint: #7986cb;
  --badge-type-thesis: #78909c;
  --badge-text-on-light: #e0e0e0;

  /* Alert overrides */
  --alert-danger-bg: #2c1215;
  --alert-danger-text: #f8d7da;
  --alert-danger-border: #842029;

  /* Legacy aliases */
  --background-light: var(--bg-surface);
  --text-color: var(--text-primary);
}
