/* ==========================================================
   tbwr.org - admin styles (loaded after style.css)
   ========================================================== */

/* ---------- Layout ---------- */
.admin-body { min-height: 100vh; display: flex; flex-direction: column; }
.admin-top { background: var(--navy-900); border-bottom: 3px solid var(--gold-500); }
.admin-top-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 24px;
    min-height: 60px;
    padding-top: 8px;
    padding-bottom: 8px;
}
.admin-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--white);
    font-family: var(--serif);
    font-weight: 700;
    text-decoration: none;
}
.admin-brand img { width: 36px; height: 36px; }
.admin-brand:hover { color: var(--gold-300); }

.admin-nav { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.admin-nav a {
    display: block;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    color: #D5DCE8;
    font-weight: 500;
    text-decoration: none;
}
.admin-nav a:hover { color: var(--white); background: rgba(255, 255, 255, 0.06); }
.admin-nav a[aria-current="page"] { color: var(--gold-300); box-shadow: inset 0 -2px 0 var(--gold-500); }

.admin-user { display: flex; align-items: center; gap: 16px; color: #AEB8C9; font-size: 0.95rem; }
.admin-user a { color: #D5DCE8; }
.admin-user form { margin: 0; }
.link-button {
    padding: 0;
    background: none;
    border: 0;
    color: var(--gold-300);
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.admin-main { flex: 1; padding: 32px 0 48px; }
.page-title { font-size: 1.75rem; margin-bottom: 24px; }

.admin-foot { border-top: 1px solid var(--line); background: var(--white); color: var(--muted); font-size: 0.9rem; }
.admin-foot p { margin: 0; padding: 16px 0; }

/* ---------- Dashboard ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stat {
    padding: 18px 20px;
    background: var(--white);
    border: 1px solid var(--line);
    border-left: 4px solid var(--gold-500);
    border-radius: var(--radius);
}
.stat-live { border-left-color: var(--live); }
.stat-number { font-family: var(--serif); font-size: 2.2rem; font-weight: 700; line-height: 1; color: var(--navy-900); }
.stat-label { margin-top: 6px; color: var(--muted); }

.panel {
    margin-top: 24px;
    padding: 24px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.panel h2 { font-size: 1.25rem; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: 6px 0; }

/* ---------- Alerts ---------- */
.alert { margin-bottom: 16px; padding: 12px 16px; border: 1px solid; border-radius: var(--radius-sm); }
.alert-error { background: #FDECEE; border-color: #F3B7BF; color: #8A1626; }
.alert-success { background: #EAF6EE; border-color: #B5DEC2; color: #1D6B38; }

/* ---------- Forms ---------- */
.form-row { margin-bottom: 16px; }
.form-row label { display: block; margin-bottom: 6px; font-weight: 500; }
.form-row input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #C5CCD8;
    border-radius: var(--radius-sm);
    background: var(--white);
    font: inherit;
    color: var(--ink);
}
.form-row input:focus { border-color: var(--navy-700); outline: 2px solid var(--gold-300); outline-offset: 0; }
.form-hint { margin: 4px 0 0; font-size: 0.9rem; color: var(--muted); }

.btn-navy { background: var(--navy-800); color: var(--white); }
.btn-navy:hover { background: var(--navy-700); color: var(--white); }
.btn-block { display: block; width: 100%; text-align: center; }

/* ---------- Login / setup pages ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--navy-800); }
.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 32px;
    background: var(--white);
    border-top: 4px solid var(--gold-500);
    border-radius: var(--radius);
}
.auth-card > img { width: 72px; height: 72px; margin: 0 auto 12px; }
.auth-card h1 { text-align: center; font-size: 1.5rem; }
.auth-sub { margin: -4px 0 20px; text-align: center; color: var(--muted); }
.auth-foot { margin: 16px 0 0; text-align: center; font-size: 0.95rem; }

/* ---------- Users page: forms, table, badges ---------- */
.panel-first { margin-top: 0; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0 16px;
    align-items: start;
}
.form-actions { grid-column: 1 / -1; margin-bottom: 8px; }
.form-row select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #C5CCD8;
    border-radius: var(--radius-sm);
    background: var(--white);
    font: inherit;
    color: var(--ink);
}
.role-help { margin: 16px 0 0; padding-left: 1.1em; color: var(--muted); font-size: 0.95rem; }
.role-help li { margin-bottom: 4px; }

.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.98rem; }
.admin-table th {
    padding: 10px 12px;
    border-bottom: 2px solid var(--line);
    color: var(--muted);
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
}
.admin-table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-table tr.is-inactive td { color: var(--muted); }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.85rem; font-weight: 700; }
.badge-active { background: #EAF6EE; color: #1D6B38; }
.badge-inactive { background: #EEF0F4; color: var(--muted); }
.you-tag {
    margin-left: 6px;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--gold-100);
    color: var(--navy-900);
    font-size: 0.8rem;
    font-weight: 700;
}
.admin-role { color: #8591A6; }

.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.inline-form select,
.inline-form input {
    padding: 6px 8px;
    border: 1px solid #C5CCD8;
    border-radius: var(--radius-sm);
    background: var(--white);
    font: inherit;
    font-size: 0.95rem;
}
.actions { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.inline-details summary { color: var(--navy-700); font-size: 0.95rem; text-decoration: underline; cursor: pointer; }
.inline-details[open] summary { margin-bottom: 8px; }

.btn-small { padding: 6px 12px; font-size: 0.9rem; }
.btn-light { background: var(--white); border-color: #C5CCD8; color: var(--navy-800); }
.btn-light:hover { border-color: var(--navy-700); color: var(--navy-900); }
.btn-danger-light { background: var(--white); border-color: #F3B7BF; color: #8A1626; }
.btn-danger-light:hover { background: #FDECEE; color: #8A1626; }

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ---------- News editor (Step 4) ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.page-head .page-title { margin: 0; }
.form-narrow { max-width: 820px; }
.form-row textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #C5CCD8;
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--ink);
    font: inherit;
    line-height: 1.6;
    resize: vertical;
}
.form-row textarea:focus,
.form-row select:focus { border-color: var(--navy-700); outline: 2px solid var(--gold-300); outline-offset: 0; }
.form-row input[type="file"] { padding: 8px; background: var(--paper); }
.form-row input[type="checkbox"] { width: auto; }
.check-row { display: flex; align-items: center; gap: 10px; margin: 8px 0 20px; font-weight: 500; }
.check-row input { width: 18px; height: 18px; accent-color: var(--navy-800); }
.cover-preview { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; margin-bottom: 10px; }
.cover-preview img { width: 240px; aspect-ratio: 16 / 9; object-fit: cover; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.cover-preview label { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.form-buttons { display: flex; align-items: center; gap: 16px; }
.badge-draft { background: #FFF4D6; color: #7A5A00; }
.muted { color: var(--muted); }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.row-actions form { margin: 0; }
.link-danger { padding: 0; background: none; border: 0; color: #8A1626; font: inherit; text-decoration: underline; cursor: pointer; }

/* ---------- Videos (Step 5) ---------- */
.video-thumb-sm { display: block; width: 120px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius-sm); }
.badge-live { background: var(--live); color: var(--white); }
.badge-upcoming { background: #FFF4D6; color: #7A5A00; }
.badge-past { background: #EEF0F4; color: var(--muted); }
.btn-live { background: var(--live); color: var(--white); }
.btn-live:hover { background: #B81F32; color: var(--white); }

/* ---------- Messages (Step 6) ---------- */
.nav-count {
    display: inline-block;
    min-width: 20px;
    margin-left: 6px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--live);
    color: var(--white);
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
}
.filter-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.filter-tabs a {
    padding: 6px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--white);
    color: var(--navy-800);
    text-decoration: none;
}
.filter-tabs a[aria-current="page"] { background: var(--navy-800); border-color: var(--navy-800); color: var(--white); }
.admin-table tr.is-unread td { font-weight: 700; }
.badge-new { background: var(--live); color: var(--white); }
.small { font-size: 0.9rem; font-weight: 400; }
.plain-link { color: inherit; text-decoration: none; }
.plain-link:hover { text-decoration: underline; }
.pager { display: flex; justify-content: center; gap: 16px; margin: 20px 0 0; }
.message-meta { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 0 0 20px; }
.message-meta dt { color: var(--muted); }
.message-meta dd { margin: 0; }
.message-body { padding: 20px; background: var(--paper); border-radius: var(--radius-sm); line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-actions { flex-wrap: wrap; margin-top: 20px; }
.message-actions form { margin: 0; }

/* ---------- Join applications (Phase 2) ---------- */
.stat-grid-small { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); margin-bottom: 20px; }
.stat-grid-small .stat-number { font-size: 1.7rem; }
.stat-link { color: inherit; text-decoration: none; }
.stat-link:hover,
.stat-link.is-active { border-color: var(--navy-700); border-left-color: var(--navy-800); }
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.filter-bar select,
.filter-bar input[type="search"] {
    padding: 8px 10px;
    border: 1px solid #C5CCD8;
    border-radius: var(--radius-sm);
    background: var(--white);
    font: inherit;
}
.filter-bar input[type="search"] { flex: 1 1 240px; }

.badge-status-new { background: var(--live); color: var(--white); }
.badge-status-shortlisted { background: #E6EEFB; color: #1A3060; }
.badge-status-interview { background: #FFF4D6; color: #7A5A00; }
.badge-status-selected { background: #EAF6EE; color: #1D6B38; }
.badge-status-rejected { background: #EEF0F4; color: var(--muted); }

.applicant-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; align-items: start; }
.applicant-head { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; }
.applicant-head p { margin: 0 0 4px; }
.applicant-photo { width: 96px; height: 96px; object-fit: cover; border-radius: 50%; border: 3px solid var(--gold-100); }
.detail-title { margin: 24px 0 8px; font-size: 1.1rem; }
.review-links { margin: 16px 0; }
.review-links .btn-light { border-width: 2px; }

@media (max-width: 900px) {
    .applicant-layout { grid-template-columns: 1fr; }
}

/* ---------- Adjudicators (Phase 2) ---------- */
.badge-adj-active { background: #EAF6EE; color: #1D6B38; }
.badge-adj-suspended { background: #FDECEE; color: #8A1626; }
.badge-adj-expired { background: #EEF0F4; color: var(--muted); }
.person-cell { display: flex; align-items: center; gap: 10px; }
.person-thumb { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none; }
.person-thumb-empty {
    display: grid;
    place-items: center;
    background: var(--navy-800);
    color: var(--gold-300);
    font-weight: 700;
}
.filter-bar-end { margin-left: auto; }
.id-code { margin: 0 0 8px; font-family: var(--serif); font-size: 1.6rem; font-weight: 700; color: var(--navy-900); }
.qr-box { display: inline-block; margin: 12px 0; padding: 12px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.qr-box img, .qr-box canvas { display: block; }
.cover-preview .applicant-photo { width: 96px; height: 96px; aspect-ratio: auto; border-radius: 50%; }
.btn-gold { background: var(--gold-500); color: var(--navy-900); }
.btn-gold:hover { background: var(--gold-300); color: var(--navy-900); }

/* ---------- Events (Phase 2) ---------- */
.cover-preview .poster-preview { width: 160px; height: auto; aspect-ratio: auto; object-fit: contain; }
.page-subtitle { margin: 4px 0 0; }

/* ---------- Record ideas (Phase 2) ---------- */
.badge-idea-pending { background: var(--live); color: var(--white); }
.badge-idea-approved { background: #EAF6EE; color: #1D6B38; }
.badge-idea-rejected { background: #EEF0F4; color: var(--muted); }
.submitter-box { margin-bottom: 20px; padding: 14px 16px; background: #FFF8E6; border: 1px solid #F0DDA0; border-radius: var(--radius-sm); }
.audience-set { border: 0; padding: 0; }
.audience-set legend { margin-bottom: 6px; padding: 0; font-weight: 500; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; margin: 0 18px 6px 0; font-weight: 400; }
.check-inline input { width: 16px; height: 16px; accent-color: var(--navy-800); }

@media (max-width: 640px) {
    .admin-user { width: 100%; justify-content: space-between; }
    .auth-card { padding: 24px 20px; }
}

/* ---- Adjudicator pipeline: dashboard and list (Oct 2026) ---- */
.head-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.stat-warn { border-left-color: #D98E04; }
.panel-attention { border-color: #E9C46A; border-left: 4px solid var(--gold-500); background: #FFFCF2; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.panel-head h2 { margin-bottom: 12px; }
.attention-list { list-style: none; margin: 0; padding: 0; }
.attention-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}
.attention-list li:last-child { border-bottom: 0; }
.attention-list li > div { min-width: 0; }
.attention-list .small { display: block; }
.dash-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.dash-columns > .panel { margin-top: 24px; }
@media (max-width: 800px) { .dash-columns { grid-template-columns: 1fr; } }

/* ---- Training Academy (admin) ---- */
.academy-pw-box { margin: 8px 0 16px; padding: 14px; background: #FFFCF2; border: 1px dashed var(--gold-500); border-radius: var(--radius-sm); }
.academy-pw-box p { margin: 0 0 6px; }
.academy-pw { font-family: Consolas, Menlo, monospace; font-size: 1.3rem; font-weight: 700; letter-spacing: 0.04em; color: var(--navy-900); }
.academy-pw-box textarea { width: 100%; font: inherit; font-size: 0.85rem; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.lesson-editor { font-family: Consolas, Menlo, monospace; font-size: 0.95rem; line-height: 1.55; }
.lesson-preview { max-width: 760px; line-height: 1.75; }
.lesson-preview .lesson-note { margin: 1em 0; padding: 12px 16px; background: var(--gold-100); border-left: 4px solid var(--gold-500); }
.option-row { display: grid; grid-template-columns: 210px 1fr; gap: 12px; align-items: center; }
.option-row .check-row { margin: 0; }
@media (max-width: 700px) { .option-row { grid-template-columns: 1fr; } }
