/* ============================================================================
   SkinHamster — Design tokens & base styles
   "Trading-terminal meets gaming": dark, high-contrast, data-dense, gold accent.
   ============================================================================ */

/* ---- Self-hosted fonts ----
   Drop the .woff2 files into wwwroot/fonts (see README). Until then the stacks
   fall back to generic families (never Inter/Roboto/Arial by design intent). */
@font-face {
    font-family: "Clash Display";
    src: url("/fonts/ClashDisplay-Semibold.woff2") format("woff2");
    font-weight: 600;
    font-display: swap;
}
@font-face {
    font-family: "Satoshi";
    src: url("/fonts/Satoshi-Variable.woff2") format("woff2");
    font-weight: 300 900;
    font-display: swap;
}
@font-face {
    font-family: "JetBrains Mono";
    src: url("/fonts/JetBrainsMono-Regular.woff2") format("woff2");
    font-weight: 400 700;
    font-display: swap;
}

:root {
    /* Surfaces */
    --bg: #0B0E12;
    --surface: #14181F;
    --surface-2: #1C222B;
    --border: #2A313C;
    --border-strong: #3A434F;

    /* Text */
    --text: #F2F4F7;
    --text-muted: #9AA4B2;
    --text-dim: #6B7480;

    /* Brand accent — gold/amber, used sparingly */
    --accent: #E8B23A;
    --accent-hover: #F3C766;
    --accent-soft: rgba(232, 178, 58, 0.12);

    /* Market semantics (never color-only — pair with ▲/▼ and signs) */
    --up: #3FB984;
    --down: #E5564B;

    /* Rarity scale (abstract, common -> exotic) */
    --rarity-common: #8A93A0;
    --rarity-uncommon: #4F9DDA;
    --rarity-rare: #8C6FE6;
    --rarity-epic: #D14FB0;
    --rarity-exotic: #E8B23A;

    /* Typography */
    --font-display: "Clash Display", "Satoshi", ui-sans-serif, sans-serif;
    --font-body: "Satoshi", "General Sans", ui-sans-serif, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", monospace;

    /* Radii & shadows */
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);

    --space: 16px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text);
    margin: 0 0 0.5em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Blazor's FocusOnNavigate focuses the page <h1> (via tabindex=-1) after each navigation;
   hide that programmatic focus outline (keyboard focus on real controls stays visible). */
[tabindex="-1"]:focus { outline: none; }

