/* ===========================================================================
   Admin section (god-only) — shared, non-scoped styles.
   Non-scoped on purpose: scoped .razor.css does NOT reach a child component's
   rendered root (e.g. NavLink's <a>), so the usable nav links would stay
   unstyled. One sheet styles plain elements and component output alike.
   =========================================================================== */

/* ----- Shell / layout -----
   The app body is overflow:hidden (fixed-viewport glass layout), so the admin
   area pins itself to the viewport height and scrolls its own panes: the
   sidebar and the content column each scroll independently when too tall. */
.admin-shell { display: flex; height: 100dvh; gap: 1rem; padding: 1rem; box-sizing: border-box; }
.admin-sidebar {
    width: 240px; flex-shrink: 0; display: flex; flex-direction: column;
    padding: 1rem; border-radius: 16px; align-self: stretch; overflow-y: auto;
}
.admin-sidebar-header {
    display: flex; align-items: center; gap: .6rem; font-weight: 700;
    font-size: 1.05rem; padding: .25rem .25rem 1rem; color: var(--na-text, #e6f7ff);
}
.admin-nav { display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.admin-nav-link {
    display: flex; align-items: center; gap: .65rem; padding: .6rem .75rem;
    border-radius: 10px; color: var(--na-text-muted, #9fb3c8); text-decoration: none;
    font-size: .92rem; transition: background .15s, color .15s;
}
.admin-nav-link i { width: 1.15rem; text-align: center; }
.admin-nav-link:hover { background: rgba(255,255,255,.05); color: var(--na-text, #e6f7ff); }
.admin-nav-link.active { background: rgba(34,211,238,.14); color: var(--na-accent, #22d3ee); }
.admin-nav-link.disabled { opacity: .4; cursor: not-allowed; }
.admin-nav-divider {
    margin: .75rem .25rem .35rem; font-size: .68rem; text-transform: uppercase;
    letter-spacing: .08em; color: var(--na-text-muted, #6b7f95);
}
.admin-sidebar-footer { padding-top: 1rem; border-top: 1px solid rgba(255,255,255,.08); display: flex; flex-direction: column; gap: .75rem; }
.admin-back-link {
    display: flex; align-items: center; gap: .5rem; color: var(--na-text-muted, #9fb3c8);
    text-decoration: none; font-size: .88rem;
    padding-bottom: .75rem; border-bottom: 1px solid rgba(255,255,255,.08);
}
.admin-back-link:hover { color: var(--na-accent, #22d3ee); }
.admin-content { flex: 1; min-width: 0; overflow-y: auto; padding: .5rem .25rem; }
@media (max-width: 760px) {
    .admin-shell { flex-direction: column; height: auto; min-height: 100dvh; overflow-y: auto; }
    .admin-sidebar { width: auto; overflow-y: visible; }
    .admin-content { overflow-y: visible; }
}

/* ----- Page header ----- */
.admin-page { width: 100%; max-width: none; }
.admin-page-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.admin-page-title { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.admin-page-title i { color: var(--na-accent, #22d3ee); font-size: 1.25rem; }
.admin-page-title h1 { font-size: 1.4rem; margin: 0; color: var(--na-text, #e6f7ff); }
.admin-loading { padding: 1rem; color: var(--na-text-muted, #9fb3c8); }
.admin-alert { padding: .75rem 1rem; margin-bottom: 1rem; background: rgba(239,68,68,.12);
    border: 1px solid rgba(239,68,68,.35); border-radius: 10px; color: #fca5a5; }

/* ----- Buttons (text + icon, auto width) ----- */
.admin-btn, .admin-btn-ghost {
    display: inline-flex; align-items: center; gap: .5rem; white-space: nowrap;
    padding: .5rem .9rem; border-radius: 8px; font-size: .9rem; line-height: 1.2;
    cursor: pointer; border: 1px solid transparent; text-decoration: none;
    transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.admin-btn { background: rgba(34,211,238,.16); border-color: rgba(34,211,238,.4); color: var(--na-accent, #22d3ee); font-weight: 600; }
.admin-btn:hover:not(:disabled) { background: rgba(34,211,238,.26); }
.admin-btn:disabled { opacity: .55; cursor: default; }
.admin-btn-ghost { background: transparent; border-color: rgba(255,255,255,.14); color: var(--na-text-muted, #9fb3c8); }
.admin-btn-ghost:hover:not(:disabled) { color: var(--na-text, #e6f7ff); background: rgba(255,255,255,.05); }

/* ----- Table -----
   Row separators live on the <td> bottom border. The actions cell keeps a real
   table-cell box (the flex layout is on an inner .row-actions div) so every
   cell shares the row height and the borders align even when text wraps. */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--na-text-muted, #6b7f95); padding: .5rem .75rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.admin-table td { padding: .65rem .75rem; border-bottom: 1px solid rgba(255,255,255,.06);
    color: var(--na-text, #e6f7ff); vertical-align: middle; }
.admin-table tr.row-inactive td { opacity: .5; }
.admin-badge { background: rgba(34,211,238,.14); color: var(--na-accent, #22d3ee); border-radius: 999px; padding: .1rem .5rem; font-size: .8rem; }
.status-pill { display: inline-block; font-size: .78rem; padding: .15rem .55rem; border-radius: 999px; }
.status-pill.on { background: rgba(16,185,129,.15); color: #34d399; }
.status-pill.off { background: rgba(148,163,184,.15); color: #94a3b8; }
.row-actions { display: flex; gap: .35rem; justify-content: flex-end; }

/* ----- Offcanvas editor ----- */
.admin-offcanvas-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); backdrop-filter: blur(2px); z-index: 60; }
.admin-offcanvas { position: fixed; top: 0; right: 0; height: 100vh; width: min(90vw, 460px); z-index: 61;
    display: flex; flex-direction: column; border-radius: 16px 0 0 16px; padding: 0; }
.admin-offcanvas-header, .admin-offcanvas-footer { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; }
.admin-offcanvas-header { border-bottom: 1px solid rgba(255,255,255,.08); }
.admin-offcanvas-footer { border-top: 1px solid rgba(255,255,255,.08); gap: .5rem; justify-content: flex-end; }
.admin-offcanvas-header h2 { font-size: 1.1rem; margin: 0; color: var(--na-text, #e6f7ff); }
.admin-offcanvas-body { flex: 1; overflow-y: auto; padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }

/* ----- Form fields ----- */
.admin-field { display: flex; flex-direction: column; gap: .35rem; }
.admin-field > span, .admin-field-label { font-size: .8rem; color: var(--na-text-muted, #9fb3c8); }
.admin-input, .admin-textarea { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.12);
    border-radius: 8px; padding: .5rem .65rem; color: var(--na-text, #e6f7ff); font-size: .9rem; width: 100%; }
.admin-textarea { min-height: 90px; resize: vertical; font-family: inherit; }
.admin-input:disabled { opacity: .55; }
.admin-input[type="color"] { height: 38px; padding: .2rem; cursor: pointer; }

/* Native <select>: match the inputs, draw our own chevron, and force a dark,
   legible option list (browsers otherwise render <option>s with OS colours —
   dark text on a dark popup). */
select.admin-input {
    appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 2rem;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%239fb3c8' stroke-width='1.5'><path d='M1 1.5 6 6.5 11 1.5'/></svg>");
    background-repeat: no-repeat; background-position: right .7rem center;
}
select.admin-input option { background: #0d1b2a; color: var(--na-text, #e6f7ff); }
.admin-hint { font-size: .76rem; color: var(--na-text-muted, #6b7f95); margin: -.5rem 0 0; }
.admin-checklist { display: flex; flex-direction: column; gap: .4rem; min-height: 7rem; max-height: 240px; overflow-y: auto;
    border: 1px solid rgba(255,255,255,.08); border-radius: 8px; padding: .6rem; }
.admin-check { display: flex; align-items: center; gap: .55rem; font-size: .88rem; color: var(--na-text, #e6f7ff); cursor: pointer; }
.admin-check input[type="checkbox"] { width: 1.05rem; height: 1.05rem; flex-shrink: 0; accent-color: var(--na-accent, #22d3ee); cursor: pointer; margin: 0; }
.admin-check code, .admin-checklist code { color: var(--na-text-muted, #6b7f95); font-size: .78rem; }
.admin-field-hint { font-size: .76rem; color: var(--na-text-muted, #6b7f95); font-weight: 400; }
.admin-row { display: flex; gap: .75rem; }
.admin-row > .admin-field { flex: 1; }
.admin-toggle-row { display: flex; flex-wrap: wrap; align-items: center; gap: 1.5rem; }

/* FontAwesome icon field with live preview (sections form) */
.admin-icon-field { display: flex; align-items: flex-end; gap: .6rem; }
.admin-icon-field .admin-field { flex: 1; }
.admin-icon-preview { width: 38px; height: 38px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    border: 1px solid rgba(255,255,255,.12); border-radius: 8px; background: rgba(255,255,255,.04);
    color: var(--na-accent, #22d3ee); font-size: 1.1rem; }

/* ----- Toggle switch (nicer than a checkbox for on/off state) ----- */
.admin-toggle { display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; user-select: none;
    font-size: .9rem; color: var(--na-text, #e6f7ff); }
.admin-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.admin-toggle-track { position: relative; width: 40px; height: 22px; flex-shrink: 0; border-radius: 999px;
    background: rgba(148,163,184,.3); transition: background .2s ease; }
.admin-toggle-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
    border-radius: 50%; background: #fff; transition: transform .2s ease; }
.admin-toggle input:checked + .admin-toggle-track { background: var(--na-accent, #22d3ee); }
.admin-toggle input:checked + .admin-toggle-track::after { transform: translateX(18px); }
.admin-toggle input:focus-visible + .admin-toggle-track { box-shadow: 0 0 0 2px rgba(34,211,238,.45); }

/* ----- One-time secret dialog ----- */
.admin-secret-dialog { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 61;
    width: min(92vw, 520px); padding: 1.5rem; border-radius: 16px; display: flex; flex-direction: column; gap: 1rem; }
.admin-secret-dialog h2 { margin: 0; font-size: 1.15rem; color: #fbbf24; display: flex; align-items: center; gap: .5rem; }
.admin-secret-dialog p { margin: 0; color: var(--na-text-muted, #9fb3c8); font-size: .9rem; }
.admin-secret-value { position: relative; background: rgba(0,0,0,.4); border: 1px solid rgba(34,211,238,.35);
    border-radius: 8px; padding: .75rem; padding-right: 2.5rem; }
.admin-secret-value code { color: var(--na-accent, #22d3ee); word-break: break-all; font-size: .95rem; }
.admin-secret-copy { position: absolute; right: .6rem; top: 50%; transform: translateY(-50%);
    display: inline-flex; align-items: center; justify-content: center; padding: .15rem; font-size: .95rem; cursor: pointer;
    background: transparent; border: none; color: var(--na-text-muted, #9fb3c8); transition: color .15s ease; }
.admin-secret-copy:hover { color: var(--na-accent, #22d3ee); }
.admin-secret-copy.copied { color: #34d399; }
.admin-secret-actions { display: flex; justify-content: flex-end; }
