/* CBT Exam Portal - Custom Styles */

:root {
  --brand-purple: #a855f7;
  --brand-cyan: #06b6d4;
  --brand-pink: #ec4899;
  --slate-950: #020617;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
}

* {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
  background:
    radial-gradient(ellipse at top left, rgba(168, 85, 247, 0.12), transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(6, 182, 212, 0.10), transparent 50%),
    #020617;
  background-attachment: fixed;
  min-height: 100vh;
}

/* Glassmorphism panels */
.glass {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid rgba(148, 163, 184, 0.12);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.glass-strong {
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.glass-input {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.15);
  color: #f1f5f9;
  transition: all 0.2s ease;
}

.glass-input:focus {
  outline: none;
  border-color: rgba(168, 85, 247, 0.6);
  box-shadow:
    0 0 0 3px rgba(168, 85, 247, 0.18),
    0 0 24px rgba(168, 85, 247, 0.25);
  background: rgba(15, 23, 42, 0.8);
}

.glass-input::placeholder {
  color: rgba(148, 163, 184, 0.55);
}

/* Brand button */
.btn-brand {
  background: linear-gradient(135deg, #a855f7 0%, #06b6d4 100%);
  color: white;
  font-weight: 600;
  transition: all 0.25s ease;
  box-shadow: 0 4px 18px rgba(168, 85, 247, 0.35);
  border: 0;
}

.btn-brand:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(168, 85, 247, 0.5), 0 0 30px rgba(6, 182, 212, 0.25);
}

.btn-brand:active {
  transform: translateY(0);
}

.btn-brand:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Soft buttons */
.btn-soft {
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.15);
  color: #e2e8f0;
  transition: all 0.2s ease;
}

.btn-soft:hover {
  background: rgba(148, 163, 184, 0.15);
  border-color: rgba(148, 163, 184, 0.25);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  transition: all 0.2s ease;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fecaca;
}

.btn-success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
  transition: all 0.2s ease;
}

.btn-success:hover {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(16, 185, 129, 0.5);
}

/* Sidebar nav item */
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: rgba(148, 163, 184, 0.08);
  color: #f1f5f9;
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.18), rgba(6, 182, 212, 0.10));
  border-color: rgba(168, 85, 247, 0.35);
  color: white;
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.2);
}

/* Status pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.pill-draft { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.3); }
.pill-published { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.4); }
.pill-closed { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.4); }
.pill-admin { background: rgba(168, 85, 247, 0.18); color: #d8b4fe; border: 1px solid rgba(168, 85, 247, 0.4); }
.pill-student { background: rgba(6, 182, 212, 0.15); color: #67e8f9; border: 1px solid rgba(6, 182, 212, 0.4); }
.pill-online { background: rgba(16, 185, 129, 0.18); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.5); }
.pill-offline { background: rgba(148, 163, 184, 0.12); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.25); }

/* Live dot */
.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 12px #10b981;
  animation: pulse-glow 1.5s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

/* Tables */
.table-glass {
  width: 100%;
  border-collapse: collapse;
}

.table-glass thead th {
  background: rgba(2, 6, 23, 0.5);
  text-align: left;
  padding: 0.85rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.table-glass tbody td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.06);
  font-size: 0.9rem;
}

.table-glass tbody tr:hover {
  background: rgba(148, 163, 184, 0.04);
}

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  animation: fade-in 0.2s ease;
}

.modal-content {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 1.25rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(168, 85, 247, 0.08);
  width: 100%;
  max-width: 600px;
  max-height: 92vh;
  overflow-y: auto;
  animation: slide-up 0.25s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Login card */
.login-card {
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid rgba(148, 163, 184, 0.15);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.6),
    0 0 80px rgba(168, 85, 247, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 10px; height: 10px;
}
::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.4);
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(168, 85, 247, 0.4);
}

/* Question grid (UTBK style) */
.q-grid-btn {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(30, 41, 59, 0.5);
  color: #cbd5e1;
}

.q-grid-btn:hover {
  border-color: rgba(168, 85, 247, 0.5);
  transform: scale(1.05);
}

