/* ==========================================================================
   KASTRY — design system
   --------------------------------------------------------------------------
   Visual direction: an analog broadcast console, not a generic SaaS panel.
   Tally-light orange for the primary signal, teal for patch-cable accents,
   mono type for anything that reads like a live readout (labels, stats,
   ids), Space Grotesk for nameplates/headings, Inter for body copy.

   This file is shared by the homepage, account picker and dashboard.
   Class names referenced by client-side JS in server.js (.nav-item,
   .tab-content, .card, .dropdown-item, .feed-item, .editor-row, etc.)
   are preserved exactly — only their appearance changes here.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Big+Shoulders+Display:wght@600;700;800&family=JetBrains+Mono:wght@500;600&family=Karla:wght@400;500;600;700&display=swap');

:root {
    /* ---- palette --------------------------------------------------- */
    --ink: #0b0c0f;
    --ink-2: #0f1114;
    --panel: #14161b;
    --panel-raised: #1b1e24;
    --panel-hover: #20232a;
    --line: #262a33;
    --line-soft: #1e2129;

    --paper: #ece9e2;
    --paper-dim: #c7c4ba;
    --muted: #8a8f9c;
    --muted-dim: #5f6470;

    --signal: #ff7a3d;
    --signal-dim: #c9532a;
    --signal-glow: rgba(255, 122, 61, 0.35);

    --patch: #2fd9c4;
    --patch-dim: #1f9c8c;

    --ok: #35d07f;
    --warn: #ffc94d;
    --danger: #ff5470;
    --danger-dim: #c73a55;

    /* ---- type --------------------------------------------------- */
    --font-display: 'Big Shoulders Display', 'Arial Narrow', sans-serif;
    --font-mono: 'JetBrains Mono', 'Consolas', monospace;
    --font-body: 'Karla', 'Segoe UI', sans-serif;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { color-scheme: dark; }

body {
    font-family: var(--font-body);
    background-color: var(--ink);
    color: var(--paper);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

::selection { background: var(--signal); color: #14161b; }

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

.mono { font-family: var(--font-mono); letter-spacing: 0.02em; }

/* ---- LED / signal indicator, used across homepage + dashboard -------- */
.led {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--muted-dim);
    box-shadow: none;
    flex-shrink: 0;
}
.led.on {
    background: var(--ok);
    box-shadow: 0 0 6px 1px rgba(53, 208, 127, 0.55);
}
.led.warn {
    background: var(--warn);
    box-shadow: 0 0 6px 1px rgba(255, 201, 77, 0.55);
}
.led.danger {
    background: var(--danger);
    box-shadow: 0 0 6px 1px rgba(255, 84, 112, 0.55);
}
.led.live {
    background: var(--signal);
    box-shadow: 0 0 8px 2px var(--signal-glow);
    animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}
@media (prefers-reduced-motion: reduce) {
    .led.live { animation: none; }
}

/* ==========================================================================
   AUTH PAGES — login box (/) and account picker (/select-account)
   ========================================================================== */

body.auth-page {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background:
        radial-gradient(circle at 20% 10%, rgba(255, 122, 61, 0.07), transparent 45%),
        radial-gradient(circle at 85% 90%, rgba(47, 217, 196, 0.06), transparent 40%),
        var(--ink);
    padding: 24px;
}

.login-box, .box {
    background: var(--panel);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 440px;
    text-align: center;
    border: 1px solid var(--line);
    position: relative;
}

.login-box::before, .box::before {
    content: '';
    position: absolute;
    top: 0; left: 24px; right: 24px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--signal), transparent);
    opacity: 0.5;
}

.login-box h1, .box h1 {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--paper);
    margin-bottom: 10px;
    font-size: 28px;
    letter-spacing: 0.01em;
}

.login-box p {
    color: var(--muted);
    margin-bottom: 30px;
    font-size: 14px;
    line-height: 1.6;
}

.btn-twitch {
    background-color: var(--signal);
    color: #14161b;
    border: none;
    padding: 13px 26px;
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.01em;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background 0.2s, transform 0.15s;
}
.btn-twitch:hover { background-color: #ff8f5c; transform: translateY(-1px); }
.btn-twitch:active { transform: translateY(0); }

/* account picker list */
.box { text-align: left; }
.box h1 { text-align: left; font-size: 20px; margin-bottom: 22px; }

.acc-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--panel-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    color: var(--paper);
    text-decoration: none;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 17px;
    letter-spacing: 0.02em;
    transition: border-color 0.15s, background 0.15s;
}
.acc-item:hover { border-color: var(--signal); background: var(--panel-hover); }
.acc-item .tag {
    font-family: var(--font-body);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--muted);
    border: 1px solid var(--line);
    padding: 3px 7px;
    border-radius: 4px;
}

