/* ============================================================
   EduPortal — School Management System CSS
   Font: Playfair Display + DM Sans
   Theme: Deep Navy + Warm Gold
   ============================================================ */

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #263347;
  --border: #334155;
  --text: #f1f5f9;
  --text-2: #94a3b8;
  --accent: #f59e0b;
  --accent-2: #fbbf24;
  --blue: #3b82f6;
  --green: #10b981;
  --red: #ef4444;
  --purple: #8b5cf6;
  --sidebar-w: 260px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --transition: 0.2s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* ============================================================ SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
  border-bottom: 1px solid var(--border);
}
.brand-name {
  display: block;
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}
.brand-sub {
  display: block;
  font-size: 0.7rem;
  color: var(--text-2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-nav { flex: 1; padding: 16px 12px; }
.nav-section { margin-bottom: 20px; }
.nav-label {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-2);
  padding: 0 8px;
  margin-bottom: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 2px;
  transition: all var(--transition);
  position: relative;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: rgba(245,158,11,0.12);
  color: var(--accent);
}
.nav-item.active svg { stroke: var(--accent); }

.nav-item .badge {
  margin-left: auto;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.7rem;
  padding: 1px 7px;
  border-radius: 20px;
  font-weight: 500;
}
.nav-item.active .badge {
  background: rgba(245,158,11,0.15);
  color: var(--accent);
}

.sidebar-footer {
  padding: 16px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-card { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.user-avatar {
  width: 34px; height: 34px;
  background: var(--accent);
  color: var(--bg);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.75rem;
  flex-shrink: 0;
}
.user-name { display: block; font-weight: 600; font-size: 0.825rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { display: block; font-size: 0.7rem; color: var(--text-2); }

.logout-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-2);
  width: 32px; height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}
.logout-btn:hover { background: rgba(239,68,68,0.1); border-color: var(--red); color: var(--red); }

/* ============================================================ MAIN */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ============================================================ TOPBAR */
.topbar {
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 600;
  flex: 1;
}
.topbar-right { display: flex; align-items: center; gap: 16px; }
.notif-btn {
  position: relative;
  cursor: pointer;
  color: var(--text-2);
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  transition: all var(--transition);
}
.notif-btn:hover { background: var(--surface-2); color: var(--text); }
.notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--surface);
}
.topbar-date { font-size: 0.75rem; color: var(--text-2); }
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 4px;
}

/* ============================================================ PAGE */
.page-content { flex: 1; padding: 28px; }

.page-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.page-desc { color: var(--text-2); font-size: 0.875rem; flex: 1; }

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  flex: 1;
  max-width: 340px;
  transition: border-color var(--transition);
}
.search-bar:focus-within { border-color: var(--accent); }
.search-bar svg { color: var(--text-2); flex-shrink: 0; }
.search-bar input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  width: 100%;
  padding: 9px 0;
}
.search-bar input::placeholder { color: var(--text-2); }

.action-filters { display: flex; gap: 8px; }

.select-sm {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.825rem;
  padding: 8px 12px;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
}
.select-sm:focus { border-color: var(--accent); }

.mt-4 { margin-top: 20px; }

/* ============================================================ BUTTONS */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary:hover { background: var(--accent-2); transform: translateY(-1px); }
.btn-full { width: 100%; justify-content: center; }

.btn-sm {
  background: var(--surface-2);
  border: none;
  color: var(--text);
  border-radius: 6px;
  padding: 6px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-sm:hover { background: var(--border); }

.btn-outline {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-2);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: rgba(245,158,11,0.05); }

.btn-icon {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  width: 32px; height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.btn-icon:hover { color: var(--text); border-color: var(--text-2); }

.btn-icon-sm {
  background: none;
  border: none;
  color: var(--text-2);
  width: 28px; height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.btn-icon-sm:hover { background: var(--surface-2); color: var(--text); }
.btn-danger-sm:hover { background: rgba(239,68,68,0.1); color: var(--red); }

/* ============================================================ CARDS */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-link {
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.card-link:hover { text-decoration: underline; }
.card-actions { display: flex; gap: 8px; align-items: center; }

/* ============================================================ ALERTS */
.alert {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 0.875rem;
}
.alert-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); color: var(--green); }
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: var(--red); }

