/* ============================================================
   DriveAssess — Admin Panel Styles
   Black & White Outlined Theme
   ============================================================ */

/* ============================================================
   LAYOUT
   ============================================================ */

.admin-layout {
  display: flex;
  min-height: 100vh;
  background: var(--black);
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.admin-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #030303 0%, #000 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
  transition: left 0.3s var(--ease);
}

/* Brand */
.sidebar-brand {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo {
  width: 36px; height: 36px;
  border: 1.5px solid var(--white);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
}
.sidebar-brand-text {
  font-weight: 900; font-size: 1rem; letter-spacing: -0.03em;
}
.sidebar-brand-text span {
  font-size: 0.65rem; font-weight: 500; color: var(--text-muted);
  display: block; letter-spacing: 0.1em; text-transform: uppercase;
}

/* Nav */
.sidebar-nav { flex: 1; padding: 1rem 0; }

.nav-section-label {
  padding: 0.5rem 1.25rem 0.25rem;
  font-size: 0.62rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: rgba(255,255,255,0.25);
  margin-top: 0.75rem;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 1.25rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem; font-weight: 500;
  transition: var(--transition);
  border-left: 2px solid transparent;
  position: relative;
}
.nav-item:hover {
  color: var(--white);
  background: rgba(255,255,255,0.04);
  border-left-color: rgba(255,255,255,0.45);
}
.nav-item.active {
  color: var(--white);
  background: rgba(255,255,255,0.06);
  border-left-color: var(--white);
  font-weight: 600;
}
.nav-item-icon { font-size: 1rem; width: 20px; text-align: center; opacity: 0.8; }

/* Footer */
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}
.admin-user-pill {
  display: flex; align-items: center; gap: 10px;
}
.admin-avatar {
  width: 32px; height: 32px;
  background: var(--faint);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.8rem; flex-shrink: 0;
  color: var(--white);
}
.admin-name {
  font-size: 0.84rem; font-weight: 600; color: var(--white);
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.admin-role { font-size: 0.68rem; color: var(--text-muted); letter-spacing: 0.04em; }

.btn-logout {
  background: none; border: none;
  color: var(--text-muted); cursor: pointer;
  padding: 5px; border-radius: var(--radius-sm);
  transition: var(--transition); font-size: 0.95rem;
}
.btn-logout:hover { color: var(--red); }

/* ============================================================
   MAIN AREA
   ============================================================ */

.admin-main {
  flex: 1;
  display: flex; flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #000 0%, #050505 100%);
}

/* Topbar */
.admin-topbar {
  padding: 0.875rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.96);
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; position: sticky; top: 0; z-index: 40;
}
.topbar-title { font-size: 1rem; font-weight: 700; letter-spacing: -0.02em; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* Content */
.admin-content { flex: 1; padding: 1.5rem; max-width: 100%; }

/* Footer */
.site-footer {
  margin-top: auto;
  flex-shrink: 0;
  padding: 1rem 1.5rem 1.25rem;
  border-top: 1px solid var(--border);
  background: #000;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
  line-height: 1.5;
}
.site-footer .powered-by-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--white);
  font-weight: 700;
}
.site-footer .powered-by-link:hover {
  color: var(--off-white);
}
.site-footer .brand-blanka {
  font-family: 'Blanka', var(--font-sans);
  letter-spacing: 0.06em;
}

/* ============================================================
   CARDS / PANELS
   ============================================================ */

.admin-table-card {
  background: #040404;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.admin-table-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  gap: 1rem; flex-wrap: wrap;
}
.admin-table-header h3 { font-weight: 700; font-size: 0.95rem; letter-spacing: -0.01em; }

/* ============================================================
   STATS GRID
   ============================================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: #040404;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  transition: var(--transition);
}
.stat-card:hover { border-color: var(--border-strong); background: rgba(255,255,255,0.02); }

.stat-icon {
  width: 44px; height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0;
}

/* Color modifiers — used across dashboard/attendance/results stat cards
   (e.g. class="stat-icon green"). Previously these classes were applied
   in markup but never defined here, so every stat icon rendered with the
   same plain neutral outline regardless of the intended color. */
