/* ==========================================================================
   JSS design tokens — the one source of colour, type, shape and the shared
   primitives (logo, icon, badge, tabs, native controls, disabled state) for
   every part of the site: public pages, sign-in, the candidate zone, the
   employer zone and the administration.

   Loaded first on every page. Zone stylesheets map their own variables
   (--stu-*, --emp-*, --adm-*, --jss-*) onto these instead of carrying their
   own palettes, so the zones cannot drift apart: change a value here and
   every zone follows.

   Rules
   - Colour: one brand blue (#1565ff, 4.8:1 on white). Status colours only
     for status; text on a tinted status background uses the matching *-ink
     token. No raw hex values in zone stylesheets. A fill under white text
     uses --jss-*-fill with --jss-on-fill, so the dark theme can lighten the
     base colour for text without losing the button contrast.
   - Type: Inter. Sizes from the scale below only (12 13 15 16 20 26 + the
     public display size). Weights 400 / 600 / 700 only. Body text is 16 px
     on public pages and 15 px in the logged-in zones. Labels are sentence
     case — no uppercase, no letter-spacing.
   - Surfaces: cards have a 1 px border and a soft shadow (--jss-shadow-xs/sm);
     things that float over content (menus, dialogs, toasts, sticky bars)
     get --jss-shadow-overlay. No glows under buttons.
   - Badges are short nouns ("Splněno", "Probíhá"), 22 px, radius 6 px; the
     explanation goes next to them as plain text, never inside them.
   - One icon set (Lucide via {% icon %} / JSSIcon), 1.75 stroke, 16 px.
     Never type ✓ ✕ ⭳ ▾ → as icons.
   - Controls share three heights: sm 30 · md 38 · lg 46 px. Removals are
     "danger-ghost" (red text, no fill); a filled red button only confirms a
     removal inside a dialog. Disabled is neutral grey, never a faded colour.
   - Navigation back is a text link with an arrow above the page title.
   ========================================================================== */
