/* IT Market Radar — hand-written design tokens (UX-DR1). No UI-system dependency. */

:root {
    --surface: #FFFFFF;
    --surface-sunken: #F4F5F7;
    --surface-raised: #FFFFFF;
    --border: #DCE0E5;
    --border-strong: #B7BEC7;
    --on-surface: #1A1D21;
    --on-surface-muted: #5B6470;
    --primary: #1E5FBF;
    --primary-hover: #184C99;
    --on-primary: #FFFFFF;
    --accent: #0F9D6C;
    --warn: #B7791F;
    --danger: #C0392B;
    --chip-fr: #EAF1FB;
    --chip-fr-text: #1E5FBF;
    --chip-en: #EAFBF1;
    --chip-en-text: #0F7A54;
    --chip-bilingual: #F3EEFB;
    --chip-bilingual-text: #5B3EA8;

    --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono: "SF Mono", "Cascadia Code", Consolas, monospace;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-8: 48px;
    --margin-mobile: 16px;
    --margin-desktop: 48px;

    --radius-sm: 4px;
    --radius: 6px;
    --radius-md: 8px;
    --radius-full: 9999px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--on-surface);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a { color: var(--primary); }
a:hover { color: var(--primary-hover); }

h1, h2, h3 { margin: 0; }

main { flex: 1; }

/* ---------- Navigation ---------- */

.nav { border-bottom: 1px solid var(--border); background: var(--surface); }

.nav__inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: var(--space-3) var(--margin-mobile);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.nav__brand {
    font-weight: 700;
    font-size: 16px;
    color: var(--on-surface);
    text-decoration: none;
}

.nav__links {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.nav__link {
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius);
    color: var(--on-surface-muted);
    text-decoration: none;
    font-size: 14px;
}

.nav__link:hover { background: var(--surface-sunken); color: var(--on-surface); }

.nav__link.is-active { color: var(--primary); background: var(--chip-fr); font-weight: 600; }

.lang-toggle {
    display: inline-flex;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-left: var(--space-2);
}

.lang-toggle a {
    padding: var(--space-1) var(--space-3);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    color: var(--on-surface-muted);
}

.lang-toggle a.is-active { background: var(--primary); color: var(--on-primary); }

/* ---------- Layout ---------- */

.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: var(--space-5) var(--margin-mobile);
}

@media (min-width: 1024px) {
    .nav__inner { padding-left: var(--margin-desktop); padding-right: var(--margin-desktop); }
    .container { padding-left: var(--margin-desktop); padding-right: var(--margin-desktop); }
}

.page-header { margin-bottom: var(--space-4); }
.page-title { font-size: 20px; font-weight: 600; line-height: 1.3; }
.page-subtitle { color: var(--on-surface-muted); margin: var(--space-2) 0 0; }

.hero {
    background: var(--surface-sunken);
    border-bottom: 1px solid var(--border);
    padding: var(--space-6) var(--margin-mobile);
}

.hero__inner { max-width: 1440px; margin: 0 auto; }

@media (min-width: 1024px) {
    .hero { padding-left: var(--margin-desktop); padding-right: var(--margin-desktop); }
}

.hero__title { font-size: 28px; font-weight: 700; line-height: 1.2; }
.hero__subtitle { color: var(--on-surface-muted); margin: var(--space-2) 0 var(--space-3); }

.stats { display: flex; flex-wrap: wrap; gap: var(--space-4); margin-top: var(--space-4); }

.stat-card {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    min-width: 180px;
}

.stat-card__label {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--on-surface-muted);
}

.stat-card__value { font-size: 28px; font-weight: 700; line-height: 1.2; }

.card {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-5);
    overflow: hidden;
}

.card__header {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
    font-size: 18px;
    font-weight: 600;
}

.card__body { padding: var(--space-4); }

.chart { position: relative; height: 320px; }
.chart--short { height: 140px; }

/* ---------- Freshness ---------- */

.freshness {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 13px;
    color: var(--on-surface-muted);
}

.dot { width: 10px; height: 10px; border-radius: var(--radius-full); display: inline-block; }
.dot--ok { background: var(--accent); }
.dot--warn { background: var(--warn); }

/* ---------- Empty states ---------- */

.empty-state { padding: var(--space-6) var(--space-4); text-align: center; color: var(--on-surface-muted); }
.empty-state__title { display: block; font-size: 20px; font-weight: 600; color: var(--on-surface); margin-bottom: var(--space-2); }

/* ---------- Tables ---------- */

.table { width: 100%; border-collapse: collapse; }
.table caption { text-align: left; padding: var(--space-2) 0; color: var(--on-surface-muted); font-size: 13px; }

