/* DiceBack Admin. MudBlazor supplies the components and theme variables (--mud-palette-*); this file
   adds the page chrome, the dashboard pieces and the static sign-in pages (which run without MudBlazor's theme). */

h1:focus { outline: none; }

/* ------------------------------------------------------------------ shell */

.admin-appbar {
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.admin-brand {
    font-weight: 700 !important;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.admin-drawer {
    border-right: 1px solid var(--mud-palette-lines-default);
}

.admin-content {
    padding-top: 24px;
    padding-bottom: 48px;
}

.admin-nav-section {
    display: block;
    padding: 16px 16px 4px;
    color: var(--mud-palette-text-secondary);
    letter-spacing: 0.08em;
}

.admin-user-activator {
    text-transform: none !important;
    gap: 8px;
    padding-left: 6px !important;
    padding-right: 6px !important;
}

.admin-user-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
    max-width: 200px;
}

.admin-user-email {
    font-size: 0.8125rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.admin-user-role {
    font-size: 0.6875rem;
    opacity: 0.7;
}

.admin-logout-form { margin: 0; }

.admin-maintenance {
    display: flex;
    align-items: center;
    padding: 0 10px;
    margin-right: 4px;
    border-radius: 999px;
    border: 1px solid var(--mud-palette-lines-default);
    height: 34px;
}

.admin-maintenance .mud-typography { font-size: 0.8125rem; white-space: nowrap; }

.admin-maintenance-on {
    border-color: var(--mud-palette-error);
    background: rgba(214, 69, 69, 0.12);
}

@media (max-width: 600px) {
    .admin-user-text, .admin-brand { display: none; }
    .admin-maintenance .mud-typography { display: none; }
    .admin-content { padding-top: 16px; }
}

/* ------------------------------------------------------------------ page header */

.admin-page-header { margin-bottom: 20px; }

.admin-breadcrumbs { margin-bottom: 4px; }
.admin-breadcrumbs li { font-size: 0.8125rem; }

.admin-page-header-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px 24px;
}

.admin-page-title { min-width: 0; }
.admin-page-title h1 { overflow-wrap: anywhere; }

.admin-page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ------------------------------------------------------------------ panels, KPIs */

.admin-panel {
    padding: 16px 20px;
    border-radius: var(--mud-default-borderradius);
    height: 100%;
    min-width: 0;
}

.admin-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.admin-kpi {
    padding: 16px 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-radius: var(--mud-default-borderradius);
}

.admin-kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-kpi-value {
    font-variant-numeric: tabular-nums;
    font-weight: 700 !important;
    line-height: 1.25 !important;
}

.admin-kpi-selected { border-color: var(--mud-palette-primary) !important; }

.admin-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 6px;
    padding: 32px 16px;
    color: var(--mud-palette-text-primary);
}

.admin-empty-page { min-height: 50vh; }

/* ------------------------------------------------------------------ tables & text helpers */

.admin-table .mud-table-cell { vertical-align: middle; }
.admin-table th { white-space: nowrap; }

.admin-clickable { cursor: pointer; }

.admin-sub {
    display: block;
    font-size: 0.75rem;
    color: var(--mud-palette-text-secondary);
}

span.admin-sub { display: inline; }

.admin-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 0.8125rem;
}

.admin-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 360px;
    display: block;
}

.admin-prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.admin-nowrap { white-space: nowrap; }
.admin-positive { color: var(--mud-palette-success); }
.admin-negative { color: var(--mud-palette-error); }
.admin-grow { flex: 1 1 280px; }
.text-right { text-align: right !important; }

.admin-filter { min-width: 160px; max-width: 220px; }
.admin-filter-wide { min-width: 220px; max-width: 320px; flex: 1 1 220px; }
.admin-search { max-width: 520px; }

.admin-list { margin: 4px 0 0 18px; }

.admin-facts {
    display: grid;
    grid-template-columns: minmax(110px, max-content) 1fr;
    gap: 6px 16px;
    margin: 0;
}

.admin-facts dt { color: var(--mud-palette-text-secondary); font-size: 0.875rem; }
.admin-facts dd { margin: 0; overflow-wrap: anywhere; }
.admin-facts-wide { grid-template-columns: minmax(140px, max-content) 1fr; }

