/* VSOJ design system. Tokens come from themes.css; everything here only reads them. */

:root {
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 22px;
    --org-primary-soft: color-mix(in srgb, var(--org-primary) 12%, var(--org-surface));
    --org-accent-soft: color-mix(in srgb, var(--org-accent) 12%, var(--org-surface));
    --font-body: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
}

html { position: relative; min-height: 100%; }

body {
    font-family: var(--font-body);
    background-color: var(--org-page-bg);
    background-image:
        radial-gradient(900px 400px at 100% -10%, color-mix(in srgb, var(--org-primary) 9%, transparent), transparent),
        radial-gradient(700px 360px at -10% 0%, color-mix(in srgb, var(--org-accent) 8%, transparent), transparent);
    background-repeat: no-repeat;
    color: var(--org-text);
    margin-bottom: 70px;
}

h1, h2, h3, h4, h5 { font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 1.85rem; }
a { color: var(--org-primary); text-decoration: none; }
a:hover, a:focus { color: color-mix(in srgb, var(--org-primary) 78%, black); }
.text-muted { color: var(--org-text-muted) !important; }
code, pre, .mono { font-family: var(--font-mono); }

/* ---------- Icons ---------- */
.ic { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -0.15em; }

/* ---------- Top bar: floating pill ---------- */
.topbar { position: sticky; top: 10px; z-index: 1030; padding: 0 14px; margin-bottom: 22px; }
.topbar-inner {
    max-width: 1320px; margin: 0 auto; padding: 8px 12px;
    display: flex; align-items: center; gap: 6px;
    background: var(--org-navbar-bg);
    border: 1px solid var(--org-border);
    border-radius: 999px;
    box-shadow: var(--org-shadow);
}
.brand { display: flex; align-items: center; gap: 8px; padding: 2px 10px 2px 6px; font-weight: 800; font-size: 1.05rem; color: var(--org-text); white-space: nowrap; }
.brand:hover { color: var(--org-text); }
.brand-mark { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-size: 0.8rem; font-weight: 800; background: linear-gradient(135deg, var(--org-primary), var(--org-accent)); }
.org-logo { height: 28px; width: auto; border-radius: 6px; }

.nav-pills-main { display: flex; align-items: center; gap: 2px; margin: 0; padding: 0; list-style: none; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav-pills-main::-webkit-scrollbar { display: none; }
.nav-pills-main a, .topbar-actions .ghost {
    display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px;
    color: var(--org-navbar-text); font-weight: 600; font-size: 0.92rem; white-space: nowrap; transition: background .15s, color .15s;
}
.nav-pills-main a:hover, .topbar-actions .ghost:hover { background: var(--org-surface-muted); color: var(--org-text); }
.nav-pills-main a.active { background: var(--org-primary-soft); color: var(--org-primary); }

.topbar-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--org-surface-muted); color: var(--org-text-muted); display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { color: var(--org-text); }
.btn-pill { display: inline-flex; align-items: center; gap: 7px; padding: 8px 18px; border-radius: 999px; font-weight: 700; font-size: 0.9rem; border: 1px solid var(--org-border); background: var(--org-surface); color: var(--org-text); }
.btn-pill:hover { background: var(--org-surface-muted); color: var(--org-text); }
.btn-pill.solid { background: var(--org-primary); border-color: var(--org-primary); color: #fff; box-shadow: 0 3px 0 color-mix(in srgb, var(--org-primary) 70%, black); }
.btn-pill.solid:hover { background: color-mix(in srgb, var(--org-primary) 88%, black); color: #fff; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--org-surface-muted); color: var(--org-text); font-weight: 700; font-size: 0.9rem; }
.user-chip:hover { color: var(--org-text); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 0.85rem; background: linear-gradient(135deg, var(--org-accent), var(--org-primary)); }
.rating-pill { font-size: 0.75rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--org-accent-soft); color: var(--org-accent); }
.nav-toggle { display: none; }

@media (max-width: 991px) {
    .topbar-inner { flex-wrap: wrap; border-radius: var(--radius); }
    .nav-pills-main { order: 3; flex-basis: 100%; }
    .topbar-actions { margin-left: auto; }
    .btn-pill .label { display: none; }
}

/* ---------- Surfaces ---------- */
.card, .list-group-item, .surface {
    background: var(--org-surface); color: var(--org-text); border-color: var(--org-border);
}
.card { border-radius: var(--radius); box-shadow: var(--org-shadow); border: 1px solid var(--org-border); }
.surface { border: 1px solid var(--org-border); border-radius: var(--radius); box-shadow: var(--org-shadow); }
.list-group { border-radius: var(--radius); overflow: hidden; box-shadow: var(--org-shadow); }
.list-group-item { padding: 0.8rem 1.1rem; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; font-size: 1.15rem; }
.section-title .chip-ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--org-primary-soft); color: var(--org-primary); }