.stat-icon.green  { color: #00e5a0; background: rgba(0,229,160,0.10);  border-color: rgba(0,229,160,0.3); }
.stat-icon.red    { color: #ff4757; background: rgba(255,71,87,0.10);  border-color: rgba(255,71,87,0.3); }
.stat-icon.orange { color: #ff9142; background: rgba(255,145,66,0.10); border-color: rgba(255,145,66,0.3); }
.stat-icon.purple { color: #a78bfa; background: rgba(167,139,250,0.10); border-color: rgba(167,139,250,0.3); }
.stat-icon.cyan   { color: #00d4ff; background: rgba(0,212,255,0.10);  border-color: rgba(0,212,255,0.3); }
.stat-icon.pink   { color: #ff6ec7; background: rgba(255,110,199,0.10); border-color: rgba(255,110,199,0.3); }

.stat-value { font-size: 1.6rem; font-weight: 900; letter-spacing: -0.04em; line-height: 1; }
.stat-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 3px; }

/* ============================================================
   QUESTION BUILDER — CHOICE ROWS
   ============================================================ */

.choice-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.choice-row .form-control { flex: 1; }

/* The green ✓ "mark as correct" toggle button */
.correct-toggle {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: transparent;
  color: transparent;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 800;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.correct-toggle::after {
  content: '✓';
  position: absolute;
  font-size: 0.85rem;
  color: transparent;
  transition: var(--transition);
}
.correct-toggle:hover {
  border-color: #22c55e;
}
.correct-toggle:hover::after {
  color: rgba(34,197,94,0.5);
}
.correct-toggle.active {
  background: rgba(34,197,94,0.15);
  border-color: #22c55e;
}
.correct-toggle.active::after {
  color: #22c55e;
}

.btn-remove-choice {
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
}
.btn-remove-choice:hover {
  border-color: var(--red);
  color: var(--red);
}

/* ============================================================
   SEARCH INPUT
   ============================================================ */

.search-input-wrap {
  display: flex; align-items: center; gap: 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 7px 12px;
  transition: var(--transition);
}
.search-input-wrap:focus-within { border-color: var(--border-focus); }
.search-icon { color: var(--text-muted); font-size: 0.9rem; }
.search-input {
  background: none; border: none; outline: none;
  color: var(--white); font-family: var(--font-sans); font-size: 0.875rem;
  width: 200px;
}
.search-input::placeholder { color: var(--text-muted); }

/* ============================================================
   ATTENDANCE BADGES
   ============================================================ */

.att-badge-present {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--green-tint); color: var(--green);
  border: 1px solid var(--green-border);
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 0.75rem; font-weight: 700;
}
.att-badge-absent {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--red-tint); color: var(--red);
  border: 1px solid var(--red-border);
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 0.75rem; font-weight: 700;
}

/* ============================================================
   MODALS (override main.css)
   ============================================================ */

.modal {
  background: #050505;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
}
.modal-header {
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem; padding-bottom: 1rem;
}

/* ============================================================
   CONFIG / SCORE PANELS
   ============================================================ */

.config-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.config-section {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
}
.config-section-title {
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--text-muted); margin-bottom: 0.75rem;
}
.r4-subgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.total-check {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.7rem 1rem; border-radius: var(--radius-md); margin-top: 0.5rem;
  font-size: 0.875rem;
}
.total-check.ok  { background: var(--green-tint); border: 1px solid var(--green-border); color: var(--green); }
.total-check.err { background: var(--red-tint);   border: 1px solid var(--red-border);   color: var(--red); }

/* ============================================================
   ROUND TABS
   ============================================================ */

.round-tab-bar { display: flex; gap: 6px; margin-bottom: 1.5rem; flex-wrap: wrap; }
.round-tab {
  padding: 7px 16px; border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: transparent; color: var(--text-muted);
  cursor: pointer; font-size: 0.84rem; font-weight: 600;
  transition: var(--transition); text-decoration: none; display: inline-block;
}
.round-tab:hover { border-color: var(--border-strong); color: var(--white); }
.round-tab.active { background: var(--white); border-color: var(--white); color: var(--black); }

.report-tab-bar { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; overflow-x: auto; }
.rtab2 {
  padding: 10px 18px; font-size: 0.84rem; font-weight: 600;
  color: var(--text-muted); cursor: pointer; border: none;
  background: none; border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: var(--transition);
  white-space: nowrap; text-decoration: none; display: inline-block;
}
.rtab2:hover { color: var(--white); }
.rtab2.active { color: var(--white); border-bottom-color: var(--white); }

.round-report { display: none; }
.round-report.active { display: block; }

/* ============================================================
   PANELIST DASHBOARD
   ============================================================ */

/* Criteria card for R4 */
.criteria-item {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  transition: var(--transition);
}
.criteria-item:focus-within { border-color: var(--border-strong); }
.criteria-label {
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); margin-bottom: 0.5rem;
}

.score-submitted-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--green-tint); border: 1px solid var(--green-border);
  color: var(--green); padding: 4px 12px; border-radius: var(--radius-full);
  font-size: 0.8rem; font-weight: 700;
}