.admin-code {
    margin: 0;
    padding: 12px 14px;
    overflow: auto;
    border-radius: 8px;
    background: var(--mud-palette-background-gray);
    border: 1px solid var(--mud-palette-lines-default);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8125rem;
    line-height: 1.5;
    white-space: pre;
}

.admin-copy { display: inline-flex; align-items: center; gap: 2px; }

.admin-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    background: var(--mud-palette-error);
    vertical-align: middle;
}

.admin-dot-on { background: var(--mud-palette-success); }

.admin-swatch {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    margin-right: 8px;
    vertical-align: middle;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.admin-row-disabled td { opacity: 0.55; }

.admin-timeline { padding-top: 0 !important; }

/* ------------------------------------------------------------------ live match & replay */

.admin-player { border-width: 2px !important; }
.admin-player-active { border-color: var(--mud-palette-primary) !important; box-shadow: 0 0 0 3px rgba(91, 69, 214, 0.12); }

.admin-slot {
    display: inline-block;
    min-width: 28px;
    padding: 1px 6px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
    color: #fff;
    margin-right: 6px;
}

.admin-slot-1 { background: #F2744B; }
.admin-slot-2 { background: #2D7FF9; }

.admin-board {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    padding: 12px 14px;
    border-radius: 8px;
    background: var(--mud-palette-background-gray);
    overflow-wrap: anywhere;
}

.admin-replay { max-height: 560px; overflow: auto; }

.admin-die {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid var(--mud-palette-lines-inputs);
    font-weight: 700;
    margin-right: 6px;
    background: var(--mud-palette-surface);
}

.admin-row-auto td { background: rgba(224, 154, 26, 0.12); }
.admin-row-final td { background: rgba(46, 158, 91, 0.12); font-weight: 600; }

/* ------------------------------------------------------------------ store */

.admin-cosmetic { width: 40px; height: 40px; display: inline-block; }
.admin-cosmetic svg { width: 100%; height: 100%; display: block; }
.admin-cosmetic-lg { width: 110px; height: 110px; margin: 8px auto; display: block; }

.admin-preview {
    padding: 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    height: 100%;
}

/* ------------------------------------------------------------------ config editor & diff */

.admin-editor { border-color: var(--mud-palette-primary) !important; }

.admin-config-form .mud-expand-panel-header { font-weight: 600; }

.admin-rewards input { text-align: right; }
.admin-rewards td { min-width: 90px; }

.admin-json-editor textarea,
.admin-mono-input textarea {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important;
    font-size: 0.8125rem !important;
    line-height: 1.5 !important;
}

.admin-diff {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 8px;
    overflow: hidden;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.78rem;
}

.admin-diff-head {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--mud-palette-background-gray);
    font-weight: 700;
}

.admin-diff-head span { padding: 6px 12px; }

.admin-diff-body { max-height: 560px; overflow: auto; }

.admin-diff-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px minmax(0, 1fr);
    line-height: 1.55;
}

.admin-diff-no {
    text-align: right;
    padding-right: 8px;
    color: var(--mud-palette-text-secondary);
    user-select: none;
}

.admin-diff-text { white-space: pre-wrap; overflow-wrap: anywhere; padding: 0 8px; }
.admin-diff-changed .admin-diff-left, .admin-diff-removed .admin-diff-left { background: rgba(214, 69, 69, 0.14); }
.admin-diff-changed .admin-diff-right, .admin-diff-added .admin-diff-right { background: rgba(46, 158, 91, 0.16); }

.admin-diff-fold {
    padding: 2px 12px;
    color: var(--mud-palette-text-secondary);
    background: var(--mud-palette-background-gray);
    font-style: italic;
}

/* ------------------------------------------------------------------ connection lost bar */

#blazor-error-ui {
    background: #fff4d6;
    color: #4a3b00;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 2000;
}

#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}

.blazor-error-boundary::after { content: "An error has occurred."; }

/* ================================================================== sign-in pages (static, no MudBlazor theme) */

.auth-shell {
    --auth-bg: #f5f5fa;
    --auth-surface: #ffffff;
    --auth-text: #1d1b2b;
    --auth-muted: #5f5c78;
    --auth-line: #e4e3ee;
    --auth-primary: #5b45d6;
    --auth-primary-text: #ffffff;
    --auth-danger: #d64545;
    --auth-ok: #2e9e5b;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 16px;
    background: var(--auth-bg);
    color: var(--auth-text);
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    box-sizing: border-box;
}

