/* TipsHarvester "Modern" UI style.
 * Active only while <html> has class "ui-modern" (set by theme-toggle.js).
 * Classic (no class) keeps the original look and its colour shades untouched.
 * Unlayered rules: they win over Tailwind's layered utilities on purpose. */

html.ui-modern,
html.ui-modern[data-theme] {
  color-scheme: dark;
  --font-sans: "Plus Jakarta Sans", "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;

  --color-bg: #070912;
  --color-surface: #0f1224;
  --color-surface-raised: #171b33;
  --color-border: #252a4a;
  --color-text: #eef0fb;
  --color-text-dim: #9097bd;
  --color-accent: #8b7bff;
  --color-accent-dim: #5f4ee0;
  --color-warn: #fbbf24;
  --color-danger: #fb7185;
  --color-info: #38bdf8;

  /* hard-coded slate/gray/zinc panels follow the same indigo-tinted neutrals */
  --color-slate-50: #f6f7fd;  --color-slate-100: #eceefa; --color-slate-200: #d7daf0;
  --color-slate-300: #b8bde0; --color-slate-400: #9097bd; --color-slate-500: #6d7399;
  --color-slate-600: #4b5178; --color-slate-700: #323760; --color-slate-800: #1d2140;
  --color-slate-900: #12152b; --color-slate-950: #0a0c1a;
  --color-gray-800: #1d2140;  --color-gray-900: #12152b;
  --color-zinc-800: #1d2140;  --color-zinc-900: #12152b;

  --radius-sm: .375rem;
  --radius-md: .625rem;
  --radius-lg: .875rem;
  --radius-xl: 1.125rem;
  --radius-2xl: 1.5rem;

  --th-grad: linear-gradient(135deg, #8b7bff 0%, #5eead4 100%);
  --th-glow: 0 0 0 1px rgba(139, 123, 255, .35), 0 8px 30px -8px rgba(139, 123, 255, .45);
  --th-card-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 12px 32px -18px rgba(0, 0, 0, .8);
}

/* ── page background: soft colour mesh behind everything ── */
html.ui-modern body {
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(139, 123, 255, .16), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(94, 234, 212, .10), transparent 60%),
    var(--color-bg);
  background-attachment: fixed;
  letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased;
}
html.ui-modern .min-h-screen.bg-bg { background-color: transparent; }