/* ---------- Hero ---------- */
.hero {
    position: relative; overflow: hidden; border-radius: var(--radius-lg); padding: 34px 38px; margin-bottom: 26px;
    color: #fff; background: linear-gradient(120deg, var(--org-primary), var(--org-accent));
    box-shadow: var(--org-shadow-strong);
}
.hero::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(135deg, rgba(255,255,255,.06) 0 14px, transparent 14px 28px); }
.hero.has-image { background-size: cover; background-position: center; }
.hero.has-image::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--org-banner-overlay), transparent 80%); }
.hero > * { position: relative; z-index: 1; }
.hero h1 { color: #fff; font-size: 1.9rem; margin-bottom: 6px; }
.hero p { max-width: 640px; opacity: .92; margin-bottom: 18px; }
.hero .btn-pill { border-color: transparent; }
.hero .btn-pill.light { background: #fff; color: var(--org-primary); }
.hero .btn-pill.outline { background: transparent; color: #fff; border-color: rgba(255,255,255,.7); }

/* ---------- Buttons ---------- */
.btn { border-radius: 999px; font-weight: 600; }
.btn-sm { border-radius: 999px; }
.btn-primary {
    --bs-btn-bg: var(--org-primary); --bs-btn-border-color: var(--org-primary);
    --bs-btn-hover-bg: color-mix(in srgb, var(--org-primary) 86%, black); --bs-btn-hover-border-color: color-mix(in srgb, var(--org-primary) 80%, black);
    --bs-btn-active-bg: color-mix(in srgb, var(--org-primary) 76%, black); --bs-btn-active-border-color: color-mix(in srgb, var(--org-primary) 70%, black);
    --bs-btn-disabled-bg: var(--org-primary); --bs-btn-disabled-border-color: var(--org-primary);
    box-shadow: 0 3px 0 color-mix(in srgb, var(--org-primary) 70%, black);
}
.btn-outline-primary { --bs-btn-color: var(--org-primary); --bs-btn-border-color: var(--org-primary); --bs-btn-hover-bg: var(--org-primary); --bs-btn-hover-border-color: var(--org-primary); --bs-btn-active-bg: var(--org-primary); --bs-btn-active-border-color: var(--org-primary); }
.btn-outline-secondary { --bs-btn-color: var(--org-text-muted); --bs-btn-border-color: var(--org-border); --bs-btn-hover-bg: var(--org-surface-muted); --bs-btn-hover-color: var(--org-text); --bs-btn-hover-border-color: var(--org-border); }

/* ---------- Tables ---------- */
.table { color: var(--org-text); border-color: var(--org-border); --bs-table-bg: transparent; }
.table > :not(caption) > * > * { background-color: var(--org-surface); color: var(--org-text); border-bottom-color: var(--org-border); padding: .75rem .9rem; }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--org-text-muted); font-weight: 700; background: var(--org-surface-muted); border-bottom: 1px solid var(--org-border); }
.table-striped > tbody > tr:nth-of-type(odd) > * { background-color: var(--org-surface); }
.table-hover > tbody > tr:hover > * { background-color: var(--org-primary-soft); }
.table-wrap { border: 1px solid var(--org-border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--org-shadow); background: var(--org-surface); }
.table-wrap .table { margin: 0; }
.table-wrap .table tbody tr:last-child > * { border-bottom: 0; }

/* ---------- Forms ---------- */
.form-control, .form-select { background-color: var(--org-surface); color: var(--org-text); border-color: var(--org-border); border-radius: var(--radius-sm); }
.form-control:focus, .form-select:focus { background-color: var(--org-surface); color: var(--org-text); border-color: var(--org-primary); box-shadow: 0 0 0 .22rem color-mix(in srgb, var(--org-primary) 22%, transparent); }
.form-label { font-weight: 600; font-size: .9rem; }

/* ---------- Badges & chips ---------- */
.badge { font-weight: 700; border-radius: 999px; padding: .42em .8em; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--org-surface-muted); color: var(--org-text-muted); border: 1px solid var(--org-border); }
.chip.ok { background: color-mix(in srgb, var(--org-success) 14%, var(--org-surface)); color: var(--org-success); border-color: transparent; }
.chip.warn { background: color-mix(in srgb, var(--org-warning) 16%, var(--org-surface)); color: var(--org-warning); border-color: transparent; }
.chip.bad { background: color-mix(in srgb, var(--org-danger) 14%, var(--org-surface)); color: var(--org-danger); border-color: transparent; }
.chip.info { background: var(--org-primary-soft); color: var(--org-primary); border-color: transparent; }
.chip.private { background: var(--org-accent-soft); color: var(--org-accent); border-color: transparent; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.diff-Beginner, .diff-Easy { background: color-mix(in srgb, var(--org-success) 14%, var(--org-surface)); color: var(--org-success); }
.diff-Medium, .diff-Intermediate { background: var(--org-accent-soft); color: var(--org-accent); }
.diff-Hard, .diff-Advanced { background: color-mix(in srgb, var(--org-warning) 16%, var(--org-surface)); color: var(--org-warning); }
.diff-Expert { background: color-mix(in srgb, var(--org-danger) 14%, var(--org-surface)); color: var(--org-danger); }

/* ---------- Tabs (contest detail) ---------- */
.tabs-bar { display: flex; gap: 4px; padding: 6px; margin-bottom: 18px; overflow-x: auto; background: var(--org-surface); border: 1px solid var(--org-border); border-radius: var(--radius); box-shadow: var(--org-shadow); }
.tabs-bar a { display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 12px; font-weight: 600; font-size: .92rem; color: var(--org-text-muted); white-space: nowrap; }
.tabs-bar a:hover { color: var(--org-text); background: var(--org-surface-muted); }
.tabs-bar a.active { background: var(--org-primary); color: #fff; box-shadow: 0 3px 0 color-mix(in srgb, var(--org-primary) 70%, black); }

/* ---------- Contest cards ---------- */
.contest-row { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--org-border); }
.contest-row:last-child { border-bottom: 0; }
.contest-row .info { flex: 1; min-width: 0; }
.contest-row .title { font-weight: 700; font-size: 1.02rem; }
.contest-row .meta { color: var(--org-text-muted); font-size: .84rem; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.stat-strip { display: flex; flex-wrap: wrap; gap: 18px; margin: 4px 0 6px; color: var(--org-text-muted); font-size: .9rem; }
.stat-strip b { color: var(--org-text); }

.status-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 16px 20px; margin-bottom: 18px; border-radius: var(--radius); background: var(--org-surface); border: 1px solid var(--org-border); box-shadow: var(--org-shadow); }
.status-banner .state { display: flex; align-items: center; gap: 12px; font-weight: 700; }
.status-banner .pulse { width: 14px; height: 14px; border-radius: 50%; background: var(--org-success); box-shadow: 0 0 0 4px color-mix(in srgb, var(--org-success) 25%, transparent); animation: pulse 1.8s infinite; }
.status-banner.ended .pulse, .status-banner.upcoming .pulse { animation: none; background: var(--org-text-muted); box-shadow: none; }
.status-banner.upcoming .pulse { background: var(--org-warning); }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--org-success) 6%, transparent); } }
.countdown { display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px; border-radius: 14px; border: 1px solid var(--org-border); background: var(--org-surface-muted); font-weight: 700; }
.countdown .lbl { font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--org-text-muted); }
.countdown .val { font-family: var(--font-mono); font-size: 1.05rem; color: var(--org-success); }
.countdown.ended .val { color: var(--org-text-muted); }