/* ============================================================ BADGES & TAGS */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.status-active { background: rgba(16,185,129,0.12); color: #10b981; }
.status-warning { background: rgba(245,158,11,0.12); color: var(--accent); }
.status-inactive { background: rgba(239,68,68,0.12); color: var(--red); }
.status-upcoming { background: rgba(139,92,246,0.12); color: var(--purple); }

.grade-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
}
.grade-ap { background: rgba(16,185,129,0.15); color: #10b981; }
.grade-a  { background: rgba(59,130,246,0.15); color: #3b82f6; }
.grade-bp { background: rgba(139,92,246,0.15); color: #8b5cf6; }
.grade-b  { background: rgba(245,158,11,0.15); color: var(--accent); }
.grade-c  { background: rgba(156,163,175,0.15); color: #9ca3af; }
.grade-f  { background: rgba(239,68,68,0.15); color: var(--red); }

.tag {
  background: var(--surface-2);
  color: var(--text-2);
  padding: 2px 9px;
  border-radius: 5px;
  font-size: 0.75rem;
  font-weight: 500;
}

.count-badge {
  background: var(--surface-2);
  color: var(--text-2);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: 20px;
}

/* ============================================================ TABLE */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.data-table thead th {
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 11px 16px;
  text-align: left;
  white-space: nowrap;
}
.data-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: rgba(255,255,255,0.02); }

.table-user { display: flex; align-items: center; gap: 10px; }
.muted { color: var(--text-2); }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }

.row-actions { display: flex; gap: 4px; align-items: center; }

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
}
.table-info { font-size: 0.8rem; color: var(--text-2); }
.pagination { display: flex; gap: 4px; align-items: center; }
.page-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-2);
  width: 30px; height: 30px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: 'DM Sans', sans-serif;
  transition: all var(--transition);
}
.page-btn:hover { background: var(--surface-2); color: var(--text); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }
.page-dots { color: var(--text-2); font-size: 0.8rem; padding: 0 4px; }

/* ============================================================ AVATAR */
.avatar {
  width: 38px; height: 38px;
  background: var(--accent);
  color: var(--bg);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.avatar-sm { width: 30px; height: 30px; font-size: 0.68rem; border-radius: 6px; }

/* ============================================================ PROGRESS */
.progress-bar {
  height: 5px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 4px;
}
.progress-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease; }

/* ============================================================ DASHBOARD */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-blue::before { background: var(--blue); }
.stat-green::before { background: var(--green); }
.stat-amber::before { background: var(--accent); }
.stat-purple::before { background: var(--purple); }

.stat-icon {
  width: 46px; height: 46px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-blue .stat-icon { background: rgba(59,130,246,0.12); color: var(--blue); }
.stat-green .stat-icon { background: rgba(16,185,129,0.12); color: var(--green); }
.stat-amber .stat-icon { background: rgba(245,158,11,0.12); color: var(--accent); }
.stat-purple .stat-icon { background: rgba(139,92,246,0.12); color: var(--purple); }

.stat-number {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label { font-size: 0.8rem; color: var(--text-2); }
.stat-change { font-size: 0.72rem; margin-top: 6px; font-weight: 500; }
.stat-change.positive { color: var(--green); }
.stat-change.neutral { color: var(--text-2); }

.mid-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 22px;
}
.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 18px;
}

.teacher-list { padding: 8px 0; }
.teacher-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--border);
}
.teacher-item:last-child { border-bottom: none; }
.teacher-info { flex: 1; min-width: 0; }
.teacher-name { display: block; font-weight: 500; font-size: 0.85rem; }
.teacher-dept { display: block; font-size: 0.75rem; color: var(--text-2); }

