/*
 * Dark theme. Active when <html data-theme="dark"> (the moon/sun button in the top bar, js/ui/theme.js).
 * Only colours change here: the light theme in the other stylesheets is untouched.
 * In the dark theme --primary is a light green for text, icons and links; surfaces that are filled with the brand
 * colour (buttons, the sidebar, headers) use --primary-fill so white text on them stays readable.
 */
:root[data-theme="dark"] {
  color-scheme: dark;

  --primary: #34D399;
  --primary-fill: #047857;
  --primary-dark: #065F46;
  --primary-deep: #052E24;
  --secondary: #10B981;
  --info: #38BDF8;
  --accent: #FBBF24;
  --danger: #F87171;
  --purple: #A78BFA;
  --background: #0B1512;

  --primary-soft: #133A2F;
  --secondary-soft: #123B2D;
  --info-soft: #0C2B3B;
  --accent-soft: #3A2C0E;
  --danger-soft: #3D1717;
  --purple-soft: #2B2048;

  --surface: #121D1A;
  --surface-alt: #172520;
  --border: #243731;
  --border-strong: #31493F;
  --text: #E6EEEB;
  --text-muted: #A0B2AB;
  --text-subtle: #71867E;
  --on-primary: #FFFFFF;

  --tone-success-fg: #6EE7B7;
  --tone-info-fg: #7DD3FC;
  --tone-warning-fg: #FCD34D;
  --tone-danger-fg: #FCA5A5;
  --tone-purple-fg: #C4B5FD;
  --tone-neutral-bg: #1E2C27;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  --shadow-raised: 0 8px 24px rgba(0, 0, 0, .4);
  --shadow-hover: 0 14px 34px rgba(0, 0, 0, .45), 0 0 0 1px rgba(52, 211, 153, .18);
}

/* A short cross-fade when the theme is switched. */
:root[data-theme] body, :root[data-theme] .card, :root[data-theme] .topbar, :root[data-theme] .site-header { transition: background-color .3s, color .3s, border-color .3s; }

/* ------------------------------------------------------------ surfaces filled with the brand colour */
[data-theme="dark"] .skip-link, [data-theme="dark"] .btn.filled:not(.danger), [data-theme="dark"] .icon-btn.filled,
[data-theme="dark"] .chip[aria-pressed="true"], [data-theme="dark"] .toast.success, [data-theme="dark"] .bubble-row.mine .bubble,
[data-theme="dark"] .time-box.on { background: var(--primary-fill); border-color: var(--primary-fill); color: #fff; }
[data-theme="dark"] .btn.filled:not(.danger):hover:not(:disabled) { background: var(--primary-dark); }
[data-theme="dark"] .hero, [data-theme="dark"] .now-card, [data-theme="dark"] .next-slot,
[data-theme="dark"] .auth-hero, [data-theme="dark"] .site-hero { background: linear-gradient(135deg, var(--primary-fill), var(--primary-deep)); }
[data-theme="dark"] .sidebar { background: linear-gradient(180deg, #0E2C23, #06140F); border-inline-end: 1px solid var(--border); }
[data-theme="dark"] .side-item[aria-current="page"] { background: rgba(52, 211, 153, .16); color: #A7F3D0; }
[data-theme="dark"] .side-item[aria-current="page"] .icon { color: #A7F3D0; }
@media (max-width: 760px) {
  [data-theme="dark"] .auth-page { background: linear-gradient(180deg, var(--primary-fill) 0, var(--primary-deep) 220px, var(--background) 220px); }
}

/* ------------------------------------------------------------ light-only colours in the components */
[data-theme="dark"] .btn.tonal:hover:not(:disabled), [data-theme="dark"] .site-header .login-avatar:hover { background: #1B4A3B; }
[data-theme="dark"] .card.clickable:hover { background: var(--surface-alt); }
[data-theme="dark"] .row.highlight { background-color: #143229; }
[data-theme="dark"] .input:hover { border-color: #4B6A5E; }
[data-theme="dark"] .banner.tone-danger { border-color: rgba(248, 113, 113, .35); }
[data-theme="dark"] .banner.tone-warning { border-color: rgba(251, 191, 36, .35); }
[data-theme="dark"] .banner.tone-info { border-color: rgba(56, 189, 248, .35); }
[data-theme="dark"] .banner.tone-success { border-color: rgba(52, 211, 153, .35); }
[data-theme="dark"] .juz.part { border-color: rgba(52, 211, 153, .4); }
[data-theme="dark"] .bubble { background: var(--surface-alt); }
[data-theme="dark"] .toast { background: #22332D; }
[data-theme="dark"] .toast.error { background: #7F1D1D; }
[data-theme="dark"] .card.accent-card { color: #FCD34D; }
[data-theme="dark"] .accent-text { color: #FBBF24; }
[data-theme="dark"] .bar-progress.purple::-webkit-progress-value { background: var(--purple); }
[data-theme="dark"] .bar-progress.purple::-moz-progress-bar { background: var(--purple); }
[data-theme="dark"] dialog.modal { background: var(--surface); color: var(--text); }
[data-theme="dark"] dialog.modal::backdrop, [data-theme="dark"] .drawer-backdrop { background: rgba(0, 0, 0, .6); }

/* ------------------------------------------------------------ the public site */
[data-theme="dark"] .hero2 { border-color: var(--border); background: linear-gradient(110deg, #121D1A 0%, #10241D 45%, #0F2E24 100%); }
[data-theme="dark"] .hero2 .pill { border-color: rgba(52, 211, 153, .35); }
[data-theme="dark"] .tint-green { background: #12332A; color: #6EE7B7; }
[data-theme="dark"] .tint-purple { background: #251D3D; color: #C4B5FD; }
[data-theme="dark"] .tint-orange { background: #36260F; color: #FBBF24; }
[data-theme="dark"] .tint-blue { background: #102638; color: #7DD3FC; }
[data-theme="dark"] .stat-tile .v.tone-green { color: #6EE7B7; }
[data-theme="dark"] .stat-tile .v.tone-purple { color: #C4B5FD; }
[data-theme="dark"] .stat-tile .v.tone-orange { color: #FBBF24; }
[data-theme="dark"] .stat-tile .v.tone-blue { color: #7DD3FC; }
[data-theme="dark"] .feature2 .big, [data-theme="dark"] .stat-tile .ic { background: rgba(255, 255, 255, .08) !important; }
[data-theme="dark"] .feature2 .go, [data-theme="dark"] .feature2:hover .go { background: rgba(255, 255, 255, .12); }
[data-theme="dark"] .site-footer { background: linear-gradient(180deg, var(--surface) 0%, var(--surface-alt) 100%); }

/* The theme button: the icon turns when the theme changes. */
.theme-btn .icon { transition: transform .45s cubic-bezier(.34, 1.56, .64, 1); }
.theme-btn:hover .icon { transform: rotate(-25deg) scale(1.12); }
@media (prefers-reduced-motion: reduce) { .theme-btn .icon { transition: none; } .theme-btn:hover .icon { transform: none; } }