/* ==========================================================================
   DASHBOARD
   ========================================================================== */

body.dashboard-body {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 264px;
    background-color: var(--panel);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 22px 20px;
    border-bottom: 1px solid var(--line);
}
.sidebar-header .brand {
    display: flex;
    align-items: center;
    gap: 8px;
}
.sidebar-header h2 {
    font-family: var(--font-display);
    color: var(--paper);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.01em;
}
.sidebar-header .brand .led { margin-top: 1px; }
.sidebar-header p {
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    margin-top: 6px;
    font-family: var(--font-body);
}

.acct-switch {
    padding: 12px 20px;
    border-bottom: 1px solid var(--line);
}
.acct-switch label {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--muted-dim);
}
.acct-switch select { margin-top: 6px; margin-bottom: 0; }

.nav-menu { list-style: none; padding: 12px 0; flex-grow: 1; overflow-y: auto; }
.nav-menu-footer {
    flex-grow: 0;
    flex-shrink: 0;
    overflow-y: visible;
    border-top: 1px solid var(--line);
    padding: 8px 0;
}
.nav-logout { color: var(--muted); }
.nav-logout:hover { color: var(--paper); }
.nav-menu-footer {
    flex-grow: 0;
    flex-shrink: 0;
    overflow-y: visible;
    border-top: 1px solid var(--line);
    padding: 8px 0;
}
.nav-logout { color: var(--muted); }
.nav-logout:hover { color: var(--paper); }
.nav-item {
    padding: 11px 20px;
    cursor: pointer;
    color: var(--muted);
    font-weight: 600;
    font-size: 14.5px;
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    border-left: 2px solid transparent;
}
.nav-icon { display: inline-flex; width: 17px; height: 17px; flex-shrink: 0; }
.nav-icon svg { width: 100%; height: 100%; }
.nav-item:hover { background: var(--panel-raised); color: var(--paper); }
.nav-item.active {
    background: var(--panel-raised);
    color: var(--signal);
    border-left: 2px solid var(--signal);
}

.nav-category { list-style: none; }
.nav-category-header {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 20px;
    cursor: pointer;
    color: var(--muted);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    user-select: none;
    transition: color 0.15s;
}
.nav-category-header:hover { color: var(--paper); }
.nav-category-label { flex: 1 1 auto; }
.nav-category-chevron { display: flex; align-items: center; opacity: 0.6; transition: transform 0.2s; flex-shrink: 0; }
.nav-category-chevron svg { width: 11px; height: 11px; }
.nav-category.expanded .nav-category-chevron { transform: rotate(180deg); }
.nav-category-items {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}
.nav-category.expanded .nav-category-items { max-height: 700px; }
.nav-category-items .nav-item { padding-left: 34px; }

.main-content {
    flex-grow: 1;
    padding: 32px 36px;
    overflow-y: auto;
    background-color: var(--ink);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

h2.section-title {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 22px;
    color: var(--paper);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
    letter-spacing: 0.01em;
}

.card {
    background: var(--panel);
    padding: 22px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    margin-bottom: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    position: relative;
}
.card h3 {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--paper);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
    letter-spacing: 0.01em;
}

label {
    display: block;
    margin-bottom: 6px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 12.5px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--muted);
}

input, select {
    width: 100%;
    padding: 10px 12px;
    background: var(--ink-2);
    border: 1px solid var(--line);
    color: var(--paper);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-size: 14px;
    font-family: var(--font-body);
    transition: border-color 0.15s;
}
input::placeholder { color: var(--muted-dim); }
input:focus, select:focus { border-color: var(--signal); outline: none; }

