/* party-os management console
 *
 * Tokens are taken from the public site's compiled stylesheet (apps/web/css/style.css), not from
 * apps/web/scss/style.scss — the SCSS has drifted out of date and still describes a light pink
 * theme the site stopped using. The live site is dark charcoal with a blue accent, so the console
 * is too.
 *
 * Bootstrap is deliberately absent: this whole file is smaller than the CDN request the old
 * dashboard made for it.
 */

@font-face {
    font-family: 'Brush';
    src: url('../assets/fonts/Never Brat.ttf') format('truetype');
    font-display: swap;
}

:root {
    /* Straight from the public site */
    --primary: #1282ef;
    --primary-2: #35374f;
    --highlights: #f46036;
    --bg: #212529;
    --surface: #343a40;
    --surface-2: #495057;
    --line: #575f66;
    --ink: #ffffff;
    --muted: #adb5bd;

    --ok: #28a745;
    --warn: #ffc107;
    --err: #dc3545;

    --radius: 5px;
    --radius-lg: 10px;
    --radius-pill: 25px;
    --shadow: 0 2px 6px rgba(0, 0, 0, .25);

    --font: 'Lato', Arial, sans-serif;
    --font-display: 'Brush', sans-serif;
}

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

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-weight: 400; line-height: 1.3; margin: 0; color: var(--ink); }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }

a { color: var(--primary); text-decoration: none; transition: .3s all ease; }
a:hover { color: #4ba0f5; }

/* The site's display face, with its blue glow. Used only for the wordmark — at 90px on the public
 * site it is the hero; here it stays small so the data keeps the attention. */
.brand {
    font-family: var(--font-display);
    font-size: 30px;
    line-height: 1;
    color: var(--primary);
    text-shadow: rgb(0 17 255) 0 0 5px;
    letter-spacing: .02em;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 14px 0;
    margin-bottom: 32px;
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.topbar-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    color: var(--muted);
}

.nav-links { display: flex; gap: 18px; font-size: 15px; }
.nav-links a { color: var(--muted); }
.nav-links a:hover { color: var(--ink); }
.nav-links a.active { color: var(--ink); font-weight: 700; }

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.page-header p { margin: 4px 0 0; color: var(--muted); font-size: 15px; }

section { margin-bottom: 36px; }

/* ── Cards & tiles ───────────────────────────────────────────────────────── */

.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.card-body { padding: 20px; }

.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.tile {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow);
}
.tile-value { font-size: 32px; font-weight: 300; line-height: 1.1; }
.tile-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    margin-top: 6px;
}
.tile-accent .tile-value { color: var(--primary); }

/* ── Tables ──────────────────────────────────────────────────────────────── */

.table-scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 15px; }
th {
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

.cell-date { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); }
.cell-title { font-weight: 700; }
.cell-actions { text-align: right; white-space: nowrap; }

.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-weight: 400; margin-bottom: 4px; }

/* ── Provenance badges ───────────────────────────────────────────────────────
 *
 * The signature element of this console. Crawled descriptions are written by somebody else, so
 * where a row came from is a fact the operator needs at a glance on every row — not something
 * buried in a detail view. Three states, distinguishable without reading the label:
 *
 *   manual     solid blue     party-os owns this text
 *   crawler    outlined grey  scraped; names the source
 *   override   orange         scraped, then corrected by a human; the crawler leaves it alone
 *
 * Override borrows --highlights, the site's one warm colour, because it is the state that carries
 * a consequence: it is the row the crawler has been locked out of.
 */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    line-height: 1;
    padding: 5px 10px;
    border-radius: var(--radius-pill);
    white-space: nowrap;
    border: 1px solid transparent;
}
.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex: none;
}