.course-list { padding: 8px 0; }
.course-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--border);
}
.course-item:last-child { border-bottom: none; }
.course-color { width: 3px; height: 36px; border-radius: 3px; flex-shrink: 0; }
.course-info { flex: 1; min-width: 0; }
.course-name { display: block; font-weight: 500; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.course-teacher { display: block; font-size: 0.72rem; color: var(--text-2); }
.course-progress-wrap { min-width: 90px; }
.course-students { font-size: 0.72rem; color: var(--text-2); margin-bottom: 4px; text-align: right; }

.gallery-grid-sm {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: 16px;
}
.gallery-thumb {
  border-radius: 8px;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition);
  overflow: hidden;
  position: relative;
}
.gallery-thumb:hover { transform: scale(1.03); }
.gallery-emoji { font-size: 1.6rem; }
.gallery-label {
  font-size: 0.6rem;
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 0 4px;
  margin-top: 2px;
  line-height: 1.2;
}

/* ============================================================ TEACHERS CARD GRID */
.teachers-card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.teacher-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.teacher-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.teacher-card-top {
  padding: 24px 20px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.teacher-avatar {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: white;
}
.teacher-card-body { padding: 0 20px 16px; }
.tc-name { font-weight: 600; font-size: 0.95rem; margin-bottom: 3px; }
.tc-dept { font-size: 0.8rem; color: var(--accent); font-weight: 500; }
.tc-role { font-size: 0.75rem; color: var(--text-2); margin-bottom: 10px; }
.tc-contacts { font-size: 0.72rem; color: var(--text-2); display: flex; flex-direction: column; gap: 3px; }
.teacher-card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}

/* ============================================================ COURSES GRID */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.course-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition), box-shadow var(--transition);
}
.course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.course-card-bar { height: 3px; }
.course-card-body { padding: 18px; flex: 1; }
.course-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.course-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.course-card-title { font-weight: 600; font-size: 0.9rem; margin-bottom: 3px; }
.course-card-class { font-size: 0.75rem; color: var(--text-2); margin-bottom: 4px; }
.course-card-teacher { font-size: 0.75rem; color: var(--text-2); margin-bottom: 12px; }
.course-stats-row { display: flex; gap: 0; margin-bottom: 14px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.cs-stat { flex: 1; text-align: center; padding: 8px 6px; }
.cs-stat + .cs-stat { border-left: 1px solid var(--border); }
.cs-stat strong { display: block; font-size: 0.9rem; font-weight: 700; }
.cs-stat span { display: block; font-size: 0.65rem; color: var(--text-2); }
.course-progress-label { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--text-2); margin-bottom: 3px; }
.course-card-footer { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; }

/* ============================================================ RESULTS */
.result-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 4px;
}
.rs-card {
  border-radius: var(--radius);
  padding: 18px 20px;
  text-align: center;
  border: 1px solid var(--border);
}
.rs-value {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}
.rs-label { font-size: 0.75rem; color: var(--text-2); font-weight: 500; }
.rs-green { background: rgba(16,185,129,0.06); }
.rs-green .rs-value { color: var(--green); }
.rs-blue { background: rgba(59,130,246,0.06); }
.rs-blue .rs-value { color: var(--blue); }
.rs-amber { background: rgba(245,158,11,0.06); }
.rs-amber .rs-value { color: var(--accent); }
.rs-red { background: rgba(239,68,68,0.06); }
.rs-red .rs-value { color: var(--red); }

/* ============================================================ GALLERY */
.gallery-albums {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.album-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.album-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.album-cover {
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.album-emoji { font-size: 3rem; }
.album-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition);
}
.album-cover:hover .album-overlay { opacity: 1; }
.btn-view-album {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 6px;
  padding: 8px 18px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
}
.album-info { padding: 14px 16px; }
.album-title { font-weight: 600; font-size: 0.875rem; margin-bottom: 5px; }
.album-meta { display: flex; align-items: center; gap: 4px; font-size: 0.75rem; margin-bottom: 4px; }
.album-cat { font-weight: 600; }
.album-sep { color: var(--text-2); }
.album-count { color: var(--text-2); }
.album-date { font-size: 0.72rem; color: var(--text-2); }
.album-actions {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}