.table th {
    text-align: left;
    padding: var(--space-2) var(--space-3);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--on-surface-muted);
    border-bottom: 1px solid var(--border);
}

.table th .th-sort {
    all: unset;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    color: inherit;
}
.table th .th-sort:hover { color: var(--on-surface); }
.table th .th-sort:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; border-radius: 2px; }
.th-sort__arrow { font-size: 10px; line-height: 1; }

.table td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border); }
.table tbody tr { position: relative; }
.table tbody tr:nth-child(even) { background: var(--surface-sunken); }
.table tbody tr.is-selected { background: var(--chip-fr); font-weight: 600; }
.table tbody tr:hover { background: var(--chip-fr); box-shadow: 0 1px 2px rgba(26, 29, 33, 0.08); }

.row-link { color: var(--on-surface); font-weight: 600; text-decoration: none; }
.row-link::after { content: ""; position: absolute; inset: 0; }

.mono { font-family: var(--font-mono); font-size: 14px; }
.muted { color: var(--on-surface-muted); }

/* ---------- Chips ---------- */

.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.chip {
    display: inline-block;
    border-radius: var(--radius-full);
    padding: var(--space-1) var(--space-3);
    font-size: 13px;
    font-weight: 600;
    background: var(--surface-sunken);
    color: var(--on-surface);
    text-decoration: none;
}

.chip--match { background: var(--on-surface); color: var(--surface); }

.chip--fr { background: var(--chip-fr); color: var(--chip-fr-text); }
.chip--en { background: var(--chip-en); color: var(--chip-en-text); }
.chip--bilingual { background: var(--chip-bilingual); color: var(--chip-bilingual-text); }

/* ---------- Buttons and forms ---------- */

.btn {
    display: inline-block;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--on-surface);
    font: inherit;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
}

.btn:hover { background: var(--surface-sunken); color: var(--on-surface); }
.btn--primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn--primary:hover { background: var(--primary-hover); color: var(--on-primary); }
.btn--accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--accent:hover { filter: brightness(0.92); color: #fff; }
.btn--info { background: var(--chip-fr); border-color: var(--primary); color: var(--primary); }
.btn--info:hover { background: var(--primary); color: var(--on-primary); }
.btn--danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--danger:hover { filter: brightness(0.92); color: #fff; }
.btn--small { padding: var(--space-1) var(--space-2); font-size: 13px; }

.filters { display: flex; align-items: flex-end; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-4); }
.field { display: flex; flex-direction: column; gap: var(--space-1); }
.field__label {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--on-surface-muted);
}

select, input[type="text"], input[type="password"] {
    font: inherit;
    font-size: 14px;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--on-surface);
}

.search { width: 100%; max-width: 420px; margin-bottom: var(--space-4); }

/* ---------- Language split ---------- */

.lang-split {
    display: flex;
    height: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    overflow: hidden;
    background: var(--surface-sunken);
    margin-bottom: var(--space-3);
}

.lang-split__seg--fr { background: var(--chip-fr-text); }
.lang-split__seg--en { background: var(--chip-en-text); }
.lang-split__seg--bi { background: var(--chip-bilingual-text); }

/* ---------- Salary range bar ---------- */

.range {
    position: relative;
    height: 10px;
    min-width: 160px;
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
}

.range__fill {
    position: absolute;
    top: 0;
    bottom: 0;
    background: var(--primary);
    border-radius: var(--radius-full);
}

.caption { display: block; font-size: 13px; color: var(--warn); margin-top: var(--space-1); }

/* ---------- Footer ---------- */

.footer {
    border-top: 1px solid var(--border);
    padding: var(--space-4) var(--margin-mobile);
    text-align: center;
    color: var(--on-surface-muted);
    font-size: 13px;
}

/* ---------- Admin ---------- */

.flash {
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    background: var(--surface-sunken);
    border-radius: var(--radius);
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-4);
    font-size: 14px;
}

.flash--warn { border-left-color: var(--warn); }

.admin-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.admin-actions form { margin: 0; }
.admin-actions__logout { margin-left: auto; }

.status {
    display: inline-block;
    border-radius: var(--radius-full);
    padding: var(--space-1) var(--space-2);
    font-size: 12px;
    font-weight: 600;
    background: var(--surface-sunken);
    color: var(--on-surface-muted);
}

.status--completed { background: var(--chip-en); color: var(--chip-en-text); }
.status--started,
.status--starting { background: var(--chip-fr); color: var(--chip-fr-text); }
.status--failed { background: #FBEAEA; color: var(--danger); }
.status--stopped { background: #FDF3E2; color: var(--warn); }

.login-wrap { display: flex; justify-content: center; }
.login-card { width: 100%; max-width: 380px; margin-top: var(--space-6); }

/* ---------- Accessibility ---------- */

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
