:root {
  --primary: #312E81;
  --primary-accent: #4338CA;
  --primary-light: #EEF2FF;
  --bg-page: #F8FAFC;
  --bg-card: #FFFFFF;
  --border: #E2E8F0;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'Newsreader', Georgia, serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text-main);
  min-height: 100vh;
}

/* Mobile Header Bar & Backdrop */
.admin-mobile-header {
  display: none; /* hidden on desktop */
  align-items: center;
  justify-content: space-between;
  height: 56px;
  background: #0F172A;
  color: white;
  padding: 0 14px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-mobile-menu {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: white;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-mobile-menu:hover, .btn-mobile-menu:active {
  background: rgba(255, 255, 255, 0.2);
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-brand-icon {
  font-size: 20px;
}

.mobile-brand-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: white;
}

.mobile-brand-badge {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.6px;
  background: #4338CA;
  color: #E0E7FF;
  padding: 2px 6px;
  border-radius: 4px;
}

.btn-mobile-refresh {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: white;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-mobile-refresh:hover, .btn-mobile-refresh:active {
  background: rgba(255, 255, 255, 0.2);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(2px);
  z-index: 1040;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
  width: 260px;
  background: #0F172A;
  color: white;
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 24px;
}

.sidebar-brand-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.btn-sidebar-close {
  display: none;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #CBD5E1;
  font-size: 16px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-sidebar-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.brand-icon {
  font-size: 24px;
  background: rgba(99, 102, 241, 0.2);
  padding: 8px;
  border-radius: 10px;
}

.sidebar-brand h2 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.role-badge {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #A5B4FC;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: #94A3B8;
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s;
}

.nav-item:hover, .nav-item.active {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.nav-item.active {
  background: var(--primary-accent);
}

.db-status-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 14px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 8px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 8px #10B981;
}

.db-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: #94A3B8;
}

.db-meta code {
  color: #A5B4FC;
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 4px;
  border-radius: 4px;
}

/* Main Content */
.admin-main {
  flex: 1;
  padding: 32px 40px;
  overflow-y: auto;
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}

.topbar-title h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.topbar-title p {
  font-size: 14px;
  color: var(--text-muted);
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

/* Buttons */
.btn {
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(49, 46, 129, 0.2);
}

.btn-primary:hover {
  background: var(--primary-accent);
}

.btn-secondary {
  background: white;
  border: 1px solid var(--border);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: #F1F5F9;
}

.btn-sm-action {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: white;
  cursor: pointer;
  color: var(--primary-accent);
  font-weight: 600;
}

.btn-sm-action:hover {
  background: var(--primary-light);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
}

.stat-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  margin: 6px 0 2px;
}

.stat-value.small-text {
  font-size: 13px;
  font-family: monospace;
  word-break: break-all;
}

.stat-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Chapters Stat Card Dropdown */
.chapters-dropdown-container {
  margin: 6px 0 8px;
}

.stat-select {
  width: 100%;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 600;
  color: #312E81;
  background: #F8FAFC;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-select:hover, .stat-select:focus {
  border-color: #6366F1;
  background: #FFFFFF;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.table-filter-select {
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #1E293B;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  outline: none;
  min-width: 180px;
}

.table-filter-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

/* Controls */
.table-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 16px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.btn-group {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.filter-btn {
  background: transparent;
  border: none;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.filter-btn.active {
  background: var(--primary);
  color: white;
}

.search-box {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 280px;
}

.search-box input {
  border: none;
  outline: none;
  font-size: 13px;
  width: 100%;
}

/* Bulk Deletion & Selection Bar */
.bulk-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #FEF2F2;
  border: 1.5px solid #FECACA;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  margin-bottom: 14px;
  gap: 16px;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.08);
  transition: all 0.2s ease;
}

.bulk-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.bulk-count-badge {
  background: #DC2626;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 9999px;
  letter-spacing: 0.4px;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.25);
}

.bulk-hint {
  font-size: 12.5px;
  color: #991B1B;
  font-weight: 500;
}

.bulk-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-secondary-sm {
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid #CBD5E1;
  background: white;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary-sm:hover {
  background: #F1F5F9;
  border-color: #94A3B8;
}

.btn-danger-sm {
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 6px;
  border: 1px solid #DC2626;
  background: #DC2626;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.3);
  transition: all 0.15s ease;
}

.btn-danger-sm:hover {
  background: #B91C1C;
  border-color: #B91C1C;
}

.btn-danger-sm:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Checkboxes & Row Selection */
.verse-checkbox-cell {
  text-align: center;
  vertical-align: middle !important;
}

.verse-checkbox, #check-select-all {
  width: 17px;
  height: 17px;
  cursor: pointer;
  accent-color: #DC2626;
  margin: 0 auto;
  display: block;
}

tr.selected-row {
  background-color: #FEF2F2 !important;
}

tr.selected-row td {
  border-bottom-color: #FECACA !important;
}

/* Table */
.table-container {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

.verses-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  text-align: left;
}

.verses-table th {
  background: #F8FAFC;
  padding: 12px 16px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
}

.verses-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  vertical-align: top;
}

.verse-text-cell {
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.45;
  color: #1E293B;
}

.first-letters-cell {
  color: #64748B;
  font-size: 12.5px;
  line-height: 1.4;
}

/* Form Card */
.form-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px;
  max-width: 800px;
}

