/* The admin dashboard (AdminPage.kt, admin.js); site.css sets the palette and the header. */

/* The script shows and hides the parts with the hidden attribute; the display rules below must not win. */
#admin [hidden] { display: none !important; }

.admin-signin { text-align: center; padding: 48px 0; }
.admin-signin .button { font: inherit; font-size: 19px; cursor: pointer; }
.admin-signin .button[disabled] { opacity: 0.6; cursor: default; }
.admin-error { color: #b42318; font-weight: 500; margin-top: 16px; }
@media (prefers-color-scheme: dark) { .admin-error { color: #ff8a80; } }

/* The signed-in account in the header (replaces the "ניהול" link). */
.nav-account { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 16px; }
.nav-account .avatar { width: 28px; height: 28px; border-radius: 50%; }
.nav-account-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-signout {
    font: inherit; font-size: 15px; cursor: pointer;
    background: none; border: 1px solid var(--border); border-radius: 999px; color: var(--brand); padding: 2px 10px;
}
.nav-signout:hover { background: var(--brand-soft); }

/* The shell: sections on the right (RTL start), content on the left. */
.admin-shell { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 24px; align-items: start; }
.admin-nav { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 16px; }
.admin-nav a { text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 500; }
.admin-nav a.active { background: var(--brand-soft); }
.admin-content h1 { margin-top: 0; font-size: 28px; }
@media (max-width: 720px) {
    .admin-shell { grid-template-columns: 1fr; }
    .admin-nav { flex-direction: row; flex-wrap: wrap; position: static; }
}

/* The content column may be wider than the site's text pages. */
main.container:has(.admin-shell) { max-width: 1400px; }

/* Filters */
.admin-filters { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: end; margin-bottom: 12px; }
.admin-field { display: flex; flex-direction: column; gap: 4px; font-size: 15px; color: var(--muted); }
.admin-field input, .admin-field select {
    font: inherit; font-size: 16px; color: var(--ink); background: var(--surface);
    border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; min-width: 120px;
}
.admin-field input[type="search"] { min-width: 180px; }
.admin-filter-buttons { display: flex; gap: 8px; }
.admin-filter-buttons .button { font: inherit; font-size: 16px; cursor: pointer; }
.admin-filter-buttons .button[disabled] { opacity: 0.6; cursor: default; }
.admin-status { min-height: 1.5em; margin: 4px 0 8px; color: var(--muted); font-size: 16px; }
.admin-status.admin-error { color: #b42318; }

/* Table */
.admin-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.admin-table { border-collapse: collapse; width: 100%; font-size: 15px; line-height: 1.4; }
.admin-table th, .admin-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: start; white-space: nowrap; vertical-align: top; }
.admin-table thead th { position: sticky; top: 0; background: var(--brand-soft); z-index: 1; }
.admin-table tbody tr:hover { background: color-mix(in srgb, var(--brand-soft) 45%, transparent); }
.admin-table .numeric { text-align: end; font-variant-numeric: tabular-nums; }
.admin-table .muted { color: var(--muted); }
.admin-table td time { font-variant-numeric: tabular-nums; }
.admin-table a.query { text-decoration: none; font-weight: 500; white-space: normal; min-width: 200px; display: inline-block; }
.admin-table .sort { font: inherit; font-weight: 600; color: var(--brand); background: none; border: 0; padding: 0; cursor: pointer; }
.admin-table .sort.sorted { text-decoration: underline; }
.admin-table .link { font: inherit; color: var(--brand); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline dotted; }
.flag.on { color: #1b7f3b; font-weight: 700; }
.flag.off { color: var(--muted); }
@media (prefers-color-scheme: dark) { .flag.on { color: #7ddc9a; } }

/* Pager */
.admin-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 12px; font-size: 16px; }
.admin-pager .button { font: inherit; font-size: 16px; cursor: pointer; }
.admin-pager .button[disabled] { opacity: 0.5; cursor: default; }
.admin-pager .muted { color: var(--muted); }

/* Voice feedback ("צדקתי" reports) */
.admin-intro { color: var(--muted); font-size: 16px; margin-top: -8px; }
.admin-check { flex-direction: row; align-items: center; gap: 6px; padding-bottom: 8px; }
.admin-check input { min-width: 0; width: 18px; height: 18px; }
.voice-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.voice-chip { font-size: 15px; padding: 4px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--ink); }
.admin-table td.wrap { white-space: normal; min-width: 160px; max-width: 320px; }
.voice-note { font-weight: 500; }
.voice-question a { text-decoration: none; }

/* "ראש בראש" usage */
.duel-body { --duel-created: #b7791f; --duel-finished: #2f855a; }
@media (prefers-color-scheme: dark) { .duel-body { --duel-created: #f0c674; --duel-finished: #7ddc9a; } }
.duel-card { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); padding: 12px 16px; margin-bottom: 16px; min-width: 0; }
.duel-card h2 { font-size: 19px; margin: 0 0 10px; }
.duel-card .admin-table-wrap { border: 0; }
.duel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 0 16px; }
.duel-funnel { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.duel-funnel li { display: grid; grid-template-columns: 80px minmax(80px, 1fr) minmax(170px, auto); gap: 12px; align-items: center; font-size: 16px; }
.duel-funnel-track { height: 22px; background: var(--brand-soft); border-radius: 6px; overflow: hidden; }
.duel-funnel-bar { display: block; height: 100%; background: var(--duel-created); border-radius: 6px; }
.duel-funnel li:last-child .duel-funnel-bar { background: var(--duel-finished); }
.duel-funnel-value { font-variant-numeric: tabular-nums; }
.duel-funnel .muted, .duel-card .muted { color: var(--muted); }
.duel-cross { font-weight: 600; color: var(--brand); }
.duel-trend-wrap { overflow-x: auto; }
.duel-trend { display: block; max-width: none; }
.duel-trend .duel-created { fill: var(--duel-created); }
.duel-trend .duel-finished { fill: var(--duel-finished); }
.duel-trend .duel-axis { stroke: var(--border); }
.duel-trend .duel-tick { fill: var(--muted); font-size: 11px; }
.duel-legend { display: flex; gap: 16px; font-size: 15px; color: var(--muted); margin-bottom: 6px; }
.duel-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }
.duel-legend i.duel-created { background: var(--duel-created); }
.duel-legend i.duel-finished { background: var(--duel-finished); }
@media (max-width: 720px) { .duel-funnel li { grid-template-columns: 64px minmax(60px, 1fr); } .duel-funnel-value { grid-column: 1 / -1; } }

/* Home-screen buttons: one bar per button, colored by what it counts. */
.duel-body { --mb-click: #2b6cb0; --mb-open: #b7791f; --mb-use: #718096; }
@media (prefers-color-scheme: dark) { .duel-body { --mb-click: #7fb3f5; --mb-open: #f0c674; --mb-use: #a0aec0; } }
.mb-bars { list-style: none; margin: 8px 0 12px; padding: 0; display: grid; gap: 6px; }
.mb-bars li { display: grid; grid-template-columns: minmax(110px, 13em) minmax(80px, 1fr) minmax(110px, auto); gap: 12px; align-items: center; font-size: 16px; }
.mb-track { height: 20px; }
.mb-bar { display: block; height: 100%; border-radius: 4px; }
.mb-value { font-variant-numeric: tabular-nums; white-space: nowrap; }
.mb-bar.mb-click, .duel-legend i.mb-click { background: var(--mb-click); }
.mb-bar.mb-open, .duel-legend i.mb-open { background: var(--mb-open); }
.mb-bar.mb-use, .duel-legend i.mb-use { background: var(--mb-use); }
.duel-legend:has(.mb-click) { flex-wrap: wrap; }
@media (max-width: 720px) { .mb-bars li { grid-template-columns: minmax(90px, 9em) minmax(60px, 1fr); } .mb-value { grid-column: 2; } }
