/* Shared UI for every page except Broadcast View (which owns a fully separate designed
   canvas/theme system — see broadcast-view.php's own <style> block, deliberately not this
   file). Visual polish only: nothing here is relied on by page JS for behaviour — JS always
   targets element #ids, never these classes — so this file is safe to restyle freely without
   touching markup or scripts. CPC-inspired dark navy/cyan/yellow palette throughout, same as
   before, just with real spacing, contrast and control styling instead of unstyled defaults. */

@font-face {
    font-family: 'CPC464';
    src: url('/assets/fonts/cpc464.woff2') format('woff2'),
         url('/assets/fonts/cpc464.woff') format('woff'),
         url('/assets/fonts/cpc464.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: #000010;
    --panel: #000090;
    --panel-border: #4d4dff;
    --accent: #00ffff;
    --highlight: #ffff00;
    --text: #e8e8ff;
    --text-muted: #b0b0ff;
    --danger: #ff6b6b;
    --radius: 6px;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    line-height: 1.5;
    margin: 0;
    padding: 0 1.5rem 3rem;
}

.crt-header {
    padding: 1.5rem 0 1rem;
    border-bottom: 2px solid var(--accent);
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
}

/* Signed-in identity + account actions, top right of the header — like a normal site's
   navbar, instead of buried as a line of body text. */
.account-bar {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    font-size: 0.9rem;
}

.account-bar form {
    display: inline;
}

.account-name {
    color: var(--text);
    font-weight: bold;
}

.crt-header h1 {
    font-family: "Courier New", monospace;
    color: var(--highlight);
    letter-spacing: 0.1em;
    margin: 0;
    font-size: 1.75rem;
}

.tagline {
    color: var(--accent);
    margin: 0.3rem 0 0;
}

/* Player-facing pages only (body.retro, set per-view) — just the title/tagline get the pixel
   font; the rest of the page stays normal readable text, same as admin/host screens. */
body.retro .crt-header h1 {
    font-family: 'CPC464', 'Courier New', monospace;
    font-size: 2rem;
    -webkit-font-smoothing: none;
    font-smooth: never;
}

body.retro .tagline {
    font-family: 'CPC464', 'Courier New', monospace;
    font-size: 1.1rem;
    -webkit-font-smoothing: none;
    font-smooth: never;
}

main {
    max-width: 60rem;
    margin: 1.5rem auto 0;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    padding: 1.5rem 1.75rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

h2 {
    color: var(--highlight);
    font-size: 1.15rem;
    margin: 1.75rem 0 0.85rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--panel-border);
}

h2:first-child {
    margin-top: 0;
}

h3 {
    color: var(--accent);
    font-size: 1rem;
    margin: 1.25rem 0 0.5rem;
}

p {
    margin: 0 0 0.85rem;
}

strong {
    color: #fff;
}

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

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

/* --- Forms --- */

label {
    color: var(--text-muted);
}

/* Checkbox/radio labels read better inline with their text than as a block caption. */
label:has(input[type="checkbox"]),
label:has(input[type="radio"]) {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text);
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="search"],
select,
textarea {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--panel-border);
    border-radius: 4px;
    padding: 0.4rem 0.6rem;
    font: inherit;
    font-size: 0.95rem;
}

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

textarea {
    font-family: inherit;
    resize: vertical;
}

input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--accent);
    width: 1rem;
    height: 1rem;
}

input[type="file"] {
    color: var(--text-muted);
}

fieldset {
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    padding: 0.9rem 1.1rem 0.4rem;
    margin: 0 0 1.1rem;
}

legend {
    color: var(--highlight);
    padding: 0 0.4rem;
    font-size: 0.9rem;
    font-weight: bold;
}

button,
input[type="submit"] {
    background: var(--highlight);
    color: #000;
    border: none;
    border-radius: 4px;
    padding: 0.5rem 1.1rem;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9rem;
}

button:hover,
input[type="submit"]:hover {
    filter: brightness(1.12);
}

button:active,
input[type="submit"]:active {
    filter: brightness(0.95);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: none;
}