button {
    background-color: var(--signal);
    color: #14161b;
    border: none;
    padding: 11px 16px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 15.5px;
    letter-spacing: 0.01em;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    width: 100%;
}
button:hover { background-color: #ff8f5c; }
button:active { transform: translateY(1px); }
button.secondary { background-color: var(--panel-raised); color: var(--paper); margin-top: 8px; border: 1px solid var(--line); }
button.secondary:hover { background-color: var(--panel-hover); }
button.secondary.active { background-color: var(--patch); color: #14110f; border-color: var(--patch); }
/* Small inline actions (e.g. "▶ Přehrát" in feed rows) - the default button
   font is Big Shoulders Display, a heavy headline face meant for large CTAs
   like "Uložit"; at 12px next to plain body/mono text it visually clashed. */
button.btn-inline { width: auto; font-family: var(--font-body); font-weight: 600; font-size: 12px; padding: 4px 10px; letter-spacing: 0; }
button.danger { background-color: var(--danger); color: #fff; margin-top: 8px; }
button.danger:hover { background-color: var(--danger-dim); }
button.success-btn { background-color: var(--ok); color: #06180e; margin-top: 8px; }
button.success-btn:hover { background-color: #46e493; }

.success { color: var(--ok); margin-top: 8px; font-size: 13.5px; font-weight: 500; display: none; font-family: var(--font-body); }
.error { color: var(--danger); margin-top: 8px; font-size: 13.5px; font-weight: 500; display: none; font-family: var(--font-body); }

/* Global save/action notification - see showToast() in the dashboard script.
   Separate from .success/.error above, which stay as small inline text for
   the two command-editor modals (a floating toast over an open modal would
   be easy to miss or visually confusing). */
.toast {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 13.5px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    max-width: 320px;
}
.toast.show { display: block; animation: toastIn 0.25s ease-out; }
.toast-success { background: var(--ok); color: #10231a; }
.toast-error { background: var(--danger); color: #fff; }
@keyframes toastIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.feed-list { list-style: none; max-height: 460px; overflow-y: auto; }
.feed-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 2px;
    border-bottom: 1px solid var(--line-soft);
    font-size: 13.5px;
}
.feed-item:last-child { border-bottom: none; }
.follower-name { font-weight: 600; color: var(--patch); }
.follower-time { color: var(--muted); font-size: 12px; font-family: var(--font-body); }

.input-container { position: relative; margin-bottom: 12px; }
.input-container input { margin-bottom: 0; }
.dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: var(--panel-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    max-height: 220px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
}
.dropdown-item { display: flex; align-items: center; padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: var(--panel-hover); }
.dropdown-item img { width: 30px; height: 30px; object-fit: cover; margin-right: 10px; border-radius: 50%; }
.dropdown-item.game-item img { width: 30px; height: 40px; border-radius: 3px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.editor-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 2px;
    border-bottom: 1px solid var(--line-soft);
    font-size: 13.5px;
}
.editor-row:last-child { border-bottom: none; }
.perm-checks { display: flex; gap: 14px; flex-wrap: wrap; margin: 12px 0 18px; }
.perm-checks label {
    display: flex; align-items: center; gap: 7px;
    font-weight: normal; text-transform: none; font-family: var(--font-body);
    font-size: 13px; color: var(--paper-dim);
    margin: 0;
}
.perm-checks input { width: auto; margin: 0; }

.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch-track { position: absolute; inset: 0; background: var(--line); border-radius: 999px; cursor: pointer; transition: background 0.2s; }
.switch-track::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: var(--paper); border-radius: 50%; transition: transform 0.2s; }
.switch input:checked + .switch-track { background: var(--signal); }
.switch input:checked + .switch-track::before { transform: translateX(20px); }

/* Loyalty shop item cards - was previously one .editor-row per item, with a
   plain <button class="btn-secondary"> for delete. That class never existed
   (the real muted-button class is .secondary), so the button fell through to
   the bare `button` selector above - full-width, orange, meant for CTAs like
   "Otevřít obchod" - making every row end in a giant orange bar. */
.shop-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 12px;
}
.shop-item-card {
    background: var(--panel-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.shop-item-card.disabled { opacity: 0.55; }
.shop-item-card-top { display: flex; align-items: center; gap: 8px; }
.shop-item-card-top input[type="text"] { flex: 1; min-width: 0; margin-bottom: 0; font-size: 13.5px; }
.shop-item-cost-row { display: flex; align-items: center; gap: 8px; }
.shop-item-cost-row input[type="number"] { width: 90px; margin-bottom: 0; font-family: var(--font-mono); font-size: 13.5px; }
.shop-item-cost-row span { color: var(--muted); font-size: 12.5px; }
.shop-item-card-actions { display: flex; gap: 8px; margin-top: 2px; }
.shop-item-card-actions button { width: auto; flex: 1; }
.shop-item-thumb { width: 100%; height: 90px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.shop-item-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.shop-item-badge {
    background: var(--panel-hover);
    border: 1px solid var(--line);
    color: var(--paper-dim);
    font-size: 11px;
    font-family: var(--font-body);
    padding: 3px 8px;
    border-radius: 999px;
    white-space: nowrap;
}
.shop-item-badge-warn { background: var(--danger-dim); border-color: var(--danger); color: #fff; }

@media (max-width: 760px) {
    body.dashboard-body { flex-direction: column; height: auto; overflow: auto; }
    .sidebar { width: 100%; }
    .main-content { padding: 22px 18px; }
}
