/*
 * Status colour and the guest-list controls. Loaded on admin pages only.
 *
 * The five themes deliberately restyle everything - Frederik's is
 * monochrome by design, and Sort slips is dark. That is right for an
 * invitation, and wrong for a table the hosts scan: "how many said yes"
 * has to be answerable at a glance, and a status badge that changes
 * meaning with the decoration is not doing its job.
 *
 * So these colours are semantic and deliberately the SAME in every
 * theme. They live here rather than in app.css, which stays purely
 * token-driven, and never reach a guest-facing page.
 *
 * Colour is never the only signal: every badge also carries its word
 * (Ja / Nej / Måske / Intet svar), so the list still reads correctly in
 * greyscale or with any form of colour blindness.
 */

:root {
    --status-yes-bg: #dff0e0;
    --status-yes-fg: #245c34;
    --status-yes-bar: #3f8352;

    --status-no-bg: #fadfdc;
    --status-no-fg: #8f3226;
    --status-no-bar: #c0563f;

    --status-maybe-bg: #fbeecd;
    --status-maybe-fg: #7a5a12;
    --status-maybe-bar: #d9a63c;

    --status-none-bg: #e7e4de;
    --status-none-fg: #55504a;
    --status-none-bar: #9d968c;
}

/* The dark theme needs its own values or the badges glow. */
:root[data-theme="sorttie"] {
    --status-yes-bg: #1b3325;
    --status-yes-fg: #8fd6a6;
    --status-yes-bar: #4f9e68;

    --status-no-bg: #33201d;
    --status-no-fg: #f0a294;
    --status-no-bar: #b4604c;

    --status-maybe-bg: #322a17;
    --status-maybe-fg: #e8c473;
    --status-maybe-bar: #c99a3a;

    --status-none-bg: #232935;
    --status-none-fg: #a8a294;
    --status-none-bar: #6c7382;
}

/* ------------------------------------------------------------------ */
/* Status badges                                                       */
/* ------------------------------------------------------------------ */

.admin .badge.r-yes   { background: var(--status-yes-bg);   color: var(--status-yes-fg); }
.admin .badge.r-no    { background: var(--status-no-bg);    color: var(--status-no-fg); }
.admin .badge.r-maybe { background: var(--status-maybe-bg); color: var(--status-maybe-fg); }
.admin .badge.r-none  { background: var(--status-none-bg);  color: var(--status-none-fg); }

/* A colour bar down the left of each row, so the shape of the list is
   readable without reading any of it. */
.guest-table tbody tr { border-left: 4px solid transparent; }
.guest-table tbody tr[data-status="ja"]     { border-left-color: var(--status-yes-bar); }
.guest-table tbody tr[data-status="nej"]    { border-left-color: var(--status-no-bar); }
.guest-table tbody tr[data-status="maaske"] { border-left-color: var(--status-maybe-bar); }
.guest-table tbody tr[data-status=""]       { border-left-color: var(--status-none-bar); }

.admin .meter .m-yes   { background: var(--status-yes-bar); }
.admin .meter .m-maybe { background: var(--status-maybe-bar); }
.admin .meter .m-no    { background: var(--status-no-bar); }

/* ------------------------------------------------------------------ */
/* Filter chips                                                        */
/* ------------------------------------------------------------------ */

.guest-tools {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
    margin-bottom: var(--space-3);
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: var(--input-border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink-soft);
    font-family: var(--font-ui);
    font-size: var(--small-size);
    cursor: pointer;
    white-space: nowrap;
}
.chip:hover { color: var(--ink); }
.chip[aria-pressed="true"] {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--paper);
}

.chip .dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex: 0 0 auto;
}
.chip[data-filter="ja"] .dot     { background: var(--status-yes-bar); }
.chip[data-filter="nej"] .dot    { background: var(--status-no-bar); }
.chip[data-filter="maaske"] .dot { background: var(--status-maybe-bar); }
.chip[data-filter="ingen"] .dot  { background: var(--status-none-bar); }
.chip[data-filter="alle"] .dot   { display: none; }

.chip .count { opacity: .65; font-variant-numeric: tabular-nums; }

.guest-search { max-width: 220px; margin-left: auto; }

/* ------------------------------------------------------------------ */
/* Sortable columns                                                    */
/* ------------------------------------------------------------------ */

.guest-table th[data-sort] {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.guest-table th[data-sort]:hover { color: var(--ink); }

.guest-table th[data-sort]::after {
    content: "";
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 6px;
    vertical-align: middle;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    opacity: .25;
    border-top: 5px solid currentColor;
}
.guest-table th[aria-sort="ascending"]::after {
    opacity: 1;
    border-top: 0;
    border-bottom: 5px solid currentColor;
}
.guest-table th[aria-sort="descending"]::after { opacity: 1; }

.guest-empty { padding: var(--space-4); text-align: center; color: var(--ink-faint); }