/* ── cards & panels ── */
html.ui-modern .rounded { border-radius: var(--radius-md); }
html.ui-modern .bg-surface,
html.ui-modern .bg-surface-raised {
  box-shadow: var(--th-card-shadow);
}
html.ui-modern .bg-surface:where(.border),
html.ui-modern .bg-surface-raised:where(.border) {
  border-color: color-mix(in oklab, var(--color-border) 80%, #8b7bff 20%);
}
html.ui-modern .rounded-lg.border:hover,
html.ui-modern .rounded-xl.border:hover {
  border-color: color-mix(in oklab, var(--color-border) 55%, #8b7bff 45%);
  transition: border-color .2s ease, box-shadow .2s ease;
}

/* ── sidebar & mobile top bar: frosted glass ── */
html.ui-modern aside,
html.ui-modern .fixed.inset-x-0.top-0 {
  background: color-mix(in oklab, var(--color-surface) 72%, transparent);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-color: color-mix(in oklab, var(--color-border) 70%, transparent);
}
html.ui-modern aside a,
html.ui-modern aside button { border-radius: var(--radius-md); transition: background-color .15s ease, color .15s ease; }
html.ui-modern aside a[aria-current="page"],
html.ui-modern aside a.active {
  background: linear-gradient(90deg, rgba(139, 123, 255, .22), rgba(139, 123, 255, .04));
  color: var(--color-text);
  box-shadow: inset 2px 0 0 #8b7bff;
}

/* ── accent: gradient instead of flat fill ── */
html.ui-modern .bg-accent,
html.ui-modern button.bg-accent-dim {
  background-image: var(--th-grad);
  color: #0b0d1c;
  box-shadow: var(--th-glow);
}
html.ui-modern .text-accent { color: #a99dff; }
html.ui-modern h1,
html.ui-modern .text-2xl.font-bold,
html.ui-modern .text-xl.font-bold {
  letter-spacing: -.02em;
}
html.ui-modern h1:not(:has(svg, img)) {
  background: linear-gradient(90deg, #ffffff 0%, #c9c2ff 60%, #8ff5e2 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ── buttons, inputs ── */
html.ui-modern button,
html.ui-modern a { transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .1s ease; }
html.ui-modern button:not(:disabled):active { transform: translateY(1px); }
html.ui-modern input,
html.ui-modern select,
html.ui-modern textarea {
  border-radius: var(--radius-md);
}
html.ui-modern input.border:focus,
html.ui-modern select:focus,
html.ui-modern textarea:focus,
html.ui-modern .border:has(> input:focus),
html.ui-modern button:focus-visible,
html.ui-modern a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--color-bg), 0 0 0 4px rgba(139, 123, 255, .65);
}
html.ui-modern .border input:not(.border):focus { outline: none; box-shadow: none; }

/* ── tables ── */
html.ui-modern table { border-collapse: separate; border-spacing: 0; }
html.ui-modern thead th {
  color: var(--color-text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: .68rem;
}
html.ui-modern tbody tr { transition: background-color .12s ease; }
html.ui-modern tbody tr:hover { background-color: rgba(139, 123, 255, .06); }

/* ── status pills read a little crisper ── */
html.ui-modern .uppercase.rounded,
html.ui-modern .rounded-full.text-\[10px\] { letter-spacing: .05em; font-weight: 600; }

/* ── scrollbars ── */
html.ui-modern * { scrollbar-width: thin; scrollbar-color: #323760 transparent; }
html.ui-modern ::-webkit-scrollbar { width: 10px; height: 10px; }
html.ui-modern ::-webkit-scrollbar-thumb { background: #323760; border-radius: 999px; border: 2px solid var(--color-bg); }
html.ui-modern ::-webkit-scrollbar-track { background: transparent; }

/* ── selection ── */
html.ui-modern ::selection { background: rgba(139, 123, 255, .35); }

/* the classic colour-shade picker does nothing in Modern, so hide it */
html.ui-modern [title="Theme"] { display: none !important; }

/* ── the Classic / Modern switch itself (both styles) ── */
.th-style-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  font: 600 11px/1 var(--font-sans);
  user-select: none;
}
.th-style-toggle button {
  border: 0;
  background: transparent;
  color: var(--color-text-dim);
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
}
.th-style-toggle button[aria-pressed="true"] {
  background: var(--color-accent);
  color: var(--color-bg);
}
html.ui-modern .th-style-toggle button[aria-pressed="true"] {
  background-image: var(--th-grad);
  color: #0b0d1c;
}
.th-style-toggle.th-floating {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 60;
  box-shadow: 0 8px 24px -10px rgba(0, 0, 0, .6);
}
.th-style-toggle-wrap { display: flex; justify-content: center; padding: 8px 12px 4px; }

/* ── v2: stronger modern identity ── */
html.ui-modern h1 { font-weight: 800; }
html.ui-modern button.rounded,
html.ui-modern button.rounded-md,
html.ui-modern a.rounded.border,
html.ui-modern a.rounded-md.border { border-radius: 999px; }
html.ui-modern aside a.bg-surface-raised {
  background: linear-gradient(90deg, rgba(139, 123, 255, .28), rgba(94, 234, 212, .06));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(139, 123, 255, .35);
}
html.ui-modern aside a.bg-surface-raised svg { color: #b3a9ff; }
html.ui-modern aside a:not(.bg-surface-raised):hover { background: rgba(139, 123, 255, .10); }
html.ui-modern .rounded-lg.border,
html.ui-modern .rounded-xl.border {
  background-color: color-mix(in oklab, var(--color-surface) 78%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--th-card-shadow);
}
@media (min-width: 1024px) {
  html.ui-modern aside {
    position: sticky;
    top: 12px;
    height: calc(100vh - 24px);
    margin: 12px 0 12px 12px;
    border: 1px solid color-mix(in oklab, var(--color-border) 80%, #8b7bff 20%);
    border-radius: 22px;
    overflow-y: auto;
    box-shadow: 0 20px 50px -24px rgba(0, 0, 0, .9);
  }
}