.form-card h2 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 6px;
}

.form-desc {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.form-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
}

.form-group input, .form-group textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}

.preview-box {
  background: var(--primary-light);
  border: 1px solid #C7D2FE;
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 24px;
}

.preview-box label {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: var(--primary-accent);
  display: block;
  margin-bottom: 4px;
}

.first-letters-display {
  font-size: 13px;
  color: var(--primary);
  font-weight: 500;
  line-height: 1.4;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-box {
  background: white;
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 580px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
}

.modal-box-lg {
  max-width: 640px;
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
}

.btn-close {
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: #F8FAFC;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #047857;
  color: white;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  display: none;
  z-index: 1000;
}

.toast.show {
  display: block;
}

.hidden {
  display: none !important;
}

/* Excel Upload Styles */
.excel-upload-card {
  max-width: 960px;
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.template-buttons {
  display: flex;
  gap: 8px;
}

.excel-dropzone {
  border: 2px dashed #CBD5E1;
  background: #F8FAFC;
  border-radius: 16px;
  padding: 44px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.excel-dropzone:hover, .excel-dropzone.dragover {
  border-color: var(--primary-accent);
  background: var(--primary-light);
}

.dropzone-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.dropzone-content h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.dropzone-content p {
  font-size: 13px;
  color: var(--text-muted);
}

.hidden-file-input {
  display: none;
}

.file-summary-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--primary-light);
  border: 1px solid #C7D2FE;
  border-radius: var(--radius-md);
  padding: 20px;
  margin: 24px 0 20px;
  gap: 20px;
  flex-wrap: wrap;
}

.file-badge {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: var(--primary-accent);
  display: block;
  margin-bottom: 4px;
}

.file-meta-col h3 {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 4px;
}

.file-meta-col span {
  font-size: 13px;
  color: #475569;
}

.mode-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  display: block;
  margin-bottom: 8px;
}

.radio-options {
  display: flex;
  gap: 12px;
}

.radio-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: white;
  border: 1.5px solid #CBD5E1;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.15s;
}

.radio-card:hover {
  border-color: #94A3B8;
}

.radio-card.active {
  border-color: var(--primary);
  background: #F8FAFC;
  box-shadow: 0 0 0 1px var(--primary);
}

.radio-card input {
  margin-top: 3px;
}

.radio-card strong {
  display: block;
  font-size: 13px;
  color: var(--text-main);
}

.radio-card span {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.preview-table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.preview-table-header h4 {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-main);
}

.preview-table-header span {
  font-size: 12px;
  background: #E2E8F0;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
  color: #475569;
}

.small-table {
  max-height: 340px;
  overflow-y: auto;
  border: 1px solid var(--border);
}

/* Danger Zone & Reset Styles */
.btn-danger {
  background: #DC2626;
  color: white;
  border: none;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
}

.btn-danger:hover {
  background: #B91C1C;
}

.btn-danger-outline {
  background: white;
  color: #DC2626;
  border: 1.5px solid #F87171;
}

.btn-danger-outline:hover {
  background: #FEF2F2;
  border-color: #DC2626;
}

.btn-sm-delete {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid #FECACA;
  background: #FFF5F5;
  color: #DC2626;
  cursor: pointer;
  margin-left: 4px;
}

.btn-sm-delete:hover {
  background: #FEE2E2;
}

.nav-item.nav-danger {
  color: #F87171;
}

.nav-item.nav-danger:hover, .nav-item.nav-danger.active {
  background: rgba(220, 38, 38, 0.15);
  color: #FCA5A5;
}

.danger-card {
  border-color: #FECACA;
  max-width: 820px;
}

.danger-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.danger-icon {
  font-size: 32px;
}

.danger-banner {
  background: #FEF2F2;
  border: 1px solid #FCA5A5;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: #991B1B;
  font-size: 13.5px;
  line-height: 1.45;
  margin-bottom: 24px;
}

.danger-actions-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.danger-action-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.danger-action-info h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.danger-action-info p {
  font-size: 12.5px;
  color: var(--text-muted);
  max-width: 520px;
  line-height: 1.4;
}

/* Quiz Questions Specific Styles */
.question-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  font-size: 12.5px;
  margin-top: 8px;
}

