/* ===================== PORTAL CSS ===================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Outfit:wght@400;600;700;800&display=swap');

:root {
  --bg: #0a0a0f;
  --bg2: #111118;
  --card: rgba(255,255,255,0.04);
  --border: rgba(255,255,255,0.08);
  --primary: #6c63ff;
  --primary2: #a78bfa;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --radius: 14px;
  --sidebar-w: 240px;
  --card-bg: rgba(255,255,255,0.04);
}

body.light-mode {
  --bg: #f8fafc;
  --bg2: #ffffff;
  --card: #ffffff;
  --border: rgba(0,0,0,0.1);
  --primary: #4f46e5;
  --primary2: #6366f1;
  --text: #0f172a;
  --muted: #64748b;
  --card-bg: #ffffff;
}

body.light-mode .panel { background: var(--bg2); color: var(--text); }
body.light-mode .auth-box { background: #fff; }
body.light-mode .nav-item:hover { background: rgba(0,0,0,0.03); }
body.light-mode .nav-item.active { background: rgba(79,70,229,0.08); }
body.light-mode .user-pill { background: rgba(0,0,0,0.03); }
body.light-mode .sidebar-logo .logo-text, 
body.light-mode .auth-logo .logo-text { color: var(--text); }
body.light-mode .portal-table thead tr { background: #f1f5f9; color: var(--text); }
body.light-mode .portal-table tbody tr { border-bottom-color: #f1f5f9; }
body.light-mode .form-group input, 
body.light-mode .form-group select, 
body.light-mode .form-group textarea { background: #f1f5f9; color: var(--text); }

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ---- AUTH PAGES (login / apply) ---- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: radial-gradient(ellipse at 20% 50%, rgba(108,99,255,0.15) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(167,139,250,0.1) 0%, transparent 50%),
              var(--bg);
}

.auth-box {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem;
  width: 100%;
  max-width: 480px;
  backdrop-filter: blur(20px);
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.auth-logo .logo-text { font-family: 'Outfit', sans-serif; font-size: 1.8rem; font-weight: 800; color: #fff; }
.auth-logo .highlight { background: linear-gradient(135deg, var(--primary), var(--primary2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.auth-logo p { color: var(--muted); font-size: 0.85rem; margin-top: 0.3rem; }

.auth-box h2 { font-family: 'Outfit', sans-serif; font-size: 1.5rem; font-weight: 700; margin-bottom: 0.3rem; }
.auth-box .subtitle { color: var(--muted); font-size: 0.9rem; margin-bottom: 2rem; }

.form-group { margin-bottom: 1.2rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 0.5rem; color: var(--muted); }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.2s;
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--primary); }
.form-group select option { background: #1a1a2e; }
.form-group textarea { resize: vertical; min-height: 90px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.file-upload-area {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
  position: relative;
}
.file-upload-area:hover { border-color: var(--primary); }
.file-upload-area input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file-upload-area i { font-size: 1.5rem; color: var(--primary); margin-bottom: 0.5rem; }
.file-upload-area p { font-size: 0.85rem; color: var(--muted); }
.file-preview { width: 80px; height: 80px; border-radius: 10px; object-fit: cover; margin: 0.5rem auto 0; display: block; }

.btn-portal {
  width: 100%;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.85rem;
  font-size: 1rem;
  font-weight: 600;
  transition: opacity 0.2s, transform 0.2s;
  margin-top: 0.5rem;
}
.btn-portal:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-portal.secondary {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-portal.danger { background: var(--danger); }
.btn-portal.success-btn { background: var(--success); }
.btn-portal.sm { width: auto; padding: 0.45rem 1rem; font-size: 0.85rem; border-radius: 8px; }

.error-msg { color: var(--danger); font-size: 0.85rem; margin-top: 1rem; text-align: center; display: none; }
.success-box {
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.3);
  border-radius: 14px;
  padding: 2rem;
  text-align: center;
  display: none;
}
.success-box i { font-size: 2.5rem; color: var(--success); margin-bottom: 1rem; }
.success-box h3 { font-family: 'Outfit', sans-serif; font-size: 1.3rem; margin-bottom: 0.5rem; }
.success-box p { color: var(--muted); font-size: 0.9rem; }

/* ---- PORTAL LAYOUT (dashboard) ---- */
.portal-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: rgba(255,255,255,0.03);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}
.sidebar-logo {
  padding: 0 1.5rem 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.sidebar-logo .logo-text { font-family: 'Outfit', sans-serif; font-size: 1.4rem; font-weight: 800; }
.sidebar-logo .highlight { background: linear-gradient(135deg, var(--primary), var(--primary2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.sidebar-logo p { font-size: 0.75rem; color: var(--muted); margin-top: 0.2rem; }

.sidebar-nav { flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.nav-item.active { color: var(--primary2); background: rgba(108,99,255,0.1); border-left-color: var(--primary); }
.nav-item i { width: 18px; text-align: center; }

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}
.user-pill {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  margin-bottom: 0.75rem;
}
.user-pill .avatar-sm {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; font-weight: 700; color: #fff; flex-shrink: 0;
  overflow: hidden;
}
.user-pill .avatar-sm img { width: 100%; height: 100%; object-fit: cover; }
.user-pill .name { font-size: 0.85rem; font-weight: 600; }
.user-pill .role { font-size: 0.72rem; color: var(--muted); }

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 2rem;
  max-width: calc(100vw - var(--sidebar-w));
}

/* ---- TOPBAR ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}
.topbar h1 { font-family: 'Outfit', sans-serif; font-size: 1.6rem; font-weight: 700; }
.topbar p { color: var(--muted); font-size: 0.9rem; }

/* ---- CARDS & GRIDS ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.stat-card .label { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.5rem; }
.stat-card .value { font-family: 'Outfit', sans-serif; font-size: 2rem; font-weight: 700; }
.stat-card .icon { font-size: 1.5rem; margin-bottom: 0.5rem; }

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.panel-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-header h3 { font-family: 'Outfit', sans-serif; font-size: 1rem; font-weight: 600; }
.panel-body { padding: 1.5rem; }

/* ---- TABLE ---- */
.portal-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.portal-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  color: var(--muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.portal-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
.portal-table tr:last-child td { border-bottom: none; }
.portal-table tr:hover td { background: rgba(255,255,255,0.02); }

.badge-pill {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-pill.pending { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-pill.approved { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-pill.pdf { background: rgba(239,68,68,0.15); color: #f87171; }
.badge-pill.video { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-pill.mcq { background: rgba(168,85,247,0.15); color: #c084fc; }
.badge-pill.update { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-pill.gray { background: rgba(255,255,255,0.1); color: var(--muted); }

.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ---- TABS ---- */
.tab-bar {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}
.tab-btn {
  padding: 0.65rem 1.2rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.2s;
}
.tab-btn.active { color: var(--primary2); border-bottom-color: var(--primary); }
.tab-btn:hover { color: var(--text); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---- CONTENT CARDS (student view) ---- */
.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.content-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color 0.2s;
}
.content-card:hover { border-color: rgba(108,99,255,0.4); }
.content-card .cc-type { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.75rem; }
.content-card h4 { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.4rem; }
.content-card p { font-size: 0.82rem; color: var(--muted); margin-bottom: 1rem; }
.content-card a.open-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(108,99,255,0.15);
  color: var(--primary2);
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.2s;
}
.content-card a.open-btn:hover { background: rgba(108,99,255,0.3); }

/* ---- MCQ ---- */
.mcq-question { margin-bottom: 1.5rem; }
.mcq-question .q-text { font-weight: 600; margin-bottom: 0.75rem; }
.mcq-options { display: flex; flex-direction: column; gap: 0.5rem; }
.mcq-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.9rem;
}
.mcq-option:hover { border-color: var(--primary); background: rgba(108,99,255,0.06); }
.mcq-option.correct { border-color: var(--success); background: rgba(34,197,94,0.1); color: var(--success); }
.mcq-option.wrong { border-color: var(--danger); background: rgba(239,68,68,0.1); color: var(--danger); }
.mcq-option input { accent-color: var(--primary); }

/* ---- PROFILE ---- */
.profile-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.profile-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 700; color: #fff;
  flex-shrink: 0; overflow: hidden;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 999;
  padding: 1rem;
  display: none;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #16161f;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 2rem;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-box h3 { font-family: 'Outfit', sans-serif; margin-bottom: 1.5rem; font-size: 1.2rem; }
.modal-close {
  float: right;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.3rem;
  cursor: pointer;
}

/* ---- FIRST LOGIN PROMPT ---- */
.first-login-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
  padding: 1rem;
}
.first-login-box {
  background: #16161f;
  border: 1px solid rgba(108,99,255,0.4);
  border-radius: 20px;
  padding: 2rem;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
}
.first-login-box h2 { font-family: 'Outfit', sans-serif; font-size: 1.4rem; margin-bottom: 0.4rem; }

/* ---- SEARCH ---- */
.search-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.search-bar input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
}
.search-bar input:focus { border-color: var(--primary); }

/* ---- EMPTY STATE ---- */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2.5rem; margin-bottom: 1rem; opacity: 0.4; }

/* ---- DOWNLOAD BTN ---- */
.dl-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: rgba(34,197,94,0.15); color: var(--success);
  padding: 0.35rem 0.75rem; border-radius: 7px; font-size: 0.8rem; font-weight: 600;
  border: none; cursor: pointer; transition: background 0.2s;
}
.dl-btn:hover { background: rgba(34,197,94,0.3); }

/* ---- ID PROOF THUMBNAIL ---- */
.id-thumb { width: 60px; height: 40px; border-radius: 6px; object-fit: cover; border: 1px solid var(--border); }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; max-width: 100%; }
  .form-row { grid-template-columns: 1fr; }
  .content-grid { grid-template-columns: 1fr; }
  .portal-table { font-size: 0.8rem; }
  .portal-table th, .portal-table td { padding: 0.6rem 0.5rem; }
}

/* Student Picker Searchable */
.picker-container { position: relative; width: 100%; }
.picker-input { margin-bottom: 8px !important; }
.picker-results {
  position: absolute; top: 100%; left: 0; right: 0;
  background: #1a1a2e; border: 1px solid var(--border);
  border-radius: 10px; max-height: 200px; overflow-y: auto;
  z-index: 1000; display: none; box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}
.picker-results.open { display: block; }
.picker-item {
  padding: 10px 15px; cursor: pointer; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; font-size: 0.9rem;
}
.picker-item:hover { background: rgba(255,255,255,0.05); }
.picker-item:last-child { border-bottom: none; }
.picker-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.picker-tag {
  background: rgba(108,99,255,0.15); color: var(--primary2);
  padding: 4px 10px; border-radius: 6px; font-size: 0.85rem;
  display: flex; align-items: center; gap: 6px; border: 1px solid rgba(108,99,255,0.3);
}
.picker-tag i { cursor: pointer; color: var(--danger); font-size: 0.75rem; }

/* Photo Preview & Thumbnails */
.photo-preview-trigger {
  width: 40px;
  height: 40px;
  background: rgba(108,99,255,0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid var(--border);
}
.photo-preview-trigger:hover {
  background: var(--primary2);
  transform: scale(1.1);
}
.photo-preview-trigger:hover i {
  color: #fff !important;
}

.id-thumb-wrapper {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}

.id-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-overlay.open {
  display: flex !important;
}
