/*
  Portal themes a user picks in the Account menu (Theme), after eCanteen's css/ecanteen-themes.css.
  The page carries the choice on <html data-theme="...">, written by the server from the wdpps.theme cookie so it
  shows from the first paint. Default is site.css alone (today's WDPPS look): nothing here applies to it.
  Glass Dark also sets Bootstrap's data-bs-theme="dark". Text colours keep WCAG AA contrast.
*/

/* ---------- Sage Mist ---------- */
html[data-theme="sage"] {
  --wd-text: #2b2f2a;
  --wd-ink: #2b2f2a;
  --wd-muted: #5f675c;
  --wd-link: #55664f;
  --wd-page: #eceee8;
  --wd-surface: #f8f8f5;
  --wd-line: #dadcd3;
  --wd-thead: #f2f3ee;
  --wd-hover: #dfe3d8;
  --wd-add-row: #f2f3ee;
  --wd-group-row: #e3e9de;
  --wd-accent: #5e7057;
  --wd-accent-strong: #475740;
  --wd-on-accent: #ffffff;
  --wd-ring: rgba(94, 112, 87, .28);
  --wd-check: #5e7057;
  --wd-btn-bg: #f8f8f5;
  --wd-btn-ink: #3e443c;
  --wd-side: #e4e8de;
  --wd-side-ink: #2b2f2a;
  --wd-side-hover: #dfe3d8;
  --wd-side-active: #f8f8f5;
  --wd-bar: #3f4a3f;
  --wd-bar-ink: #f1f3ee;
  --wd-bar-line: #3f4a3f;
  --wd-bar-hover: rgba(241, 243, 238, .14);
  --wd-terminal-bar: #3f4a3f;
  --wd-terminal-ink: #f1f3ee;
}

/* ---------- Fog Blue ---------- */
html[data-theme="fog"] {
  --wd-text: #262c31;
  --wd-ink: #262c31;
  --wd-muted: #5b656d;
  --wd-link: #4d6678;
  --wd-page: #ebeef0;
  --wd-surface: #f8f9fa;
  --wd-line: #d8dee3;
  --wd-thead: #f1f3f5;
  --wd-hover: #dce2e7;
  --wd-add-row: #f1f3f5;
  --wd-group-row: #dfe7ec;
  --wd-accent: #557083;
  --wd-accent-strong: #3f5666;
  --wd-on-accent: #ffffff;
  --wd-ring: rgba(85, 112, 131, .28);
  --wd-check: #557083;
  --wd-btn-bg: #f8f9fa;
  --wd-btn-ink: #3a434a;
  --wd-side: #e1e6ea;
  --wd-side-ink: #262c31;
  --wd-side-hover: #dce2e7;
  --wd-side-active: #f8f9fa;
  --wd-bar: #3b4650;
  --wd-bar-ink: #eef2f5;
  --wd-bar-line: #3b4650;
  --wd-bar-hover: rgba(238, 242, 245, .14);
  --wd-terminal-bar: #3b4650;
  --wd-terminal-ink: #eef2f5;
}

/* ---------- Glass Light and Glass Dark: what both share ---------- */
html[data-theme^="glass"] body { background-attachment: fixed; }
html[data-theme^="glass"] {
  --wd-card-radius: 22px;
}
/* See-through, blurred panels: the menu, the top bar, cards, drop-downs and pop-ups */
html[data-theme^="glass"] .wd-sidebar,
html[data-theme^="glass"] .wd-header,
html[data-theme^="glass"] .wd-terminal-header,
html[data-theme^="glass"] .card,
html[data-theme^="glass"] .dropdown-menu,
html[data-theme^="glass"] .modal-content {
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
}
html[data-theme^="glass"] .card { border: 1px solid var(--wd-glass-edge); box-shadow: var(--wd-glass-shadow); }
html[data-theme^="glass"] .wd-card { border: 1px solid var(--wd-glass-edge); }
html[data-theme^="glass"] .wd-sidebar { border-right: 1px solid var(--wd-glass-edge); }
html[data-theme^="glass"] .wd-header { border-bottom-color: var(--wd-glass-edge); }
html[data-theme^="glass"] .btn-wd-solid { box-shadow: 0 4px 14px rgba(0, 113, 227, .28); }
html[data-theme^="glass"] .btn-wd-solid:focus-visible { box-shadow: 0 0 0 3px var(--wd-ring); }
/* The blur makes each card one layer: the card being worked in comes forward (drop-downs and pickers stay on top). */
html[data-theme^="glass"] .card:focus-within { position: relative; z-index: 5; }
/* Desktop: the menu floats as a card under the top bar */
@media (min-width: 992px) {
  html[data-theme^="glass"] .wd-sidebar {
    top: 12px; left: 12px; bottom: 12px;
    border: 1px solid var(--wd-glass-edge); border-radius: 20px; box-shadow: var(--wd-glass-shadow);
  }
  html[data-theme^="glass"] .wd-main { margin-left: calc(var(--wd-sidebar-width) + 24px); }
  html[data-theme^="glass"].wd-sidebar-collapsed .wd-main,
  html[data-theme^="glass"] .wd-sidebar-collapsed .wd-main { margin-left: 0; }
  html[data-theme^="glass"] .wd-sidebar-collapsed .wd-sidebar { transform: translateX(calc(-100% - 24px)); }
}