.option-pill {
  padding: 5px 9px;
  background: #F8FAFC;
  border-radius: 6px;
  border: 1px solid #E2E8F0;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.3;
}

.option-pill strong {
  color: #475569;
}

.option-pill.correct {
  background: #ECFDF5;
  border-color: #6EE7B7;
  color: #065F46;
  font-weight: 600;
}

.option-pill.correct strong {
  color: #047857;
}

.option-pill.correct::after {
  content: '✓ Correct';
  margin-left: auto;
  font-size: 9.5px;
  background: #059669;
  color: white;
  padding: 1px 5px;
  border-radius: 4px;
}

.badge-ref {
  display: inline-block;
  font-weight: 700;
  color: #1E293B;
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12.5px;
}

.question-text-cell {
  font-weight: 600;
  color: #0F172A;
  margin-bottom: 4px;
  font-size: 14px;
  line-height: 1.45;
}

.question-explanation-cell {
  font-size: 12px;
  color: #64748B;
  font-style: italic;
  margin-top: 6px;
  background: #F8FAFC;
  padding: 4px 8px;
  border-radius: 4px;
  border-left: 2px solid #CBD5E1;
}

.questions-table td {
  vertical-align: top;
  padding: 14px 16px;
}

/* ==========================================================================
   Admin Authentication & Access Control Styles
   ========================================================================== */

.auth-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 20%, #1E1B4B 0%, #0F172A 100%);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(8px);
}

.auth-card {
  background: #FFFFFF;
  border-radius: 20px;
  width: 100%;
  max-width: 440px;
  padding: 36px 32px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.15);
  animation: authFadeIn 0.3s ease-out;
}

@keyframes authFadeIn {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-brand {
  text-align: center;
  margin-bottom: 24px;
}

.auth-icon {
  font-size: 38px;
  display: inline-block;
  background: #EEF2FF;
  padding: 12px;
  border-radius: 16px;
  margin-bottom: 12px;
}

.auth-brand h2 {
  font-size: 24px;
  font-weight: 800;
  color: #0F172A;
  letter-spacing: -0.5px;
}

.auth-subtitle {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #6366F1;
  margin-top: 4px;
}

.auth-user-selector {
  margin-bottom: 20px;
}

.auth-instruction {
  font-size: 12px;
  font-weight: 700;
  color: #64748B;
  margin-bottom: 10px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-user-pills {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 6px;
}

.auth-user-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  background: #F8FAFC;
  border: 2px solid #E2E8F0;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
}

.auth-user-btn:hover {
  border-color: #6366F1;
  background: #EEF2FF;
  transform: translateY(-2px);
}

.auth-user-btn.active {
  border-color: #4F46E5;
  background: #EEF2FF;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.15);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #4338CA;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  margin-bottom: 6px;
}

.user-name {
  font-size: 13px;
  font-weight: 700;
  color: #0F172A;
  line-height: 1.2;
}

.user-role {
  font-size: 10.5px;
  font-weight: 600;
  color: #64748B;
  margin-top: 2px;
}

.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrap input {
  width: 100%;
  padding-right: 44px;
}

.btn-toggle-pwd {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  color: #64748B;
}

.auth-alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
  background: #FEF2F2;
  border: 1px solid #FCA5A5;
  color: #B91C1C;
}

.auth-alert.success {
  background: #ECFDF5;
  border-color: #6EE7B7;
  color: #047857;
}

.btn-auth-submit {
  width: 100%;
  padding: 13px;
  font-size: 15px;
  font-weight: 700;
  background: #4338CA;
  color: white;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-auth-submit:hover {
  background: #3730A3;
}

.auth-footer-note {
  text-align: center;
  font-size: 11.5px;
  color: #94A3B8;
  margin-top: 20px;
  font-weight: 600;
}

/* Sidebar Admin User Card */
.admin-user-card {
  margin-top: auto;
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 14px;
}

.admin-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.admin-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #4F46E5;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}

.admin-user-info strong {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  color: white;
}

.admin-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: #34D399;
  letter-spacing: 0.4px;
}

.admin-user-actions {
  display: flex;
  gap: 6px;
}

.btn-user-action {
  flex: 1;
  background: rgba(255, 255, 255, 0.1);
  color: #E2E8F0;
  border: none;
  border-radius: 8px;
  padding: 7px 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.btn-user-action:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.btn-user-logout:hover {
  background: #DC2626;
  color: white;
}

.modal-box-sm {
  width: 100%;
  max-width: 440px;
}

.modal-intro {
  font-size: 13.5px;
  color: #475569;
  margin-bottom: 18px;
}

/* ==========================================================================
   Base Classes for Responsiveness
   ========================================================================== */

.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.card-body {
  padding: 20px;
}

.vip-form-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 2fr 1.5fr;
  gap: 14px;
  align-items: end;
}

