/* Shared styling of the Gestion Relay and Connector UIs (and a later app). Served at
   _content/SnowmaticONE.Gestion.UI/snowmatic.css */

:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #eef0f4;
    --border: #d9dde4;
    --text: #1d2330;
    --muted: #5d6676;
    --accent: #2563c9;
    --accent-text: #ffffff;
    --ok: #1f8a4c;
    --warn: #b7791f;
    --error: #c53030;
    --info: #2563c9;
    --radius: 8px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14171d;
        --surface: #1c2028;
        --surface-2: #252a34;
        --border: #343a46;
        --text: #e6e9ef;
        --muted: #9aa3b2;
        --accent: #5b8def;
        --accent-text: #0d1117;
        --ok: #4cc287;
        --warn: #e3b341;
        --error: #f17070;
        --info: #7aa7ff;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.45;
}

a { color: var(--accent); }

h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .75rem; }

.shell { display: flex; min-height: 100vh; }

.shell-nav {
    width: 220px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1rem .75rem;
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.shell-brand { font-weight: 700; padding: .25rem .5rem 1rem; }
.shell-brand small { display: block; font-weight: 400; color: var(--muted); }

.shell-nav a.nav-link {
    display: block;
    padding: .45rem .6rem;
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
}

.shell-nav a.nav-link:hover { background: var(--surface-2); }
.shell-nav a.nav-link.active { background: var(--accent); color: var(--accent-text); }

.shell-nav .spacer { flex: 1; }
.shell-user { font-size: .85rem; color: var(--muted); padding: .5rem; }

.shell-main { flex: 1; padding: 1.5rem 2rem; min-width: 0; }

@media (max-width: 760px) {
    .shell { flex-direction: column; }
    .shell-nav { width: auto; border-right: 0; border-bottom: 1px solid var(--border); flex-direction: row; flex-wrap: wrap; }
    .shell-nav .spacer { display: none; }
    .shell-main { padding: 1rem; }
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem; }
.stat .label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.stat .value { font-size: 1.6rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--muted); font-size: .85rem; }

table.grid { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .9rem; }
table.grid th, table.grid td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
table.grid th { background: var(--surface-2); font-weight: 600; }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }

form.stack, .stack { display: flex; flex-direction: column; gap: .75rem; max-width: 460px; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; }
label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--muted); }
label.inline { flex-direction: row; align-items: center; gap: .4rem; color: var(--text); }

input, select, textarea {
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: .45rem .6rem;
}

input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

button, .btn {
    font: inherit;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    border-radius: 6px;
    padding: .45rem .9rem;
    text-decoration: none;
    display: inline-block;
}

button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.danger { color: var(--error); }
button:disabled { opacity: .55; cursor: default; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); }

.alert { padding: .6rem .8rem; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); }
.alert.error { border-color: var(--error); color: var(--error); }
.alert.ok { border-color: var(--ok); color: var(--ok); }

.badge { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .78rem; border: 1px solid currentColor; }
.badge.ok { color: var(--ok); }
.badge.warn { color: var(--warn); }
.badge.error { color: var(--error); }
.badge.muted { color: var(--muted); }

.lvl-Warning { color: var(--warn); }
.lvl-Error, .lvl-Critical { color: var(--error); font-weight: 600; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; }
.suggestions { display: flex; gap: .4rem; flex-wrap: wrap; }

.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 1rem; }
.login-body { flex: 1; width: 100%; display: flex; align-items: center; justify-content: center; }
.login-wrap .card { width: 100%; max-width: 380px; }
.login-version { padding: .75rem 0 .25rem; text-align: center; }

/* Version label (links to the changelog): centered at the bottom of the sidebar and of the login pages. */
.shell-version { text-align: center; padding: .75rem .5rem .25rem; }
.version-link { font-size: .8rem; color: var(--muted); text-decoration: none; }
.version-link:hover { color: var(--accent); text-decoration: underline; }

/* Changelog page */
.changelog { max-width: 820px; }
.changelog h1 { margin-top: 0; }
.changelog h2 { margin: 1.75rem 0 .5rem; padding-bottom: .3rem; border-bottom: 1px solid var(--border); }
.changelog h3 { margin: 1.1rem 0 .4rem; font-size: 1rem; }
.changelog ul { margin: .25rem 0 .75rem; padding-left: 1.4rem; }
.changelog li { margin: .2rem 0; line-height: 1.45; }
.changelog code { background: var(--surface-2); padding: 0 .3rem; border-radius: 4px; font-size: .88em; }

.sparkline { width: 100%; height: 70px; display: block; }
.sparkline .in { fill: var(--accent); }
.sparkline .out { fill: var(--ok); }
.legend { display: flex; gap: 1rem; font-size: .85rem; color: var(--muted); }
.legend .sw { display: inline-block; width: .75rem; height: .75rem; border-radius: 2px; margin-right: .3rem; vertical-align: -1px; }

#blazor-error-ui {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0;
    padding: .6rem 1.25rem;
    background: var(--warn);
    color: #000;
    z-index: 1000;
}

#blazor-error-ui .dismiss { cursor: pointer; float: right; }

/* ---- Gestion additions ------------------------------------------------------------------------ */
.badge.info { color: var(--info); }
.badge + .badge { margin-left: .25rem; }
.stat.tone-ok { border-left: 4px solid var(--ok); }
.stat.tone-warn { border-left: 4px solid var(--warn); }
.stat.tone-error { border-left: 4px solid var(--error); }
.stat.tone-info { border-left: 4px solid var(--info); }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; word-break: break-word; }
td.msg { min-width: 18rem; word-break: break-word; }
.pager { margin-top: .75rem; align-items: center; }
.page-head { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: .35rem; }
.crumbs a { color: var(--muted); }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin: 1.25rem 0 .75rem; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: .45rem .8rem; color: var(--muted); }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.kv { display: grid; grid-template-columns: minmax(9rem, max-content) 1fr; gap: .35rem 1rem; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.inline-edit { display: flex; gap: .35rem; align-items: center; }
.inline-edit input { padding: .25rem .45rem; min-width: 10rem; }
button.small, .btn.small { padding: .2rem .55rem; font-size: .82rem; }
.alert.warn { border-color: var(--warn); color: var(--warn); }
tr.dim td { color: var(--muted); }
.search { min-width: 16rem; }
a.row-link { color: var(--text); text-decoration: none; font-weight: 600; }
a.row-link:hover { color: var(--accent); text-decoration: underline; }
