/* ==========================================
   NCERT Admin Panel — Premium Dark Theme
   ========================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

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

:root {
  --primary:      #6366f1;
  --primary-dark: #4f46e5;
  --primary-glow: rgba(99,102,241,0.25);
  --secondary:    #ec4899;
  --bg:           #080c17;
  --surface:      #0f172a;
  --card:         rgba(15,23,42,0.85);
  --border:       rgba(255,255,255,0.07);
  --text:         #f1f5f9;
  --muted:        #64748b;
  --success:      #10b981;
  --danger:       #ef4444;
  --warning:      #f59e0b;
  --info:         #38bdf8;
  --sidebar-w:    260px;
  --radius:       14px;
  --transition:   0.25s cubic-bezier(.4,0,.2,1);
}

html { font-family: 'Inter', sans-serif; font-size: 15px; }
body { background: var(--bg); color: var(--text); min-height: 100vh; overflow-x: hidden; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 0.95rem; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* === Animated Background === */
.bg-layer {
  position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background: radial-gradient(ellipse 80% 60% at 20% 10%, rgba(99,102,241,0.08) 0%, transparent 60%),
              radial-gradient(ellipse 60% 50% at 80% 90%, rgba(236,72,153,0.06) 0%, transparent 60%);
}
.bg-layer::after {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* === Login === */
.auth-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
}
.login-card {
  background: var(--card);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 44px 40px;
  width: 100%; max-width: 440px;
  box-shadow: 0 32px 64px rgba(0,0,0,0.5);
  animation: fadeUp 0.4s ease;
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 {
  font-size: 2rem; font-weight: 800;
  background: linear-gradient(135deg, #818cf8, #f472b6);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.login-logo p { color: var(--muted); font-size: 0.9rem; margin-top: 6px; }

/* === Form Controls === */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 7px; font-weight: 500; }
.form-input {
  width: 100%;
  background: rgba(15,23,42,0.7);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  resize: vertical;
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
select.form-input option { background: #1e293b; }

.input-wrap { position: relative; }
.input-wrap .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-wrap .form-input { padding-left: 38px; }

/* === Buttons === */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 11px 22px; border-radius: 10px;
  font-size: 0.92rem; font-weight: 600; border: none;
  cursor: pointer; transition: all var(--transition); white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 6px 20px var(--primary-glow); }
.btn-danger  { background: rgba(239,68,68,0.15); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover  { background: rgba(239,68,68,0.25); }
.btn-ghost  { background: rgba(255,255,255,0.05); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover  { background: rgba(255,255,255,0.1); }
.btn-sm { padding: 7px 14px; font-size: 0.82rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* === Dashboard Shell === */
.shell { display: flex; min-height: 100vh; }

/* === Sidebar === */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--card);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--border);
  position: fixed; top: 0; left: 0; bottom: 0;
  display: flex; flex-direction: column;
  padding: 0; z-index: 200;
  transition: transform var(--transition);
}
.sidebar-head {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-head h2 {
  font-size: 1.1rem; font-weight: 700;
  background: linear-gradient(135deg, #818cf8, #f472b6);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.sidebar-head p { color: var(--muted); font-size: 0.78rem; margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.nav-section { font-size: 0.7rem; color: var(--muted); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; padding: 10px 10px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius); margin-bottom: 2px;
  color: var(--muted); font-size: 0.9rem; font-weight: 500;
  cursor: pointer; transition: all var(--transition);
}
.nav-link:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.nav-link.active {
  background: var(--primary-glow);
  color: var(--primary);
}
.nav-link .ni { width: 18px; text-align: center; font-size: 0.95rem; }
.nav-link .count-badge {
  margin-left: auto; background: var(--primary); color: #fff;
  font-size: 0.72rem; padding: 2px 7px; border-radius: 20px;
}

.sidebar-foot {
  padding: 14px 12px;
  border-top: 1px solid var(--border);
}
.admin-pill {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: rgba(255,255,255,0.04); border-radius: 10px;
}
.admin-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.admin-info p { font-size: 0.85rem; font-weight: 600; }
.admin-info span { font-size: 0.75rem; color: var(--muted); }

/* === Main Content === */
.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(8,12,23,0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 14px 32px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.topbar-left h3 { font-size: 1.05rem; font-weight: 700; }
.topbar-left p { font-size: 0.82rem; color: var(--muted); margin-top: 1px; }
.topbar-right { display: flex; gap: 10px; align-items: center; }

.content { flex: 1; padding: 28px 32px; }

/* === Cards === */
.card {
  background: var(--card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 20px; padding: 24px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.card-head h3 { font-size: 1rem; font-weight: 700; }

/* === Stat Cards === */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin-bottom: 28px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 22px;
  display: flex; flex-direction: column; gap: 10px;
  transition: transform var(--transition), border-color var(--transition);
}
.stat-card:hover { transform: translateY(-3px); border-color: rgba(99,102,241,0.3); }
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; }
.stat-icon { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.stat-icon.purple { background: rgba(99,102,241,0.15); color: var(--primary); }
.stat-icon.pink   { background: rgba(236,72,153,0.15);  color: var(--secondary); }
.stat-icon.green  { background: rgba(16,185,129,0.15);  color: var(--success); }
.stat-icon.blue   { background: rgba(56,189,248,0.15);  color: var(--info); }
.stat-icon.orange { background: rgba(245,158,11,0.15);  color: var(--warning); }
.stat-num { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: 0.82rem; color: var(--muted); }
.stat-trend { font-size: 0.78rem; color: var(--success); display: flex; align-items: center; gap: 4px; }

/* === Tables === */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
thead th {
  padding: 10px 16px; text-align: left;
  color: var(--muted); font-weight: 600; font-size: 0.78rem; letter-spacing: 0.05em; text-transform: uppercase;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td { padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,0.04); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: rgba(255,255,255,0.02); }

/* === Badges === */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 0.76rem; font-weight: 600; gap: 4px; white-space: nowrap; }
.badge-purple { background: rgba(99,102,241,0.15); color: var(--primary); }
.badge-green  { background: rgba(16,185,129,0.15);  color: var(--success); }
.badge-red    { background: rgba(239,68,68,0.15);    color: var(--danger); }
.badge-yellow { background: rgba(245,158,11,0.15);   color: var(--warning); }
.badge-blue   { background: rgba(56,189,248,0.15);   color: var(--info); }

/* === Search / Filter Bar === */
.filter-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.search-box { position: relative; flex: 1; min-width: 200px; }
.search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-box input { width: 100%; padding-left: 36px; }

/* === Pagination === */
.pagination { display: flex; gap: 6px; justify-content: center; align-items: center; padding-top: 20px; }
.page-btn {
  width: 34px; height: 34px; border-radius: 8px;
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  cursor: pointer; font-size: 0.85rem; transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* === Empty State === */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state i { font-size: 3rem; color: var(--muted); margin-bottom: 14px; display: block; }
.empty-state h4 { font-size: 1rem; margin-bottom: 6px; }
.empty-state p { color: var(--muted); font-size: 0.88rem; }

/* === Modals === */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.75); backdrop-filter: blur(6px);
  z-index: 500; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; animation: fadeIn 0.2s ease; }
.modal {
  background: #0f172a; border: 1px solid var(--border);
  border-radius: 22px; padding: 28px;
  width: 100%; max-width: 620px; max-height: 90vh; overflow-y: auto;
  animation: slideUp 0.3s ease;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.modal-head h3 { font-size: 1.05rem; font-weight: 700; }
.modal-close {
  background: rgba(255,255,255,0.07); border: none; border-radius: 8px;
  width: 32px; height: 32px; color: var(--muted); cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center; transition: all var(--transition);
}
.modal-close:hover { background: rgba(255,255,255,0.12); color: var(--text); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* === Upload Zone === */
.upload-zone {
  border: 2px dashed var(--border); border-radius: 12px;
  padding: 28px; text-align: center; cursor: pointer;
  transition: all var(--transition); position: relative;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--primary); background: var(--primary-glow); }
.upload-zone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.upload-zone i { font-size: 2rem; color: var(--muted); margin-bottom: 8px; display: block; }
.upload-zone p { font-size: 0.85rem; color: var(--muted); }
.upload-zone .file-chosen { color: var(--success); font-weight: 600; margin-top: 6px; font-size: 0.82rem; }

/* === Progress Bar === */
.progress-wrap { margin-top: 14px; display: none; }
.progress-wrap.show { display: block; }
.progress-bar { height: 6px; background: rgba(255,255,255,0.08); border-radius: 6px; overflow: hidden; }
.progress-bar-inner { height: 100%; background: linear-gradient(90deg, var(--primary), var(--secondary)); transition: width 0.3s; border-radius: 6px; width: 0; }
.progress-label { font-size: 0.78rem; color: var(--muted); margin-top: 6px; text-align: center; }

/* === Analytics === */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.chart-wrap { position: relative; height: 260px; }

/* === Settings === */
.settings-section { margin-bottom: 28px; }
.settings-section h4 { font-size: 0.85rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }

/* === Toast === */
.toast-container { position: fixed; bottom: 28px; right: 28px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 18px; border-radius: 12px;
  font-size: 0.88rem; font-weight: 500;
  background: var(--card); border: 1px solid var(--border);
  box-shadow: 0 12px 30px rgba(0,0,0,0.4);
  transform: translateX(120%); transition: transform 0.35s cubic-bezier(.175,.885,.32,1.275);
  pointer-events: auto; max-width: 320px; min-width: 220px;
}
.toast.show { transform: translateX(0); }
.toast.success { border-color: rgba(16,185,129,0.4); }
.toast.error   { border-color: rgba(239,68,68,0.4); }
.toast.info    { border-color: rgba(56,189,248,0.4); }
.toast-icon { font-size: 1rem; flex-shrink: 0; }
.toast.success .toast-icon { color: var(--success); }
.toast.error   .toast-icon { color: var(--danger); }
.toast.info    .toast-icon { color: var(--info); }

/* === Loader === */
.loader { display: inline-block; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.2); border-top-color: currentColor; border-radius: 50%; animation: spin 0.7s linear infinite; }
.skeleton { background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; }

/* === Confirm Dialog === */
.confirm-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.8); backdrop-filter: blur(4px);
  z-index: 600; align-items: center; justify-content: center; padding: 20px;
}
.confirm-overlay.open { display: flex; }
.confirm-box {
  background: #0f172a; border: 1px solid var(--border);
  border-radius: 18px; padding: 28px;
  max-width: 380px; width: 100%;
  text-align: center; animation: fadeUp 0.2s ease;
}
.confirm-box i { font-size: 2.5rem; color: var(--danger); margin-bottom: 12px; display: block; }
.confirm-box h4 { font-size: 1rem; margin-bottom: 6px; }
.confirm-box p { color: var(--muted); font-size: 0.85rem; margin-bottom: 22px; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }

/* === Tag list (subject / class filter) === */
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { padding: 5px 13px; border-radius: 20px; font-size: 0.8rem; font-weight: 500; border: 1px solid var(--border); cursor: pointer; color: var(--muted); transition: all var(--transition); }
.tag:hover, .tag.active { border-color: var(--primary); color: var(--primary); background: var(--primary-glow); }

/* === Scrollable list === */
.scroll-list { max-height: 340px; overflow-y: auto; }

/* === Keyframes === */
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp  { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(24px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* === Responsive === */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .chart-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .topbar { padding: 14px 18px; }
  .content { padding: 20px 18px; }
}