/* Tabular numerals everywhere numbers matter */
.mono, .num, table.data td, .price {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* ---- Layout shell ---- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    height: 60px;
    padding: 0 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.15rem;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.brand .dot { color: var(--accent); }
.brand-logo { height: 32px; width: auto; display: block; }

.topnav { display: flex; gap: 4px; }
.topnav a {
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}
.topnav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.topnav a.active { color: var(--accent); background: var(--accent-soft); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

/* User dropdown (pure CSS via <details>) */
.user-menu { position: relative; }
.user-menu > summary {
    list-style: none; cursor: pointer; user-select: none;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 12px; border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong); color: var(--text); font-weight: 500;
}
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary::after { content: "▾"; color: var(--text-muted); }
.user-menu[open] > summary { background: var(--surface-2); border-color: var(--accent); }
.user-menu-panel {
    position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; z-index: 50;
    background: var(--surface-2); border: 1px solid var(--border-strong);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px;
    display: flex; flex-direction: column; gap: 2px;
}
.user-menu-panel a, .user-menu-panel button {
    display: block; width: 100%; text-align: left; background: transparent; border: 0;
    color: var(--text); padding: 9px 12px; border-radius: var(--radius-sm);
    font: inherit; cursor: pointer; text-decoration: none;
}
.user-menu-panel a:hover, .user-menu-panel button:hover { background: var(--surface); }
.user-menu-panel form { margin: 4px 0 0; border-top: 1px solid var(--border); padding-top: 4px; }
.user-menu-panel button { color: var(--down); }

.content { flex: 1; padding: 28px 24px; max-width: 1280px; width: 100%; margin: 0 auto; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #1A1205; }
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-outline:hover { background: var(--surface-2); text-decoration: none; }
.btn-danger { background: transparent; color: var(--down); border-color: var(--down); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Cards & surfaces ---- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.card-2 { background: var(--surface-2); }

.grid { display: grid; gap: 18px; }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.cols-2 { grid-template-columns: 1.4fr 1fr; }
@media (max-width: 900px) { .cols-2 { grid-template-columns: 1fr; } }

/* ---- Skin cards ---- */
.skin-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--rarity, var(--rarity-common));
    border-radius: var(--radius);
    padding: 16px;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
    display: block;
    color: var(--text);
}
.skin-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    text-decoration: none;
    border-color: var(--border-strong);
}
.skin-card .thumb {
    height: 120px;
    border-radius: var(--radius-sm);
    background: radial-gradient(120% 120% at 30% 20%, var(--surface-2), #0d1117);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-dim);
    margin-bottom: 12px;
}
.skin-card .thumb img { max-height: 100%; max-width: 100%; object-fit: contain; }
.skin-card .name { font-weight: 600; margin-bottom: 2px; }
.skin-card .sub { color: var(--text-muted); font-size: 0.85rem; }
.skin-card .row { display: flex; justify-content: space-between; margin-top: 10px; }

/* ---- Badges ---- */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.75rem; font-weight: 600;
    padding: 3px 9px; border-radius: 999px;
    border: 1px solid var(--border-strong); color: var(--text-muted);
}
.badge-ok { color: var(--up); border-color: rgba(63,185,132,0.4); background: rgba(63,185,132,0.1); }
.badge-warn { color: var(--accent); border-color: rgba(232,178,58,0.4); background: var(--accent-soft); }
.badge-off { color: var(--down); border-color: rgba(229,86,75,0.4); background: rgba(229,86,75,0.1); }

/* ---- Tables ---- */
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: right; padding: 8px 12px; border-bottom: 1px solid var(--border); }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data th { color: var(--text-dim); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.up { color: var(--up); }
.down { color: var(--down); }

/* ---- Forms ---- */
.field { margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }
.input, input[type="text"], input[type="email"], input[type="password"], input[type="number"], select {
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 10px 12px;
    font-family: var(--font-body);
    font-size: 0.95rem;
}
.input:focus, input:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.validation-message, .text-danger { color: var(--down); font-size: 0.85rem; }

/* Password strength meter (informational) */
.pw-meter { height: 6px; border-radius: 3px; background: var(--surface-2); margin: 8px 0 4px; overflow: hidden; }
.pw-meter-bar { height: 100%; width: 0; background: var(--down); transition: width 0.2s ease, background-color 0.2s ease; }
.pw-meter-label { font-size: 0.78rem; color: var(--text-muted); }

/* ---- Misc ---- */
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .label { font-size: 0.78rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; }
.stat .value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 1.1rem; }
.alert { padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); margin-bottom: 16px; }
.alert-ok { color: var(--up); border-color: rgba(63,185,132,0.4); background: rgba(63,185,132,0.08); }
.alert-err { color: var(--down); border-color: rgba(229,86,75,0.4); background: rgba(229,86,75,0.08); }
.hero {
    border-radius: var(--radius);
    padding: 56px 40px;
    background:
        radial-gradient(80% 120% at 80% -10%, rgba(232,178,58,0.14), transparent 60%),
        linear-gradient(180deg, var(--surface), var(--bg));
    border: 1px solid var(--border);
}
.hero-logo {
    height: 120px;
    width: auto;
    display: block;
    margin-bottom: 20px;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.45));
}
.steps { display: flex; gap: 10px; margin-bottom: 24px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-muted); }
.step.done { color: var(--up); border-color: rgba(63,185,132,0.4); }
.step.active { color: var(--accent); border-color: rgba(232,178,58,0.5); background: var(--accent-soft); }

/* ============================================================================
   Design system v2 — trading terminal components
   ============================================================================ */