:root {
    /* Brand (logo cyan, darkened for contrast) */
    --jss-brand: #1565ff;          /* 4.8:1 on white */
    --jss-brand-hover: #0b52dc;
    --jss-brand-active: #0944b8;
    --jss-brand-soft: #edf3ff;
    --jss-brand-soft-2: #d9e6ff;
    --jss-brand-ink: #0b47c2;      /* brand text on a tinted background */

    /* Ink and neutrals (one cool grey scale for every zone) */
    --jss-ink: #0f1b2d;            /* headings, primary text */
    --jss-ink-2: #334155;          /* body text */
    --jss-ink-3: #5b6b7f;          /* secondary text — 5.3:1 on white */
    --jss-ink-4: #8796a8;          /* placeholders, disabled, decoration */
    --jss-line: #e2e8f0;
    --jss-line-strong: #cbd5e1;
    --jss-line-soft: #eef2f6;
    --jss-bg: #f5f7fa;             /* app background behind cards */
    --jss-surface: #ffffff;
    --jss-surface-2: #f8fafc;      /* table heads, hovers, insets */

    /* Status: base (icons, borders, text on white), soft (tint), line, ink (text on tint) */
    --jss-success: #15803d;
    --jss-success-hover: #126b33;
    --jss-success-soft: #ecfdf3;
    --jss-success-line: #bbe5c9;
    --jss-success-ink: #14532d;
    --jss-warning: #b45309;
    --jss-warning-soft: #fff7e8;
    --jss-warning-line: #f6d8a4;
    --jss-warning-ink: #713f12;
    --jss-danger: #c22a2a;
    --jss-danger-hover: #a51f1f;
    --jss-danger-soft: #fef2f2;
    --jss-danger-line: #f6c6c6;
    --jss-danger-ink: #7f1d1d;
    --jss-mark: #fff3bf;           /* search-hit highlight */

    /* Filled controls that carry white text (primary and confirm buttons,
       counts). In the light theme they are the base colours above; the dark
       theme below needs a lighter base for text and keeps these for fills. */
    --jss-brand-fill: var(--jss-brand);
    --jss-brand-fill-hover: var(--jss-brand-hover);
    --jss-danger-fill: var(--jss-danger);
    --jss-danger-fill-hover: var(--jss-danger-hover);
    --jss-on-fill: #fff;
    --jss-scrim: color-mix(in srgb, var(--jss-ink) 45%, transparent);   /* behind dialogs */
    --jss-scroll-edge: color-mix(in srgb, var(--jss-ink) 16%, transparent);

    /* Type */
    --jss-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --jss-fs-xs: 12px;             /* badges, meta */
    --jss-fs-sm: 13px;             /* secondary text, dense table cells, labels */
    --jss-fs-base: 15px;           /* body in the zones */
    --jss-fs-md: 16px;             /* public body, card titles */
    --jss-fs-lg: 20px;             /* section titles */
    --jss-fs-xl: 26px;             /* page titles */
    --jss-fs-display: clamp(32px, 4.4vw, 46px);   /* public page headline */

    /* Shape */
    --jss-radius-sm: 6px;
    --jss-radius: 8px;
    --jss-radius-lg: 12px;
    --jss-shadow-overlay: 0 1px 2px rgba(15, 27, 45, 0.04), 0 10px 28px rgba(15, 27, 45, 0.12);
    --jss-shadow-lg: 0 18px 44px rgba(15, 27, 45, 0.16);
    /* Kept as aliases so older rules resolve to the two elevations. */
    --jss-shadow-xs: 0 1px 2px rgba(15, 27, 45, 0.05);
    --jss-shadow-sm: 0 1px 2px rgba(15, 27, 45, 0.04), 0 2px 6px rgba(15, 27, 45, 0.05);
    --jss-shadow: 0 1px 2px rgba(15, 27, 45, 0.04), 0 8px 24px rgba(15, 27, 45, 0.07);
    --jss-focus-ring: 0 0 0 3px rgba(21, 101, 255, 0.28);

    /* Controls */
    --jss-control-h-sm: 30px;
    --jss-control-h: 38px;
    --jss-control-h-lg: 46px;
    --jss-ease: cubic-bezier(0.2, 0, 0, 1);
    --jss-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235b6b7f' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

/* ── Dark theme — the administration only. adminzone/base_admin.html sets
   data-theme on <html> before the stylesheets apply (the visitor's stored
   choice, else the system setting); no other page sets it. Same roles as
   above. Text pairs meet WCAG AA (4.5:1), control borders and fills 3:1;
   adminzone/test_dark_theme.py computes the ratios from this block. ── */
html[data-theme="dark"] {
    color-scheme: dark;

    --jss-brand: #6aa1ff;          /* links, icons, active marks on dark */
    --jss-brand-hover: #8cb6ff;
    --jss-brand-active: #a8c8ff;
    --jss-brand-soft: #162a4b;
    --jss-brand-soft-2: #1f3a66;
    --jss-brand-ink: #a8c8ff;
    --jss-brand-fill: #1565ff;     /* the light theme's brand blue, under white text */
    --jss-brand-fill-hover: #0b52dc;

    --jss-ink: #eaf0f6;
    --jss-ink-2: #c4cedb;
    --jss-ink-3: #98a5b6;
    --jss-ink-4: #808d9f;
    --jss-line: #2b3646;
    --jss-line-strong: #5f6b7e;
    --jss-line-soft: #212b39;
    --jss-bg: #0d131c;
    --jss-surface: #141c27;
    --jss-surface-2: #1a2330;

    --jss-success: #4cc97a;
    --jss-success-hover: #6fd896;
    --jss-success-soft: #10291d;
    --jss-success-line: #1f5236;
    --jss-success-ink: #8fe3ad;
    --jss-warning: #f0a347;
    --jss-warning-soft: #2f2210;
    --jss-warning-line: #5e4318;
    --jss-warning-ink: #f7c97f;
    --jss-danger: #ff7a75;
    --jss-danger-hover: #ff9e99;
    --jss-danger-soft: #3b1a1f;
    --jss-danger-line: #6e2c31;
    --jss-danger-ink: #ffb4ae;
    --jss-danger-fill: #d13a3a;
    --jss-danger-fill-hover: #b82e2e;
    --jss-on-fill: #fff;
    --jss-mark: #352c12;

    --jss-shadow-overlay: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 12px 32px rgba(0, 0, 0, 0.55);
    --jss-shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.6);
    --jss-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --jss-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.2);
    --jss-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
    --jss-focus-ring: 0 0 0 3px rgba(106, 161, 255, 0.4);
    --jss-scrim: rgba(3, 6, 10, 0.72);
    --jss-scroll-edge: rgba(0, 0, 0, 0.6);
    --jss-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2398a5b6' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

