/* === Portal CBT Global Styles === */
* { font-family: 'Inter', system-ui, -apple-system, sans-serif; }

html, body {
  background: #0f172a;
  color: #e2e8f0;
  min-height: 100vh;
}

body {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(139,92,246,0.18), transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(34,211,238,0.15), transparent 50%),
    #0b1220;
}

/* Glassmorphism card */
.glass {
  background: rgba(30, 41, 59, 0.55);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(148, 163, 184, 0.15);
  box-shadow: 0 10px 40px -10px rgba(0,0,0,0.5);
}

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

/* Inputs - dark, NO white boxes */
.field {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(100, 116, 139, 0.4);
  color: #f1f5f9;
  transition: all 0.2s ease;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  width: 100%;
  outline: none;
}

.field:focus {
  border-color: rgb(139, 92, 246);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25), 0 0 18px rgba(139, 92, 246, 0.18);
  background: rgba(15, 23, 42, 0.9);
}

.field::placeholder { color: #64748b; }

textarea.field { resize: vertical; min-height: 80px; }
select.field option { background: #0f172a; color: #f1f5f9; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: 0.75rem;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #8b5cf6 0%, #06b6d4 100%);
  color: white;
  box-shadow: 0 6px 20px -5px rgba(139, 92, 246, 0.5);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 28px -5px rgba(139, 92, 246, 0.7); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: rgba(51, 65, 85, 0.65);
  color: #e2e8f0;
  border: 1px solid rgba(100, 116, 139, 0.4);
}
.btn-secondary:hover { background: rgba(71, 85, 105, 0.85); }

.btn-danger { background: linear-gradient(135deg, #ef4444 0%, #f97316 100%); color: white; }
.btn-danger:hover { transform: translateY(-1px); }

.btn-success { background: linear-gradient(135deg, #10b981 0%, #14b8a6 100%); color: white; }
.btn-success:hover { transform: translateY(-1px); }

.btn-warning { background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%); color: white; }

/* Tables */
table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th { text-align: left; padding: 0.75rem 1rem; font-weight: 600; font-size: 0.8rem; color: #94a3b8; text-transform: uppercase; border-bottom: 1px solid rgba(148,163,184,0.15); background: rgba(15,23,42,0.4); }
table.tbl td { padding: 0.75rem 1rem; border-bottom: 1px solid rgba(148,163,184,0.08); font-size: 0.9rem; }
table.tbl tr:hover td { background: rgba(99, 102, 241, 0.05); }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 0.2rem 0.65rem; border-radius: 9999px; font-size: 0.7rem; font-weight: 600; }
.badge-admin { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }
.badge-guru { background: rgba(59, 130, 246, 0.18); color: #93c5fd; }
.badge-student { background: rgba(16, 185, 129, 0.18); color: #6ee7b7; }
.badge-draft { background: rgba(100, 116, 139, 0.25); color: #cbd5e1; }
.badge-published { background: rgba(16, 185, 129, 0.18); color: #6ee7b7; }
.badge-closed { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }

/* Sidebar */
.sidebar-link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem; border-radius: 0.6rem; color: #cbd5e1;
  transition: all 0.2s; font-weight: 500; cursor: pointer;
}
.sidebar-link:hover { background: rgba(139, 92, 246, 0.12); color: white; }
.sidebar-link.active { background: linear-gradient(135deg, rgba(139,92,246,0.3), rgba(6,182,212,0.18)); color: white; box-shadow: inset 3px 0 0 #8b5cf6; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(6px); z-index: 80; display: flex; align-items: center; justify-content: center; padding: 1rem; }

/* Loader */
.spinner { width: 40px; height: 40px; border: 4px solid rgba(139,92,246,0.2); border-top-color: #8b5cf6; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Question grid cell */
.qnav-cell { display: flex; align-items: center; justify-content: center; height: 38px; border-radius: 0.5rem; font-weight: 600; cursor: pointer; transition: all 0.15s; border: 1px solid rgba(100,116,139,0.3); font-size: 0.85rem; }
.qnav-cell:hover { transform: scale(1.06); }
.qnav-unanswered { background: rgba(30, 41, 59, 0.6); color: #cbd5e1; }
.qnav-answered { background: rgba(16, 185, 129, 0.25); color: #6ee7b7; border-color: rgba(16,185,129,0.5); }
.qnav-current { background: linear-gradient(135deg, #8b5cf6, #06b6d4); color: white; border-color: white; box-shadow: 0 0 12px rgba(139,92,246,0.6); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(15,23,42,0.4); }
::-webkit-scrollbar-thumb { background: rgba(139,92,246,0.4); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: rgba(139,92,246,0.65); }

/* Avatar fallback */
.avatar-fallback { display:flex;align-items:center;justify-content:center;background:linear-gradient(135deg,#8b5cf6,#06b6d4);color:white;font-weight:700; }

/* Responsive sidebar */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s; position: fixed; left: 0; top: 0; height: 100vh; z-index: 70; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.55); backdrop-filter: blur(2px); z-index: 60; }
}

/* Print styles for credentials sheet */
@media print {
  body { background: white !important; color: black !important; }
  .no-print { display: none !important; }
  .print-card { border: 1px solid #ccc !important; background: white !important; color: black !important; page-break-inside: avoid; }
}

/* Glow effect for branding */
.glow-text { text-shadow: 0 0 30px rgba(139, 92, 246, 0.5); }

/* Smooth fadein */
.fadein { animation: fadein 0.3s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