/* Custom scrollbars (dark) */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; }
*::-webkit-scrollbar-track { background: transparent; }

/* Page section headers */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--text-muted); margin: 4px 0 0; }
.eyebrow { font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.section-title { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 1.15rem; margin: 0 0 12px; }

/* Segmented control (Buy/Sell, tabs) */
.segmented { display: inline-flex; background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 3px; gap: 3px; }
.segmented button { border: 0; background: transparent; color: var(--text-muted); font-weight: 600; padding: 7px 16px; border-radius: 5px; cursor: pointer; font-family: var(--font-body); transition: background-color .12s, color .12s; }
.segmented button:hover { color: var(--text); }
.segmented button.on-buy { background: rgba(63,185,132,0.16); color: var(--up); }
.segmented button.on-sell { background: rgba(229,86,75,0.16); color: var(--down); }

/* Price ticker with flash */
.ticker { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 1.8rem; font-weight: 700; }
@keyframes flash-up { 0% { color: var(--up); text-shadow: 0 0 16px rgba(63,185,132,0.6); } 100% {} }
@keyframes flash-down { 0% { color: var(--down); text-shadow: 0 0 16px rgba(229,86,75,0.6); } 100% {} }
.flash-up { animation: flash-up 0.6s ease-out; }
.flash-down { animation: flash-down 0.6s ease-out; }

/* Order book depth rows (price | size | depth bar overlay) */
.book { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 0.9rem; }
.book th { color: var(--text-dim); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; text-align: right; padding: 4px 10px; }
.book td { position: relative; padding: 4px 10px; text-align: right; }
.book td:first-child { text-align: left; }
.book .depth { position: absolute; top: 2px; bottom: 2px; right: 0; border-radius: 3px; z-index: 0; opacity: 0.16; }
.book .depth.bid { background: var(--up); }
.book .depth.ask { background: var(--down); }
.book .cell { position: relative; z-index: 1; }
.book tr.spread td { text-align: center; color: var(--text-dim); font-family: var(--font-body); padding: 8px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.book .px-bid { color: var(--up); }
.book .px-ask { color: var(--down); }

/* SVG price chart */
.chart { width: 100%; height: 160px; display: block; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; }
.chart .area { fill: url(#chartFill); }
.chart .axis { stroke: var(--border); stroke-width: 1; }
.chart .lbl { fill: var(--text-dim); font-family: var(--font-mono); font-size: 10px; }

/* Skeleton loaders */
@keyframes shimmer { 100% { transform: translateX(100%); } }
.skeleton { position: relative; overflow: hidden; background: var(--surface-2); border-radius: var(--radius-sm); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent); animation: shimmer 1.3s infinite; }
.skeleton.line { height: 12px; margin: 6px 0; }
.skeleton.thumb { height: 120px; }

/* Toasts */
.toast-host { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 1000; }
.toast { min-width: 260px; max-width: 360px; padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
    background: var(--surface-2); box-shadow: var(--shadow); animation: toast-in 0.25s ease-out; }
.toast.ok { border-color: rgba(63,185,132,0.5); }
.toast.err { border-color: rgba(229,86,75,0.5); }
.toast .t-title { font-weight: 600; margin-bottom: 2px; }
.toast .t-body { color: var(--text-muted); font-size: 0.88rem; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Empty states with mascot */
.empty { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty .mascot { font-size: 2.5rem; margin-bottom: 10px; opacity: 0.9; }
.empty h3 { font-family: var(--font-display); color: var(--text); margin: 0 0 6px; }

/* Marketplace list (catalog as a market) */
.skin-card .px-row { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; }
.skin-card .last { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 1.05rem; font-weight: 600; }
.spread-chip { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-dim); }
.rarity-tag { display: inline-block; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
    padding: 2px 7px; border-radius: 4px; color: var(--rarity, var(--rarity-common)); border: 1px solid currentColor; opacity: 0.9; }
.skin-card { box-shadow: 0 0 0 0 transparent; }
.skin-card:hover { box-shadow: var(--shadow), 0 0 0 1px var(--rarity, var(--border-strong)); }

/* Trading terminal grid (desktop-first, dense) */
.terminal { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 16px; }
.terminal .full { grid-column: 1 / -1; }
@media (max-width: 1000px) { .terminal { grid-template-columns: 1fr; } }

/* ---- Landing page ---- */
.lp-hero h1 { font-size: 2.9rem; line-height: 1.04; max-width: 16ch; margin-top: 18px; }
.lp-section { margin-top: 56px; }
.feature-ico { font-size: 1.9rem; line-height: 1; margin-bottom: 10px; }
.step-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 999px;
    background: var(--accent-soft); color: var(--accent);
    font-weight: 700; font-family: var(--font-display); margin-bottom: 12px;
}
.lp-foot {
    text-align: center; margin-top: 56px; padding: 48px 24px;
    border-radius: var(--radius); border: 1px solid var(--border);
    background: radial-gradient(70% 140% at 50% 0%, rgba(232,178,58,0.10), transparent 60%), var(--surface);
}

/* ---- Admin: stat cards, thumbnails, rarity labels ---- */
.stat-grid {
    display: grid; gap: 14px; margin-top: 18px;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px 18px;
}
.stat-num { font-size: 1.7rem; font-weight: 700; font-family: var(--font-display); line-height: 1.1; }
.stat-num.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.stat-lbl { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; }
.stat-sub { color: var(--text-dim); font-size: 0.78rem; margin-top: 2px; }

.meta-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.btn-sm { padding: 4px 12px; font-size: 0.82rem; }

/* image thumbnail used in admin tables */
img.thumb {
    width: 72px; height: 48px; object-fit: contain;
    background: radial-gradient(120% 120% at 30% 20%, var(--surface-2), #0d1117);
    border-radius: var(--radius-sm); padding: 2px;
}

/* rarity label (table cells) */
.rarity { display: inline-block; font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.04em; padding: 2px 8px; border-radius: 4px; border: 1px solid currentColor; opacity: 0.92; }
.rarity-common { color: var(--rarity-common); }
.rarity-uncommon { color: var(--rarity-uncommon); }
.rarity-rare { color: var(--rarity-rare); }
.rarity-epic { color: var(--rarity-epic); }
.rarity-exotic { color: var(--rarity-exotic); }

/* admin tables: default left-aligned, numeric columns right-aligned */
table.data.adm th, table.data.adm td { text-align: left; vertical-align: middle; }
table.data.adm th.num, table.data.adm td.num { text-align: right; }

/* ---- Footer ---- */
.site-footer {
    border-top: 1px solid var(--border);
    margin-top: 56px;
    padding: 24px;
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}
.site-footer .links { display: flex; gap: 18px; flex-wrap: wrap; }
.site-footer .links a { color: var(--text-muted); font-size: 0.9rem; }
.site-footer .links a:hover { color: var(--text); }
.site-footer .copy { margin-top: 10px; font-size: 0.82rem; color: var(--text-dim); }

/* ---- Cookie consent ---- */
.cookie-consent {
    position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 1000;
    display: none; /* shown by js when consent not yet given */
    align-items: center; gap: 16px; flex-wrap: wrap; justify-content: space-between;
    background: var(--surface-2); border: 1px solid var(--border-strong);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 18px;
    max-width: 1100px; margin: 0 auto;
}
.cookie-consent p { margin: 0; color: var(--text-muted); font-size: 0.9rem; max-width: 70ch; }

/* ---- Legal / prose pages ---- */
.legal { max-width: 780px; margin: 0 auto; }
.legal h2 { font-size: 1.25rem; margin-top: 30px; }
.legal h3 { font-size: 1.05rem; margin-top: 20px; }
.legal p, .legal li { color: var(--text-muted); line-height: 1.65; }
.legal ul { padding-left: 20px; }
.legal address { font-style: normal; color: var(--text); }
.legal-notice {
    border: 1px solid rgba(232,178,58,0.4); background: var(--accent-soft);
    color: var(--accent); border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 24px;
    font-size: 0.9rem;
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