body {
    font-family: var(--jss-font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

button, input, select, textarea { font-family: inherit; }

::selection { background: var(--jss-brand-soft-2); color: var(--jss-ink); }

:is(a, button, summary, input, select, textarea, [tabindex]):focus-visible {
    outline: 2px solid var(--jss-brand);
    outline-offset: 2px;
}

/* ── Logo: one height everywhere (the only source is a 151×91 PNG). ── */
.jss-logo { display: block; height: 32px; width: auto; }

/* ── Icons — {% icon %} and JSSIcon() render <svg class="i …">. ── */
.i {
    display: inline-block;
    flex: none;
    vertical-align: -0.18em;
    stroke-width: 1.75;
}
.i-spin { animation: jss-spin 0.9s linear infinite; }
@keyframes jss-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .i-spin { animation-duration: 2.4s; }
}

/* ── Badge — the one status chip. Zone badge classes use the same values. ── */
.jss-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 22px;
    padding: 1px 8px;
    border-radius: var(--jss-radius-sm);
    background: var(--jss-line-soft);
    color: var(--jss-ink-2);
    font-size: var(--jss-fs-xs);
    font-weight: 600;
    line-height: 1.35;
    white-space: nowrap;
}
.jss-badge .i { width: 13px; height: 13px; }
.jss-badge.is-info { background: var(--jss-brand-soft); color: var(--jss-brand-ink); }
.jss-badge.is-success { background: var(--jss-success-soft); color: var(--jss-success-ink); }
.jss-badge.is-warning { background: var(--jss-warning-soft); color: var(--jss-warning-ink); }
.jss-badge.is-danger { background: var(--jss-danger-soft); color: var(--jss-danger-ink); }

/* ── Tabs — underline tabs, the only tab style. ── */
.jss-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px 24px;
    border-bottom: 1px solid var(--jss-line);
    /* One row always: on a narrow screen the row scrolls instead of wrapping. */
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.jss-tabs::-webkit-scrollbar { display: none; }
.jss-tabs a,
.jss-tabs button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 0;
    margin-bottom: -1px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--jss-ink-3);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
.jss-tabs a:hover,
.jss-tabs button:hover { color: var(--jss-ink); }
.jss-tabs .active,
.jss-tabs .is-active,
.jss-tabs [aria-current="page"],
.jss-tabs [aria-selected="true"] { color: var(--jss-ink); border-bottom-color: var(--jss-brand); }

/* ── Back link above a page title. ── */
.jss-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    color: var(--jss-ink-3);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}
.jss-back:hover { color: var(--jss-ink); }

/* ── Header account area (zones): name, then a quiet "Odhlásit". ── */
.jss-account { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.jss-account-name { color: var(--jss-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32ch; }
.jss-account-name strong { color: var(--jss-ink); font-weight: 600; }
.jss-account a.jss-signout {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--jss-ink-2); font-weight: 600; text-decoration: none; white-space: nowrap;
}
.jss-account a.jss-signout:hover { color: var(--jss-brand); }
@media (max-width: 640px) { .jss-account-name { display: none; } }

/* ── Native controls: same chevron, same check, same disclosure marker. ── */
select:not([multiple]):not([size]):not(.form-select) {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 34px !important;
    background-image: var(--jss-chevron);
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px 16px;
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--jss-brand); }
input[type="checkbox"]:not(.form-check-input) { width: 16px; height: 16px; }
summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
summary::before {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 6px;
    vertical-align: -3px;
    background: var(--jss-chevron) no-repeat center / 16px 16px;
    transform: rotate(-90deg);
    transition: transform 0.15s var(--jss-ease);
}
details[open] > summary::before { transform: none; }
summary.no-marker::before { content: none; }