/* ---------- Glass Light ---------- */
html[data-theme="glass"] {
  --wd-text: #1d1d1f;
  --wd-ink: #1d1d1f;
  --wd-muted: #5e5e63;
  --wd-link: #0066cc;
  --wd-page: #eef1f8;
  --wd-surface: rgba(255, 255, 255, .62);
  --wd-line: rgba(0, 0, 0, .10);
  --wd-thead: rgba(255, 255, 255, .5);
  --wd-hover: rgba(0, 0, 0, .05);
  --wd-add-row: rgba(255, 255, 255, .45);
  --wd-group-row: rgba(0, 113, 227, .12);
  --wd-accent: #0071e3;
  --wd-accent-strong: #0062c4;
  --wd-on-accent: #ffffff;
  --wd-ring: rgba(0, 113, 227, .22);
  --wd-check: #0071e3;
  --wd-btn-bg: rgba(255, 255, 255, .7);
  --wd-btn-ink: #1d1d1f;
  --wd-side: rgba(255, 255, 255, .42);
  --wd-side-ink: #1d1d1f;
  --wd-side-hover: rgba(255, 255, 255, .6);
  --wd-side-active: rgba(255, 255, 255, .92);
  --wd-bar: rgba(255, 255, 255, .72);
  --wd-bar-ink: #1d1d1f;
  --wd-bar-line: rgba(255, 255, 255, .75);
  --wd-bar-hover: rgba(0, 0, 0, .06);
  --wd-terminal-bar: rgba(255, 255, 255, .72);
  --wd-terminal-ink: #1d1d1f;
  --wd-glass-edge: rgba(255, 255, 255, .75);
  --wd-glass-shadow: 0 10px 40px rgba(31, 38, 64, .10);
}
html[data-theme="glass"] body {
  background-color: #eef1f8;
  background-image:
    radial-gradient(70vw 75vh at 0% 0%, #ffc2dc 0%, rgba(255, 194, 220, .55) 35%, rgba(255, 194, 220, 0) 75%),
    radial-gradient(75vw 80vh at 100% 5%, #b4d8ff 0%, rgba(180, 216, 255, .55) 35%, rgba(180, 216, 255, 0) 75%),
    radial-gradient(70vw 75vh at 10% 100%, #bdf0d4 0%, rgba(189, 240, 212, .55) 35%, rgba(189, 240, 212, 0) 75%),
    radial-gradient(60vw 65vh at 75% 85%, #dccbff 0%, rgba(220, 203, 255, .55) 35%, rgba(220, 203, 255, 0) 75%);
}
html[data-theme="glass"] .modal-content,
html[data-theme="glass"] .dropdown-menu { --bs-dropdown-bg: rgba(255, 255, 255, .86); background-color: rgba(255, 255, 255, .86); }

/* ---------- Glass Dark ---------- */
html[data-theme="glass-dark"] {
  color-scheme: dark;
  --wd-text: #f5f5f7;
  --wd-ink: #f5f5f7;
  --wd-muted: #a1a1a6;
  --wd-required: #ff8a80;
  --wd-link: #4da3ff;
  --wd-page: #0b0b10;
  --wd-surface: rgba(30, 30, 36, .62);
  --wd-line: rgba(255, 255, 255, .12);
  --wd-thead: rgba(255, 255, 255, .05);
  --wd-hover: #2c2c34;
  --wd-add-row: rgba(255, 255, 255, .04);
  --wd-group-row: rgba(10, 132, 255, .24);
  --wd-accent: #0071e3;
  --wd-accent-strong: #4da3ff;
  --wd-on-accent: #ffffff;
  --wd-ring: rgba(77, 163, 255, .40);
  --wd-check: #0a84ff;
  --wd-btn-bg: rgba(255, 255, 255, .06);
  --wd-btn-ink: #f5f5f7;
  --wd-side: rgba(28, 28, 34, .60);
  --wd-side-ink: #f5f5f7;
  --wd-side-hover: rgba(255, 255, 255, .08);
  --wd-side-active: rgba(255, 255, 255, .12);
  --wd-bar: rgba(22, 22, 26, .72);
  --wd-bar-ink: #f5f5f7;
  --wd-bar-line: rgba(255, 255, 255, .12);
  --wd-bar-hover: rgba(255, 255, 255, .10);
  --wd-terminal-bar: rgba(22, 22, 26, .72);
  --wd-terminal-ink: #f5f5f7;
  --wd-glass-edge: rgba(255, 255, 255, .12);
  --wd-glass-shadow: 0 10px 40px rgba(0, 0, 0, .45);
}
html[data-theme="glass-dark"] body {
  background-color: #0b0b10;
  background-image:
    radial-gradient(900px 700px at 0% 0%, rgba(75, 59, 207, .55) 0%, rgba(75, 59, 207, 0) 60%),
    radial-gradient(1000px 800px at 100% 6%, rgba(14, 124, 134, .50) 0%, rgba(14, 124, 134, 0) 60%),
    radial-gradient(900px 700px at 16% 100%, rgba(142, 42, 110, .45) 0%, rgba(142, 42, 110, 0) 60%),
    radial-gradient(800px 640px at 74% 74%, rgba(31, 79, 184, .50) 0%, rgba(31, 79, 184, 0) 60%);
}
html[data-theme="glass-dark"] .modal-content,
html[data-theme="glass-dark"] .dropdown-menu { --bs-dropdown-bg: #1c1c22; background-color: #1c1c22; }
html[data-theme="glass-dark"] .form-control,
html[data-theme="glass-dark"] .form-select { background-color: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .24); color: #f5f5f7; }
html[data-theme="glass-dark"] .form-control:disabled,
html[data-theme="glass-dark"] .form-control[readonly] { background-color: #2a2a31; }
html[data-theme="glass-dark"] .badge.text-bg-light { color: #1d1d1f !important; }
html[data-theme="glass-dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
/* The logo is drawn in currentColor, so it follows --wd-side-ink / --wd-bar-ink automatically. */

@media (prefers-reduced-motion: reduce) {
  html[data-theme^="glass"] .wd-sidebar { transition: none; }
}