.table-actions-group {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}

.table-filter-select {
  padding: 7px 14px;
  border-radius: 8px;
  border: 1.5px solid #CBD5E1;
  font-weight: 600;
  font-size: 13.5px;
  background: white;
  color: #1E293B;
  cursor: pointer;
  box-sizing: border-box;
}

.chapter-filter-select {
  box-sizing: border-box;
}

/* ==========================================================================
   Responsive Breakpoints & Mobile Optimization
   ========================================================================== */

/* Tablet & Smaller Desktops (<= 1120px) */
@media (max-width: 1120px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .topbar-actions {
    flex-wrap: wrap;
  }
}

/* Mobile & Tablet Drawer Breakpoint (<= 992px) */
@media (max-width: 992px) {
  .admin-mobile-header {
    display: flex;
  }

  .admin-layout {
    display: block;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 290px;
    max-width: 84vw;
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .admin-sidebar.open {
    transform: translateX(0);
    box-shadow: 12px 0 35px rgba(0, 0, 0, 0.5);
  }

  .sidebar-backdrop {
    display: block;
  }

  .btn-sidebar-close {
    display: flex;
  }

  .admin-main {
    margin-top: 56px;
    padding: 20px 16px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .admin-topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    margin-bottom: 20px;
  }

  .topbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }

  .topbar-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
    min-height: 40px;
  }

  .vip-form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .table-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .filter-group {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
  }

  .table-filter-select {
    min-width: 0 !important;
    width: 100% !important;
  }

  .search-box {
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
  }

  .table-actions-group {
    width: 100%;
    margin-left: 0 !important;
    flex-wrap: wrap;
  }

  .table-actions-group .btn {
    flex: 1 1 auto;
    justify-content: center;
    min-height: 40px;
  }
}

/* Small Tablets & Large Phones (<= 768px) */
@media (max-width: 768px) {
  /* Prevent iOS Safari auto-zooming on focus */
  input[type="text"],
  input[type="number"],
  input[type="password"],
  input[type="file"],
  select,
  textarea {
    font-size: 16px !important;
  }

  .topbar-title h1 {
    font-size: 21px;
  }

  .topbar-title p {
    font-size: 13px;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .topbar-actions .btn {
    padding: 8px 10px;
    font-size: 12.5px;
    width: 100%;
  }

  .stats-grid {
    gap: 12px;
    margin-bottom: 20px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-value {
    font-size: 24px;
  }

  .form-card {
    padding: 20px 16px;
  }

  .modal-overlay {
    padding: 12px;
  }

  .modal-box,
  .modal-box-lg,
  .modal-box-sm {
    width: 96% !important;
    max-width: 96% !important;
    margin: 8px auto;
    max-height: calc(100vh - 20px);
  }

  .modal-header {
    padding: 14px 18px;
  }

  .modal-header h3 {
    font-size: 16px;
  }

  .modal-body {
    padding: 16px;
    max-height: calc(100vh - 140px);
  }

  .modal-footer {
    padding: 12px 16px;
  }

  .auth-overlay {
    padding: 14px;
  }

  .auth-card {
    padding: 24px 18px;
    border-radius: 16px;
    max-width: 100%;
  }

  .excel-dropzone {
    padding: 28px 16px;
  }

  .file-summary-card {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
    gap: 14px;
  }

  .radio-options {
    flex-direction: column;
  }

  .chapter-filter-select {
    min-width: 0 !important;
    width: 100% !important;
  }
}

/* Mobile Phones (<= 600px) */
@media (max-width: 600px) {
  .admin-main {
    padding: 14px 10px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stats-grid .stat-card {
    padding: 12px 10px;
  }

  .stats-grid .stat-card:nth-child(5),
  .stats-grid .stat-card:nth-child(7) {
    grid-column: span 2;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
    margin-bottom: 0;
  }

  .form-group {
    margin-bottom: 14px;
  }

  .vip-form-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .bulk-actions-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 12px;
  }

  .bulk-buttons {
    width: 100%;
    justify-content: stretch;
    gap: 8px;
  }

  .bulk-buttons .btn {
    flex: 1;
    justify-content: center;
  }

  #chapter-filter-group {
    display: flex;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    width: 100%;
  }

  #chapter-filter-group .filter-btn {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 6px 12px;
    font-size: 12px;
  }

  .modal-footer {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 8px;
  }

  .modal-footer .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .card-header {
    padding: 14px 14px;
  }

  .card-body {
    padding: 14px;
  }
}

/* Extra Small Phones (<= 440px) */
@media (max-width: 440px) {
  .topbar-actions {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid .stat-card:nth-child(5),
  .stats-grid .stat-card:nth-child(7) {
    grid-column: span 1;
  }

  .auth-user-pills {
    grid-template-columns: 1fr;
  }
}