/* A button that should read as a plain link (e.g. "Sign out" sitting next to real <a> links
   in the account bar) rather than a loud yellow CTA. */
.link-btn {
    background: none;
    border: none;
    color: var(--accent);
    padding: 0;
    font-weight: normal;
    font-size: inherit;
    text-decoration: underline;
}

.link-btn:hover {
    color: var(--highlight);
    filter: none;
}

.error {
    color: var(--danger);
    font-weight: bold;
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid var(--danger);
    border-radius: 4px;
    padding: 0.6rem 0.85rem;
    margin: 0 0 0.85rem;
}

/* --- Tables --- */

/* Wraps every admin data table: scrolls internally on narrow viewports instead of blowing
   out the whole page's width (a wide table used to drag a horizontal scrollbar under the
   entire site, filters and all, off screen with it). */
.table-scroll {
    overflow-x: auto;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    margin: 0 0 1rem;
}

.table-scroll table {
    margin: 0;
    border: none;
    border-radius: 0;
}

table {
    border-collapse: collapse;
    width: 100%;
    margin: 0 0 1rem;
}

th, td {
    border: 1px solid var(--panel-border);
    padding: 0.45rem 0.6rem;
    text-align: left;
    vertical-align: middle;
    font-size: 0.9rem;
}

th {
    background: rgba(0, 255, 255, 0.08);
    color: var(--accent);
    white-space: nowrap;
}

tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.03);
}

tbody tr:hover {
    background: rgba(0, 255, 255, 0.07);
}

/* Compact action buttons for table rows, where several actions sit side by side — the
   default full-size button (styled for standalone "Save"/"Filter" etc.) is too heavy when
   there are 2-3 of them crammed into one cell. */
.row-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.row-actions form {
    display: inline;
    margin: 0;
}

.btn-sm {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--panel-border);
    border-radius: 4px;
    padding: 0.2rem 0.55rem;
    font-size: 0.8rem;
    font-weight: normal;
}

.btn-sm:hover {
    background: var(--panel-border);
    color: var(--text);
    filter: none;
}

.btn-sm.btn-danger {
    color: var(--danger);
    border-color: var(--danger);
}

.btn-sm.btn-danger:hover {
    background: var(--danger);
    color: #000;
}

/* --- Misc --- */

.dev-user-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem 1rem;
    margin: 0 0 1rem;
}

.filter-bar label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
}

/* --- Home dashboard: main content + a nav sidebar on the right, instead of one long list
   of pipe-separated links --- */

main.dashboard {
    max-width: 72rem;
    display: grid;
    grid-template-columns: 1fr 230px;
    gap: 2rem;
}

@media (max-width: 720px) {
    main.dashboard {
        grid-template-columns: 1fr;
    }
}

.dashboard-main section {
    margin: 0 0 2rem;
}

.dashboard-main section:last-child {
    margin-bottom: 0;
}

.highlight-card {
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    background: rgba(0, 255, 255, 0.06);
}

.highlight-card h2 {
    margin-top: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.cta {
    display: inline-block;
    background: var(--highlight);
    color: #000;
    font-weight: bold;
    padding: 0.55rem 1.2rem;
    border-radius: 4px;
    text-decoration: none;
}

.cta:hover {
    filter: brightness(1.12);
}

.quiz-list {
    list-style: none;
    padding: 0;
    margin: 0 0 0.75rem;
}

.quiz-list li {
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--panel-border);
}

.quiz-list li:last-child {
    border-bottom: none;
}

.dashboard-sidebar {
    border-left: 1px solid var(--panel-border);
    padding-left: 1.5rem;
}

@media (max-width: 720px) {
    .dashboard-sidebar {
        border-left: none;
        border-top: 1px solid var(--panel-border);
        padding-left: 0;
        padding-top: 1.5rem;
    }
}

.nav-group {
    margin: 0 0 1.5rem;
}

.nav-group h3 {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.75rem;
    margin: 0 0 0.6rem;
}

.nav-group ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