.badge-manual { background: var(--primary); color: #fff; }
.badge-crawler { background: transparent; color: var(--muted); border-color: var(--line); }
.badge-override { background: rgba(244, 96, 54, .16); color: var(--highlights); border-color: var(--highlights); }

.badge-ok { background: rgba(40, 167, 69, .18); color: #5dd879; }
.badge-warn { background: rgba(255, 193, 7, .16); color: var(--warn); }
.badge-err { background: rgba(220, 53, 69, .18); color: #f4707c; }
.badge-idle { background: transparent; color: var(--muted); border-color: var(--line); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.button {
    display: inline-block;
    cursor: pointer;
    appearance: none;
    font-family: var(--font);
    font-size: 1rem;
    border-radius: var(--radius-pill);
    padding: .65rem 1.9rem;
    transition: .2s ease all;
    color: #fff;
    border: none;
    background: var(--primary);
}
.button:hover { transform: scale(1.03); background: #0f6fcc; }
.button:active { transform: translateY(2px) scale(.98); }
.button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.button-white {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--line);
}
.button-white:hover { background: var(--surface-2); color: var(--ink); }
.button-small { font-size: 13px; padding: .4rem 1rem; }
.button-danger { background: var(--err); }
.button-danger:hover { background: #bb2d3b; }

.button-link {
    background: none; border: none; color: var(--primary); cursor: pointer;
    font-family: var(--font); font-size: 14px; padding: 4px 8px; border-radius: var(--radius);
}
.button-link:hover { background: var(--surface-2); }
.button-link.danger { color: #f4707c; }
.button-link:disabled { color: var(--muted); cursor: not-allowed; background: none; }

/* ── Forms ───────────────────────────────────────────────────────────────── */

.field { margin-bottom: 18px; }
.field label {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    margin-bottom: 6px;
}
.field-hint {
    font-size: 13px; color: var(--muted); margin-top: 6px;
    text-transform: none; letter-spacing: 0;
}

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=url], input[type=number], select, textarea {
    width: 100%;
    font-family: var(--font);
    font-size: 15px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--ink);
    transition: border-color .2s ease;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
input::placeholder, textarea::placeholder { color: #6c757d; }
/* Without this the native date picker icon is near-invisible on a dark field. */
input[type=date]::-webkit-calendar-picker-indicator { filter: invert(1) opacity(.6); }
textarea { resize: vertical; min-height: 90px; }
input.error-input { border-color: var(--err); }

.field-row { display: flex; gap: 16px; flex-wrap: wrap; }
.field-row .field { flex: 1 1 180px; }

.checkbox { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--muted); }
.checkbox input { width: auto; accent-color: var(--primary); }

.filters { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
/* Scoped to the controls that need the width. A bare `.filters input` also matches the checkbox
 * inside .checkbox and stretches it to 160px. */
.filters select,
.filters input[type=text],
.filters input[type=date] { width: auto; min-width: 160px; }

/* ── Messages ────────────────────────────────────────────────────────────── */

.message {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 15px;
    border-left: 4px solid;
}
.message-error { background: rgba(220, 53, 69, .14); border-color: var(--err); color: #f4707c; }
.message-success { background: rgba(40, 167, 69, .14); border-color: var(--ok); color: #5dd879; }
.message-info { background: rgba(18, 130, 239, .14); border-color: var(--primary); color: #6bb3f7; }
.message[hidden] { display: none; }

/* ── Modal ───────────────────────────────────────────────────────────────── */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
    overflow-y: auto;
    z-index: 50;
}
.modal-backdrop[hidden] { display: none; }

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
    animation: modal-in .2s ease;
}
@keyframes modal-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: none; }
}
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}
.modal-close {
    background: none; border: none; cursor: pointer;
    font-size: 24px; line-height: 1; color: var(--muted); padding: 0 4px;
}
.modal-close:hover { color: var(--ink); }

/* One-time password reveal. Deliberately loud: shown once, never again. */
.password-reveal {
    background: rgba(18, 130, 239, .12);
    border: 1px dashed var(--primary);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    margin: 16px 0;
}
.password-reveal code {
    display: block;
    font-family: Consolas, 'Courier New', monospace;
    font-size: 22px;
    letter-spacing: .06em;
    color: var(--ink);
    margin-bottom: 8px;
    word-break: break-all;
}
.password-reveal p { margin: 0; font-size: 13px; color: #6bb3f7; }

/* ── Login ───────────────────────────────────────────────────────────────── */

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.auth-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
    padding: 36px 32px;
}
.auth-card .brand { display: block; text-align: center; font-size: 44px; margin-bottom: 6px; }
.auth-card .auth-sub { text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 28px; }
.auth-card .button { width: 100%; }

/* ── Utilities ───────────────────────────────────────────────────────────── */

.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
[hidden] { display: none !important; }

.spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid var(--line);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    vertical-align: -3px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Must stay visible — the console is used with a keyboard for data entry. */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
    .button:hover { transform: none; }
}

@media (max-width: 640px) {
    h1 { font-size: 22px; }
    .brand { font-size: 26px; }
    .topbar { margin-bottom: 24px; }
    .page-header { flex-direction: column; align-items: stretch; }
    td, th { padding: 10px 12px; }
    .tile-value { font-size: 26px; }
}