/* ---------- Floating "contest in progress" widget ---------- */
.live-widget { position: fixed; right: 18px; bottom: 18px; z-index: 1040; width: 290px; overflow: hidden; border-radius: var(--radius); background: var(--org-surface); border: 2px solid var(--org-success); box-shadow: var(--org-shadow-strong); }
.live-widget .head { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--org-success); color: #fff; font-weight: 800; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; cursor: pointer; }
.live-widget .head .dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; }
.live-widget .head .caret { margin-left: auto; transition: transform .2s; }
.live-widget.collapsed .body { display: none; }
.live-widget.collapsed .head .caret { transform: rotate(180deg); }
.live-widget .body { padding: 12px 14px 4px; }
.live-widget .name { font-weight: 700; font-size: .92rem; line-height: 1.35; margin-bottom: 10px; }
.live-widget .left { padding: 8px 12px; border-radius: 12px; background: var(--org-surface-muted); border: 1px solid var(--org-border); margin-bottom: 10px; }
.live-widget .left .lbl { font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; color: var(--org-text-muted); font-weight: 700; }
.live-widget .left .val { font-family: var(--font-mono); font-weight: 700; font-size: 1.2rem; color: var(--org-success); }
.live-widget .links { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--org-border); margin: 0 -14px; }
.live-widget .links a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 4px; font-size: .74rem; font-weight: 700; color: var(--org-text-muted); }
.live-widget .links a:hover { background: var(--org-surface-muted); color: var(--org-primary); }
@media (max-width: 575px) { .live-widget { width: calc(100% - 28px); right: 14px; } }