/* ── Disabled: neutral, with the reason shown beside it (never a faded colour). ── */
html :is(.stu-btn, .emp-btn, .adm-btn, .btn):is(:disabled, .disabled, [aria-disabled="true"]) {
    background: var(--jss-surface-2) !important;
    border-color: var(--jss-line) !important;
    color: var(--jss-ink-4) !important;
    box-shadow: none !important;
    opacity: 1 !important;
    filter: none !important;
    cursor: not-allowed;
}

/* ── Prices: "1 600 Kč bez DPH (1 936 Kč s DPH)" — net first, one weight,
   the gross in brackets in the secondary colour. Markup: {% price_pair %}. ── */
.money-pair { white-space: normal; }
.money-net { font-weight: inherit; color: inherit; white-space: nowrap; }
.money-net small { font-size: 1em; font-weight: inherit; }
.money-gross { font-size: 1em; font-weight: 400; color: var(--jss-ink-3); white-space: nowrap; }
.money-gross::before { content: "("; }
.money-gross::after { content: ")"; }

/* ── Numbers and other things that must not break across lines. ── */
.jss-num, table td, table th { font-variant-numeric: tabular-nums; }
.jss-nowrap { white-space: nowrap; }

/* ── Bootstrap (public pages, sign-in, candidate and employer zones) speaks
   the same palette. html:root and .btn.btn-* outrank Bootstrap's own rules
   whichever file loads first. ── */
html:root {
    --bs-primary: #1565ff;
    --bs-primary-rgb: 21, 101, 255;
    --bs-link-color: #1565ff;
    --bs-link-color-rgb: 21, 101, 255;
    --bs-link-hover-color: #0b52dc;
    --bs-link-hover-color-rgb: 11, 82, 220;
    --bs-body-font-family: var(--jss-font);
    --bs-body-color: var(--jss-ink-2);
    --bs-emphasis-color: var(--jss-ink);
    --bs-secondary-color: var(--jss-ink-3);
    --bs-border-color: var(--jss-line);
    --bs-border-radius: var(--jss-radius);
    --bs-focus-ring-color: rgba(21, 101, 255, 0.28);
}
.btn.btn-primary {
    --bs-btn-bg: var(--jss-brand);
    --bs-btn-border-color: var(--jss-brand);
    --bs-btn-hover-bg: var(--jss-brand-hover);
    --bs-btn-hover-border-color: var(--jss-brand-hover);
    --bs-btn-active-bg: var(--jss-brand-active);
    --bs-btn-active-border-color: var(--jss-brand-active);
    --bs-btn-focus-shadow-rgb: 21, 101, 255;
}
.btn.btn-outline-primary {
    --bs-btn-color: var(--jss-brand);
    --bs-btn-border-color: var(--jss-brand);
    --bs-btn-hover-bg: var(--jss-brand-soft);
    --bs-btn-hover-color: var(--jss-brand-hover);
    --bs-btn-hover-border-color: var(--jss-brand-hover);
    --bs-btn-active-bg: var(--jss-brand-soft-2);
    --bs-btn-active-color: var(--jss-brand-active);
    --bs-btn-active-border-color: var(--jss-brand-active);
}
.btn { --bs-btn-border-radius: var(--jss-radius); --bs-btn-font-weight: 600; }
.form-control:focus, .form-select:focus { border-color: var(--jss-brand); box-shadow: var(--jss-focus-ring); }
.form-check-input:checked { background-color: var(--jss-brand); border-color: var(--jss-brand); }
.form-check-input:focus { border-color: var(--jss-brand); box-shadow: var(--jss-focus-ring); }

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 5000;
    padding: 0.6rem 1rem;
    background: var(--jss-brand-fill);
    color: var(--jss-on-fill);
    border-radius: 0 0 var(--jss-radius) 0;
    font-weight: 600;
}
.skip-link:focus { left: 0; }