@media (prefers-color-scheme: dark) {
    .auth-shell {
        --auth-bg: #121118;
        --auth-surface: #1e1d28;
        --auth-text: #eceaf7;
        --auth-muted: #a9a6c2;
        --auth-line: #2e2c3c;
        --auth-primary: #8f7cff;
        --auth-primary-text: #120f24;
        --auth-danger: #ff6b6b;
        --auth-ok: #4cc47f;
    }
}

.auth-shell *, .auth-shell *::before, .auth-shell *::after { box-sizing: border-box; }

.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    margin: 8px 0 24px;
}

.auth-main { width: 100%; display: flex; justify-content: center; }

.auth-footer { margin-top: 24px; color: var(--auth-muted); font-size: 0.8125rem; }

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--auth-surface);
    border: 1px solid var(--auth-line);
    border-radius: 14px;
    padding: 28px 28px 24px;
    box-shadow: 0 8px 30px rgba(20, 16, 50, 0.08);
}

.auth-card-wide { max-width: 640px; }

.auth-title { font-size: 1.5rem; margin: 0 0 8px; font-weight: 700; }
.auth-subtitle { font-size: 1.05rem; margin: 24px 0 8px; font-weight: 700; }
.auth-text { margin: 0 0 12px; line-height: 1.5; }
.auth-muted { color: var(--auth-muted); }

.auth-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }

.auth-form { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }

.auth-label { font-size: 0.875rem; font-weight: 600; margin-top: 8px; }

.auth-input {
    width: 100%;
    padding: 11px 12px;
    border-radius: 8px;
    border: 1px solid var(--auth-line);
    background: var(--auth-bg);
    color: var(--auth-text);
    font-size: 1rem;
}

.auth-input:focus { outline: 2px solid var(--auth-primary); outline-offset: 1px; border-color: transparent; }

.auth-code { letter-spacing: 0.3em; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.2rem; }

.auth-field-error, .auth-form .validation-message { color: var(--auth-danger); font-size: 0.8125rem; }

.auth-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-top: 16px;
    padding: 11px 16px;
    border: 0;
    border-radius: 8px;
    background: var(--auth-primary);
    color: var(--auth-primary-text);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.auth-button:hover { filter: brightness(1.08); }

.auth-button-secondary {
    background: transparent;
    color: var(--auth-text);
    border: 1px solid var(--auth-line);
}

.auth-button-danger { background: var(--auth-danger); color: #fff; }

.auth-link { color: var(--auth-primary); text-decoration: none; font-size: 0.9rem; }
.auth-text a { color: var(--auth-primary); }

.auth-link-button {
    background: none;
    border: 0;
    padding: 0;
    color: var(--auth-primary);
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: underline;
}

.auth-inline-form { display: inline; margin-left: 8px; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--auth-muted);
    margin: 20px 0 4px;
    font-size: 0.8125rem;
}

.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--auth-line); }

.auth-status { border-radius: 8px; padding: 10px 12px; margin: 8px 0 12px; font-size: 0.9rem; }
.auth-status-error { background: rgba(214, 69, 69, 0.12); color: var(--auth-danger); }
.auth-status-ok { background: rgba(46, 158, 91, 0.12); color: var(--auth-ok); }

.auth-warning {
    border-left: 4px solid #e09a1a;
    background: rgba(224, 154, 26, 0.12);
    padding: 10px 12px;
    border-radius: 6px;
    margin: 8px 0 12px;
}

.auth-codes {
    list-style: none;
    padding: 0;
    margin: 0 0 8px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 16px;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 1rem;
}

.auth-steps { padding-left: 20px; line-height: 1.5; }
.auth-steps li { margin-bottom: 10px; }

.auth-qr { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.auth-qr img { background: #fff; padding: 8px; border-radius: 8px; border: 1px solid var(--auth-line); }

.auth-key {
    display: block;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 1rem;
    word-break: break-all;
    margin: 4px 0 8px;
}

.auth-facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 6px 16px;
    margin: 8px 0 0;
}

.auth-facts dt { color: var(--auth-muted); }
.auth-facts dd { margin: 0; overflow-wrap: anywhere; }

@media (max-width: 480px) {
    .auth-card { padding: 20px 16px; }
    .auth-codes { grid-template-columns: 1fr; }
}