.q-grid-btn.answered {
  background: rgba(16, 185, 129, 0.25);
  border-color: rgba(16, 185, 129, 0.6);
  color: #d1fae5;
}

.q-grid-btn.current {
  background: linear-gradient(135deg, #a855f7, #06b6d4);
  border-color: transparent;
  color: white;
  box-shadow: 0 0 18px rgba(168, 85, 247, 0.6);
}

/* Option button */
.option-btn {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-radius: 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(30, 41, 59, 0.4);
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: left;
  width: 100%;
}

.option-btn:hover {
  border-color: rgba(168, 85, 247, 0.4);
  background: rgba(30, 41, 59, 0.7);
}

.option-btn.selected {
  background: rgba(168, 85, 247, 0.18);
  border-color: rgba(168, 85, 247, 0.7);
  box-shadow: 0 0 16px rgba(168, 85, 247, 0.25);
}

.option-letter {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.option-btn.selected .option-letter {
  background: linear-gradient(135deg, #a855f7, #06b6d4);
  border-color: transparent;
  color: white;
}

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: rgba(148, 163, 184, 0.25);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 999px;
  transition: 0.2s;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  height: 18px; width: 18px;
  left: 2px; top: 2px;
  background: #f1f5f9;
  border-radius: 50%;
  transition: 0.2s;
}
.toggle input:checked + .toggle-slider {
  background: linear-gradient(135deg, #a855f7, #06b6d4);
  border-color: transparent;
}
.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* Profile photo on navbar */
.navbar-photo {
  width: 3rem; height: 3rem;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(168, 85, 247, 0.5);
  box-shadow: 0 0 18px rgba(168, 85, 247, 0.3);
  cursor: pointer;
  transition: all 0.2s ease;
}
.navbar-photo:hover {
  border-color: rgba(168, 85, 247, 0.9);
  box-shadow: 0 0 24px rgba(168, 85, 247, 0.5);
}

.navbar-avatar-fallback {
  width: 2.5rem; height: 2.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.3), rgba(6, 182, 212, 0.2));
  border: 1px solid rgba(168, 85, 247, 0.4);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}

/* Passport photo (in exam) */
.passport-photo {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 0.75rem;
  border: 2px solid rgba(168, 85, 247, 0.4);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

/* Toast */
.toast {
  position: fixed;
  top: 1rem; right: 1rem;
  z-index: 200;
  padding: 0.85rem 1.15rem;
  border-radius: 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: slide-in-right 0.25s ease;
  max-width: 90vw;
}
.toast-success { background: rgba(16, 185, 129, 0.95); color: white; }
.toast-error { background: rgba(239, 68, 68, 0.95); color: white; }
.toast-info { background: rgba(99, 102, 241, 0.95); color: white; }
@keyframes slide-in-right {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Sidebar mobile */
.sidebar-mobile {
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}
.sidebar-mobile.open {
  transform: translateX(0);
}

/* Print styles */
@media print {
  body { background: white !important; color: black !important; }
  .no-print { display: none !important; }
  .glass, .glass-strong { background: white !important; border: 1px solid #ccc !important; box-shadow: none !important; }
}

/* Utility */
.text-gradient {
  background: linear-gradient(135deg, #a855f7, #06b6d4);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.section-card {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 1.25rem;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

/* Loading spinner */
.spinner {
  width: 2.5rem; height: 2.5rem;
  border: 3px solid rgba(148, 163, 184, 0.2);
  border-top-color: #a855f7;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive helpers */
@media (max-width: 768px) {
  .table-glass thead { display: none; }
  .table-glass, .table-glass tbody, .table-glass tr, .table-glass td {
    display: block; width: 100%;
  }
  .table-glass tr {
    margin-bottom: 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 0.75rem;
    padding: 0.5rem;
  }
  .table-glass td {
    border: none;
    padding: 0.5rem 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
  }
  .table-glass td::before {
    content: attr(data-label);
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #94a3b8;
    font-weight: 600;
  }
}
