/*
 * Themes for SendKettle. The layout sets <html data-theme="bento|soft|paper" data-mode="auto|light|dark">.
 * Each theme redefines the tokens from app.css and adds a few shape rules. Loaded after app.css.
 */

@font-face { font-family: "Manrope"; src: url("../fonts/manrope.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Quicksand"; src: url("../fonts/quicksand.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

/* ---------- Bento (default): rounded tiles, pill navigation on top ---------- */
html[data-theme="bento"] {
    --bg: #eef0f3; --surface: #ffffff; --text: #0f172a; --muted: #5b6475; --border: #e2e6ec;
    --accent: #2563eb; --accent-text: #ffffff; --accent-soft: #dbeafe; --danger: #c81e3a;
    --ok: #15803d; --ok-soft: #dcfce7; --warn: #92400e; --warn-soft: #fef3c7; --radius: 24px;
    --font: "Manrope", system-ui, sans-serif; color-scheme: light;
}
html[data-theme="bento"][data-mode="dark"] {
    --bg: #0b1120; --surface: #151c2e; --text: #e5e9f2; --muted: #9aa5b9; --border: #253049;
    --accent: #60a5fa; --accent-text: #08142b; --accent-soft: #1b2b4d; --danger: #ff8095;
    --ok: #4ade80; --ok-soft: #12301f; --warn: #fbbf24; --warn-soft: #3a2c10; color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
    html[data-theme="bento"][data-mode="auto"] {
        --bg: #0b1120; --surface: #151c2e; --text: #e5e9f2; --muted: #9aa5b9; --border: #253049;
        --accent: #60a5fa; --accent-text: #08142b; --accent-soft: #1b2b4d; --danger: #ff8095;
        --ok: #4ade80; --ok-soft: #12301f; --warn: #fbbf24; --warn-soft: #3a2c10; color-scheme: dark;
    }
}

/* ---------- Soft Clay: pillowy light and shadow, lavender ---------- */
html[data-theme="soft"] {
    --bg: #efeaf8; --surface: #efeaf8; --text: #2e2647; --muted: #5a5175; --border: transparent;
    --accent: #6a4cf0; --accent-text: #ffffff; --accent-soft: #e2dbfa; --danger: #b4234a;
    --ok: #1f7a4f; --ok-soft: #dcf2e6; --warn: #8a5a00; --warn-soft: #f8ead0; --radius: 26px;
    --shadow-out: 8px 8px 20px #d3cbe6, -8px -8px 20px #ffffff; --shadow-in: inset 4px 4px 10px #d3cbe6, inset -4px -4px 10px #ffffff;
    --font: "Quicksand", system-ui, sans-serif; color-scheme: light;
}
html[data-theme="soft"][data-mode="dark"] {
    --bg: #231e35; --surface: #231e35; --text: #ece8fa; --muted: #b0a8cc; --border: transparent;
    --accent: #a993ff; --accent-text: #1a1430; --accent-soft: #352c55; --danger: #ff8fae;
    --ok: #6fdba5; --ok-soft: #1c3a2c; --warn: #f2c063; --warn-soft: #3e3218;
    --shadow-out: 8px 8px 18px #18142a, -8px -8px 18px #2e2842; --shadow-in: inset 4px 4px 10px #18142a, inset -4px -4px 10px #2e2842; color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
    html[data-theme="soft"][data-mode="auto"] {
        --bg: #231e35; --surface: #231e35; --text: #ece8fa; --muted: #b0a8cc; --border: transparent;
        --accent: #a993ff; --accent-text: #1a1430; --accent-soft: #352c55; --danger: #ff8fae;
        --ok: #6fdba5; --ok-soft: #1c3a2c; --warn: #f2c063; --warn-soft: #3e3218;
        --shadow-out: 8px 8px 18px #18142a, -8px -8px 18px #2e2842; --shadow-in: inset 4px 4px 10px #18142a, inset -4px -4px 10px #2e2842; color-scheme: dark;
    }
}

/* ---------- Plain Paper: calm, document-like, almost no colour ---------- */
html[data-theme="paper"] {
    --bg: #ffffff; --surface: #ffffff; --text: #37352f; --muted: #6f6e69; --border: #e9e9e7;
    --accent: #2383e2; --accent-text: #ffffff; --accent-soft: #e7f1fb; --danger: #c4314b;
    --ok: #2b7a4b; --ok-soft: #dbeddb; --warn: #8a5a12; --warn-soft: #fdecc8; --radius: 6px;
    --sidebar: #f7f7f5; --font: "Inter", system-ui, sans-serif; color-scheme: light;
}
html[data-theme="paper"][data-mode="dark"] {
    --bg: #191919; --surface: #191919; --text: #e3e2df; --muted: #9b9a97; --border: #2f2f2f;
    --accent: #529cca; --accent-text: #0e1a24; --accent-soft: #1f2f3c; --danger: #ff7369;
    --ok: #6ec58c; --ok-soft: #1d3326; --warn: #e3b25c; --warn-soft: #3a2f19; --sidebar: #202020; color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
    html[data-theme="paper"][data-mode="auto"] {
        --bg: #191919; --surface: #191919; --text: #e3e2df; --muted: #9b9a97; --border: #2f2f2f;
        --accent: #529cca; --accent-text: #0e1a24; --accent-soft: #1f2f3c; --danger: #ff7369;
        --ok: #6ec58c; --ok-soft: #1d3326; --warn: #e3b25c; --warn-soft: #3a2f19; --sidebar: #202020; color-scheme: dark;
    }
}

/* Light mode forced on a dark OS: keep the light tokens above (the auto blocks don't match). */
html[data-theme] body { font-family: var(--font); }

/* ===== Bento shapes ===== */
html[data-theme="bento"] .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
html[data-theme="bento"] .sidebar {
    position: sticky; top: 0; z-index: 10; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center;
    gap: 14px 20px; padding: 14px var(--gutter); border-right: 0; border-bottom: 0; background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(10px);
}
html[data-theme="bento"] .sidebar nav { display: flex; flex-wrap: wrap; gap: 2px; background: var(--surface); padding: 5px; border-radius: 999px; }
html[data-theme="bento"] .sidebar nav a { border-radius: 999px; padding: 8px 12px; font-weight: 600; font-size: .92rem; }
html[data-theme="bento"] .sidebar nav a.active { background: var(--text); color: var(--bg); }
html[data-theme="bento"] .sidebar nav a:not(.active):hover { background: var(--accent-soft); color: var(--accent); }
html[data-theme="bento"] .logout { margin: 0 0 0 auto; gap: 10px; }
/* Bento's menu is one bar on top: groups sit inline with a thin divider, the profile menu opens downwards on the right. */
html[data-theme="bento"] .sidebar .nav-main { display: flex; gap: 2px; }
html[data-theme="bento"] .nav-group { display: contents; }
html[data-theme="bento"] .nav-group-label { display: none; }
html[data-theme="bento"] .nav-group + .nav-group > a:first-of-type { margin-left: 6px; box-shadow: -4px 0 0 -3px var(--border); }
html[data-theme="bento"] .sidebar .nav-footer { margin: 0 0 0 auto; display: flex; gap: 2px; }
html[data-theme="bento"] .sidebar .nav-footer a { border-radius: 999px; padding: 8px 12px; font-weight: 600; font-size: .92rem; }
html[data-theme="bento"] .sidebar-foot { flex-direction: row; order: 1; margin-left: auto; }
html[data-theme="bento"] .sidebar .nav-main { order: 2; }
html[data-theme="bento"] .sidebar .nav-footer { order: 3; }
/* Laptops: logo and workspace on the left, Help, Support and the profile on the right, the menu pill on its own
   row below. Large screens: all of it on one row, the menu after the workspace. Never a ragged wrap. */
@media (min-width: 821px) {
    html[data-theme="bento"] .sidebar .nav-footer { order: 1; margin-left: auto; }
    html[data-theme="bento"] .sidebar-foot { order: 2; margin-left: 0; }
    html[data-theme="bento"] .sidebar .nav-main { order: 3; flex: 1 1 100%; max-width: max-content; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    html[data-theme="bento"] .sidebar .nav-main a { flex: none; }
}
@media (min-width: 1680px) {
    html[data-theme="bento"] .sidebar { flex-wrap: nowrap; } /* a long (Dutch) menu scrolls inside its pill instead of wrapping the bar */
    html[data-theme="bento"] .sidebar .nav-main { order: 0; flex: 0 1 auto; }
    html[data-theme="bento"] .sidebar > :not(.nav-main) { flex-shrink: 0; }
    html[data-theme="bento"] .sidebar .nav-footer { flex-wrap: nowrap; }
}
html[data-theme="bento"] .sidebar .profile-panel nav { display: grid; flex: none; background: none; padding: 0; border-radius: 0; }
html[data-theme="bento"] .sidebar .profile-panel nav a { border-radius: 10px; font-size: .92rem; }
html[data-theme="bento"] .sidebar .profile-panel nav a.active { background: var(--accent-soft); color: var(--accent); }
html[data-theme="bento"] .profile-panel { bottom: auto; top: calc(100% + 6px); left: auto; right: 0; }
html[data-theme="bento"] .main { padding-top: clamp(16px, 2vw, 24px); }
html[data-theme="bento"] .card, html[data-theme="bento"] .stat { border: 0; box-shadow: 0 1px 2px rgb(15 23 42 / .04); }
html[data-theme="bento"] .stat { padding: 22px; border-radius: var(--radius); }
html[data-theme="bento"] .stat strong { font-size: 2.1rem; font-weight: 800; letter-spacing: -.02em; }
html[data-theme="bento"] .stats .stat-key { background: var(--text); color: var(--bg); }
html[data-theme="bento"] .stats .stat-key span, html[data-theme="bento"] .stats .stat-key small { color: color-mix(in srgb, var(--bg) 70%, var(--text)); }
html[data-theme="bento"] .btn { border-radius: 999px; }
/* Separate rule: an unknown pseudo-element would drop the whole selector list in old browsers. */
html[data-theme="bento"] input[type=file]::file-selector-button { border-radius: 999px; }
html[data-theme="bento"] input:not([type=checkbox]):not([type=radio]), html[data-theme="bento"] select, html[data-theme="bento"] textarea { border-radius: 14px; }
html[data-theme="bento"] h1 { font-weight: 800; letter-spacing: -.02em; }
html[data-theme="bento"] .tabs { border-bottom: 0; gap: 6px; }
html[data-theme="bento"] .tabs a { border: 0; border-radius: 999px; background: var(--surface); }
html[data-theme="bento"] .tabs a.active { background: var(--text); color: var(--bg); }
html[data-theme="bento"] .tabs a.active .muted { color: inherit; }
@media (max-width: 820px) {
    html[data-theme="bento"] .sidebar { position: static; padding: 12px var(--gutter); }
    html[data-theme="bento"] .sidebar nav { flex-wrap: nowrap; overflow-x: auto; }
    html[data-theme="bento"] .sidebar nav { flex: 1 1 100%; order: 3; }
    html[data-theme="bento"] .sidebar .nav-footer { display: none; }
    html[data-theme="bento"] .sidebar .profile-panel nav { flex: none; order: 0; }
    html[data-theme="bento"] .sidebar { gap: 8px; }
}

/* ===== Soft Clay shapes ===== */
html[data-theme="soft"] .sidebar { background: var(--bg); border-right: 0; margin: 16px 0 16px 16px; height: calc(100vh - 32px); top: 16px; border-radius: 32px; box-shadow: var(--shadow-out); }
html[data-theme="soft"] .sidebar nav { gap: 8px; }
html[data-theme="soft"] .nav-group { gap: 6px; }
html[data-theme="soft"] .profile-panel { background: var(--bg); border: 0; border-radius: 20px; box-shadow: var(--shadow-out); }
html[data-theme="soft"] .sidebar nav a { border-radius: 18px; padding: 11px 14px; font-weight: 600; }
html[data-theme="soft"] .sidebar nav a.active { background: var(--bg); color: var(--accent); box-shadow: var(--shadow-in); }
html[data-theme="soft"] .sidebar nav a:not(.active):hover { background: transparent; color: var(--accent); }
html[data-theme="soft"] .card, html[data-theme="soft"] .stat { border: 0; box-shadow: var(--shadow-out); }
html[data-theme="soft"] .card { padding: 24px; margin-bottom: 24px; }
html[data-theme="soft"] .stats { gap: 20px; }
html[data-theme="soft"] .stat strong { font-weight: 700; }
html[data-theme="soft"] .btn { border-radius: 18px; border: 0; box-shadow: var(--shadow-out); background: var(--bg); }
html[data-theme="soft"] input[type=file]::file-selector-button { border-radius: 18px; border: 0; box-shadow: var(--shadow-out); background: var(--bg); }
html[data-theme="soft"] .btn-primary { background: var(--accent); box-shadow: 6px 6px 16px color-mix(in srgb, var(--accent) 35%, transparent); }
html[data-theme="soft"] .btn-ghost { box-shadow: none; background: transparent; }
html[data-theme="soft"] input:not([type=checkbox]):not([type=radio]), html[data-theme="soft"] select, html[data-theme="soft"] textarea { border: 0; border-radius: 16px; background: var(--bg); box-shadow: var(--shadow-in); }
html[data-theme="soft"] table th, html[data-theme="soft"] table td { border-bottom-color: color-mix(in srgb, var(--muted) 18%, transparent); }
html[data-theme="soft"] .tabs { border-bottom: 0; gap: 8px; }
html[data-theme="soft"] .tabs a { border: 0; border-radius: 16px; }
html[data-theme="soft"] .tabs a.active { box-shadow: var(--shadow-in); }
@media (max-width: 820px) {
    html[data-theme="soft"] .sidebar { margin: 12px; height: auto; border-radius: 24px; padding: 12px; gap: 8px; }
    html[data-theme="soft"] .sidebar nav a { padding: 8px 12px; }
    html[data-theme="soft"] .journey-add summary { box-shadow: var(--shadow-out); }
}

/* ===== Plain Paper shapes ===== */
html[data-theme="paper"] body { font-size: 14.5px; }
html[data-theme="paper"] .sidebar { background: var(--sidebar); border-right: 0; padding: 14px 10px; }
html[data-theme="paper"] .brand { font-size: .95rem; font-weight: 600; }
html[data-theme="paper"] .sidebar nav a { border-radius: 5px; padding: 6px 10px; color: var(--muted); }
html[data-theme="paper"] .sidebar .nav-main { gap: 12px; }
html[data-theme="paper"] .profile-panel { border-radius: 6px; }
html[data-theme="paper"] .sidebar nav a.active, html[data-theme="paper"] .sidebar nav a:hover { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }
/* Paper stays document-like: a calmer, narrower column with more air above it. */
html[data-theme="paper"] { --page-max: 1320px; --h1: clamp(1.6rem, 1.2rem + 1.4vw, 2.2rem); }
html[data-theme="paper"] .main { padding-top: clamp(24px, 4vw, 56px); padding-bottom: 72px; }
html[data-theme="paper"] h1 { font-weight: 600; letter-spacing: -.01em; }
html[data-theme="paper"] h2 { font-weight: 600; }
html[data-theme="paper"] .card { border: 0; border-top: 1px solid var(--border); border-radius: 0; padding: 20px 0; margin-bottom: 8px; background: transparent; }
html[data-theme="paper"] .stats { gap: 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px 0; }
html[data-theme="paper"] .stat { border: 0; background: transparent; padding: 12px 0; }
html[data-theme="paper"] .stat strong { font-size: 1.6rem; font-weight: 600; }
html[data-theme="paper"] .btn { border-radius: 5px; padding: 6px 12px; font-weight: 500; }
html[data-theme="paper"] input[type=file]::file-selector-button { border-radius: 5px; font-weight: 500; }
html[data-theme="paper"] .badge { border-radius: 4px; padding: 1px 6px; font-weight: 500; }
html[data-theme="paper"] input:not([type=checkbox]):not([type=radio]), html[data-theme="paper"] select, html[data-theme="paper"] textarea { border-radius: 5px; }
@media (max-width: 820px) {
    html[data-theme="paper"] .sidebar { padding: 12px var(--gutter); border-bottom: 1px solid var(--border); }
}

/* Theme picker cards (profile + settings) */
.theme-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; border: 0; padding: 0; margin: 0; }
.theme-options legend { font-weight: 600; font-size: .9rem; margin-bottom: 8px; }
.theme-option { display: grid; gap: 8px; padding: 10px; border: 2px solid var(--border); border-radius: 12px; cursor: pointer; font-weight: 600; }
.theme-option:has(input:checked) { border-color: var(--accent); }
.theme-option input { position: absolute; opacity: 0; pointer-events: none; }
.theme-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-swatch { height: 64px; border-radius: 8px; display: grid; grid-template-columns: 1fr 2fr; gap: 6px; padding: 8px; }
.theme-swatch i { display: block; border-radius: 6px; }
.swatch-bento { background: #eef0f3; } .swatch-bento i:first-child { background: #0f172a; } .swatch-bento i:last-child { background: #ffffff; }
.swatch-soft { background: #efeaf8; box-shadow: inset 3px 3px 8px #d3cbe6; } .swatch-soft i:first-child { background: #b9a7f0; } .swatch-soft i:last-child { background: #f7f4fd; }
.swatch-paper { background: #ffffff; border: 1px solid #e9e9e7; } .swatch-paper i:first-child { background: #f7f7f5; } .swatch-paper i:last-child { background: #ffffff; border-top: 2px solid #e9e9e7; border-radius: 0; }
.mode-options { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.mode-options legend { font-weight: 600; font-size: .9rem; margin-bottom: 8px; }
html[data-theme="bento"] { scroll-padding-top: 96px; }