/* ============================================================
   RESPONSIVE — SIDEBAR TOGGLE
   ============================================================ */

.sidebar-toggle {
  display: none; background: none; border: none;
  color: var(--white); font-size: 1.2rem; cursor: pointer; padding: 5px;
}
.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 199; display: none;
}
.sidebar-overlay.active { display: block; }

@media(max-width:900px) {
  .sidebar-toggle { display: flex; align-items: center; justify-content: center; }
  .admin-sidebar {
    position: fixed; left: -260px; top: 0; bottom: 0;
    z-index: 200; width: 240px;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 30px rgba(0,0,0,0.8);
  }
  .admin-sidebar.open { left: 0; }
  .admin-main { width: 100%; }
  .config-grid { grid-template-columns: 1fr !important; }
  .r4-subgrid  { grid-template-columns: 1fr !important; }
  .stats-grid  { grid-template-columns: 1fr 1fr; }
}
@media(max-width:560px) {
  .stats-grid  { grid-template-columns: 1fr; }
  .admin-content { padding: 1rem; }
}

/* ============================================================
   TABS (used by AdminApp.initTabs — e.g. Participants: Single /
   Bulk Text / Spreadsheet add panels)
   ============================================================ */
.tab-bar {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  padding: 0 1.25rem;
  background: rgba(255,255,255,0.02);
}
.tab-btn {
  appearance: none;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font, 'Inter', sans-serif);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.75rem 0.6rem;
  cursor: pointer;
  transition: var(--transition, 0.15s ease);
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active {
  color: var(--white);
  border-bottom-color: var(--white);
}
[data-tab] { display: none; }
[data-tab].active { display: block; }

/* ============================================================
   SPREADSHEET-STYLE PARTICIPANT GRID
   ============================================================ */
.sheet-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 10px);
}
.sheet-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 640px;
}
.sheet-table th {
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  white-space: nowrap;
}
.sheet-table th:last-child, .sheet-table td:last-child { border-right: none; }
.sheet-table td {
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 0;
}
.sheet-table tr:last-child td { border-bottom: none; }
.sheet-cell {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  padding: 7px 10px;
  min-width: 110px;
}
.sheet-cell:focus { background: rgba(255,255,255,0.06); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.3); }
.sheet-cell.cell-invalid { background: rgba(255,75,75,0.12); box-shadow: inset 0 0 0 1px rgba(255,75,75,0.4); }
.sheet-row-num {
  color: var(--text-muted);
  font-size: 0.72rem;
  text-align: center;
  width: 34px;
  user-select: none;
}
.sheet-row-remove {
  width: 34px;
  text-align: center;
  cursor: pointer;
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 7px 0;
}
.sheet-row-remove:hover { color: var(--red, #ff4b4b); }
.sheet-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.sheet-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.5;
}