/* ============================================================ SLIDERS */
.slider-preview {
  padding: 20px;
}
.slider-track {
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  height: 200px;
}
.slide-item {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.5s ease;
  gap: 6px;
}
.slide-item.slide-active { opacity: 1; }
.slide-emoji { font-size: 2.5rem; }
.slide-item h3 { font-family: 'Playfair Display', serif; font-size: 1.3rem; font-weight: 700; color: white; }
.slide-item p { font-size: 0.875rem; color: rgba(255,255,255,0.8); }

.slider-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 14px;
}
.slider-arrow {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 32px; height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.slider-arrow:hover { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.slider-dots { display: flex; gap: 6px; }
.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: all var(--transition);
}
.dot.dot-active { background: var(--accent); width: 20px; border-radius: 4px; }

.slides-list { padding: 8px 0; }
.slide-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.slide-row:last-child { border-bottom: none; }
.slide-row:hover { background: rgba(255,255,255,0.02); }
.slide-order { display: flex; align-items: center; gap: 8px; color: var(--text-2); cursor: grab; }
.order-num { font-size: 0.8rem; font-weight: 600; min-width: 20px; }
.slide-thumb {
  width: 70px; height: 42px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.slide-meta { flex: 1; min-width: 0; }
.slide-title-txt { display: block; font-weight: 500; font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slide-subtitle-txt { display: block; font-size: 0.75rem; color: var(--text-2); }

.slide-toggle { display: flex; align-items: center; gap: 8px; }
.toggle-label { font-size: 0.78rem; color: var(--text-2); min-width: 44px; }
.toggle-switch { position: relative; display: inline-block; width: 38px; height: 22px; }
.toggle-switch input { display: none; }
.toggle-track {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 11px;
  cursor: pointer;
  transition: background var(--transition);
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: white;
  transition: transform var(--transition);
}
.toggle-switch input:checked + .toggle-track { background: var(--green); }
.toggle-switch input:checked + .toggle-track::after { transform: translateX(16px); }

/* ============================================================ AUTH */
.auth-body { background: var(--bg); }
.auth-wrap {
  display: flex;
  min-height: 100vh;
}
.auth-left {
  flex: 1;
  background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px;
  position: relative;
  overflow: hidden;
}
.auth-pattern {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(245,158,11,0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(59,130,246,0.08) 0%, transparent 50%);
  pointer-events: none;
}
.auth-left-content { position: relative; z-index: 1; max-width: 440px; }
.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 48px;
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: white;
}
.auth-headline {
  font-family: 'Playfair Display', serif;
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1.2;
  color: white;
  margin-bottom: 18px;
}
.auth-headline em {
  font-style: italic;
  color: var(--accent);
}
.auth-subtext { color: rgba(255,255,255,0.6); font-size: 1rem; margin-bottom: 40px; line-height: 1.7; }
.auth-stats { display: flex; gap: 32px; }
.auth-stat { text-align: center; }
.auth-stat strong { display: block; font-family: 'Playfair Display', serif; font-size: 2rem; font-weight: 700; color: var(--accent); }
.auth-stat span { font-size: 0.8rem; color: rgba(255,255,255,0.6); }

.auth-right {
  width: 480px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.auth-form-wrap { width: 100%; max-width: 360px; }
.auth-form-header { margin-bottom: 32px; }
.auth-form-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.auth-form-header p { color: var(--text-2); font-size: 0.9rem; }

.auth-form { display: flex; flex-direction: column; gap: 18px; }
.form-group { display: flex; flex-direction: column; gap: 7px; }
.form-group label { font-size: 0.825rem; font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.label-hint { font-weight: 400; color: var(--text-2); font-size: 0.75rem; }
.input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  transition: border-color var(--transition);
}
.input-wrap:focus-within { border-color: var(--accent); }
.input-wrap svg { color: var(--text-2); flex-shrink: 0; }
.input-wrap input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  width: 100%;
  padding: 12px 0;
}
.form-check { display: flex; align-items: center; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-2);
  cursor: pointer;
}
.checkbox-label input { cursor: pointer; accent-color: var(--accent); }
.auth-note { margin-top: 20px; font-size: 0.78rem; color: var(--text-2); text-align: center; }

/* ============================================================ OVERLAY */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

/* ============================================================ RESPONSIVE */
@media (max-width: 1400px) {
  .courses-grid { grid-template-columns: repeat(3, 1fr); }
  .teachers-card-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .bottom-grid { grid-template-columns: 1fr 1fr; }
  .gallery-albums { grid-template-columns: repeat(3, 1fr); }
  .courses-grid { grid-template-columns: repeat(2, 1fr); }
  .teachers-card-grid { grid-template-columns: repeat(2, 1fr); }
  .result-summary { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .mid-grid { grid-template-columns: 1fr; }
  .bottom-grid { grid-template-columns: 1fr; }
  .auth-left { display: none; }
  .auth-right { width: 100%; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main { margin-left: 0; }
  .menu-toggle { display: flex; }
  .page-content { padding: 18px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .gallery-albums { grid-template-columns: repeat(2, 1fr); }
  .courses-grid { grid-template-columns: 1fr; }
  .teachers-card-grid { grid-template-columns: repeat(2, 1fr); }
  .auth-headline { font-size: 1.8rem; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .teachers-card-grid { grid-template-columns: 1fr; }
  .gallery-albums { grid-template-columns: 1fr; }
  .page-actions { flex-direction: column; align-items: stretch; }
  .search-bar { max-width: none; }
  .topbar { padding: 0 16px; }
}

/* ============================================================
   MODAL
============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
/* jQuery fadeIn sets display:block, so we use flex via wrapper trick */
.modal { display: none; position: fixed; inset: 0; z-index: 1000; overflow-y: auto; padding: 20px; }
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  margin: auto;
  position: relative;
  top: 50%;
  transform: translateY(-50%);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal.modal-overlay .modal-box { /* when overlay is also the modal */
  position: relative; top: auto; transform: none;
  margin: auto;
}
.modal-lg { max-width: 760px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-family: 'Playfair Display', serif; font-size: 1rem; font-weight: 600; }
.modal-body { padding: 22px; max-height: 70vh; overflow-y: auto; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

body.modal-open { overflow: hidden; }

/* Detail table inside modal */
.detail-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.detail-table th {
  width: 35%; padding: 10px 14px;
  text-align: left; font-weight: 600;
  font-size: 0.75rem; color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.detail-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.detail-table tr:last-child th,
.detail-table tr:last-child td { border-bottom: none; }

/* Lightbox grid inside modal */
.album-lightbox-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.lightbox-thumb {
  aspect-ratio: 1;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition);
  gap: 4px;
}
.lightbox-thumb:hover { transform: scale(1.05); }
.lightbox-thumb span:first-child { font-size: 1.8rem; }
.lbt-label { font-size: 0.65rem; color: rgba(255,255,255,0.7); }

/* ============================================================
   TOAST
============================================================ */
#toastContainer {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--text);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  pointer-events: all;
  max-width: 320px;
  border-left: 3px solid var(--border);
}
.toast.toast-show { opacity: 1; transform: translateY(0); }
.toast-success { border-left-color: var(--green); }
.toast-error   { border-left-color: var(--red); }
.toast-info    { border-left-color: var(--blue); }
.toast-warning { border-left-color: var(--accent); }

/* ============================================================
   TOOLTIP
============================================================ */
.tooltip-box {
  position: absolute;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.75rem;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 5000;
  pointer-events: none;
  display: none;
}