/* ---------- Problem / submission bits ---------- */
pre.statement-sample { background: var(--org-surface-muted); border: 1px solid var(--org-border); border-radius: var(--radius-sm); padding: .85rem 1rem; white-space: pre-wrap; word-break: break-word; color: var(--org-text); font-family: var(--font-mono); font-size: .88rem; }
.verdict-Accepted { color: var(--org-success); font-weight: 700; }
.verdict-WrongAnswer, .verdict-RuntimeError, .verdict-InternalError { color: var(--org-danger); font-weight: 700; }
.verdict-TimeLimitExceeded, .verdict-MemoryLimitExceeded, .verdict-PartialScore { color: var(--org-warning); font-weight: 700; }
.verdict-CompileError, .verdict-Skipped { color: var(--org-text-muted); font-weight: 700; }
.verdict-Pending, .verdict-Judging { color: var(--org-primary); font-weight: 700; }
.verdict-Judging::before, .verdict-Pending::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: currentColor; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* ---------- Stat cards (admin dashboard) ---------- */
.stat-card { text-align: center; padding: 18px 10px; border-radius: var(--radius); background: var(--org-surface); border: 1px solid var(--org-border); box-shadow: var(--org-shadow); }
.stat-card h3 { margin: 0; font-size: 1.7rem; color: var(--org-primary); }
.stat-card small { color: var(--org-text-muted); font-weight: 600; }

.alert { border-radius: var(--radius-sm); }
.footer { position: absolute; bottom: 0; width: 100%; white-space: nowrap; line-height: 60px; background: transparent; border-top: 1px solid var(--org-border) !important; }
.footer a { color: var(--org-text-muted); }
.org-banner { display: none; }
