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

:root {
  --primary: #3B3786;
  --primary-light: #4A42B0;
  --secondary: #5B4FD6;
  --secondary-light: #7B6FE8;
  --accent: #00B894;
  --bg: #F0F0F8;
  --card-bg: #ffffff;
  --text-dark: #2D3436;
  --text-medium: #4a5568;
  --text-light: #636E72;
  --success: #00B894;
  --warning: #FDAA5B;
  --error: #E17055;
  --info: #74B9FF;
  --sidebar-bg: #3B3786;
  --sidebar-active: #5B4FD6;
  --border: #E2E8F0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text-dark);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden { display: none !important; }

/* ══════════════════════════════════════
   PAGE LOADER OVERLAY
   ══════════════════════════════════════ */
.page-loader {
  position: absolute;
  inset: 0;
  background: rgba(240, 240, 248, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  border-radius: var(--radius-md);
  transition: opacity 0.3s ease;
}
.page-loader.hidden {
  display: none !important;
  opacity: 0;
}
.page-loader-content {
  text-align: center;
}
.page-loader-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--border);
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  animation: pageLoaderSpin 0.8s linear infinite;
  margin: 0 auto 14px;
}
@keyframes pageLoaderSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.page-loader-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-medium);
}

/* ══════════════════════════════════════
   SCROLLBAR
   ══════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c4c4c4; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #999; }

/* ══════════════════════════════════════
   SPLASH LOADER
   ══════════════════════════════════════ */
.splash-loader {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #3B3786 0%, #4A42B0 50%, #5B4FD6 100%);
}
.splash-loader.hidden { display: none; }
.splash-content {
  text-align: center;
  color: #fff;
}
.splash-icon {
  width: 72px; height: 72px;
  margin: 0 auto 16px;
  background: rgba(255,255,255,0.15);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.splash-icon .material-icons-round { font-size: 40px; color: #fff; }
.splash-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 24px;
  letter-spacing: 1px;
}
.splash-progress-bar {
  width: 220px;
  height: 6px;
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
  margin: 0 auto 12px;
  overflow: hidden;
}
.splash-progress-fill {
  width: 30%;
  height: 100%;
  background: #fff;
  border-radius: 3px;
  animation: splashProgress 1.5s ease-in-out infinite;
}
@keyframes splashProgress {
  0% { width: 10%; margin-left: 0; }
  50% { width: 50%; margin-left: 25%; }
  100% { width: 10%; margin-left: 90%; }
}
.splash-text {
  font-size: 14px;
  opacity: 0.7;
}

/* ══════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #3B3786 0%, #4A42B0 50%, #5B4FD6 100%);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  top: -200px;
  right: -200px;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: rgba(255,255,255,0.03);
  bottom: -100px;
  left: -100px;
}

.login-bubbles {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.login-bubble {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  animation: floatLoginBubble 20s ease-in-out infinite;
}

.login-bubble-1 {
  width: 280px;
  height: 280px;
  top: -80px;
  left: -60px;
  animation-delay: 0s;
  animation-duration: 18s;
}

.login-bubble-2 {
  width: 180px;
  height: 180px;
  top: 20%;
  right: -40px;
  animation-delay: -3s;
  animation-duration: 22s;
}

.login-bubble-3 {
  width: 120px;
  height: 120px;
  bottom: 15%;
  left: 10%;
  animation-delay: -6s;
  animation-duration: 25s;
}

.login-bubble-4 {
  width: 200px;
  height: 200px;
  bottom: -60px;
  right: 20%;
  animation-delay: -9s;
  animation-duration: 20s;
}

.login-bubble-5 {
  width: 100px;
  height: 100px;
  top: 50%;
  left: 30%;
  animation-delay: -4s;
  animation-duration: 16s;
}

.login-bubble-6 {
  width: 150px;
  height: 150px;
  top: 10%;
  left: 50%;
  animation-delay: -2s;
  animation-duration: 19s;
}

.login-bubble-7 {
  width: 90px;
  height: 90px;
  bottom: 30%;
  right: 10%;
  animation-delay: -5s;
  animation-duration: 23s;
}

.login-bubble-8 {
  width: 220px;
  height: 220px;
  top: 60%;
  right: -50px;
  animation-delay: -8s;
  animation-duration: 17s;
}

.login-bubble-9 {
  width: 130px;
  height: 130px;
  top: 75%;
  left: 50%;
  animation-delay: -11s;
  animation-duration: 21s;
}

.login-bubble-10 {
  width: 160px;
  height: 160px;
  top: 5%;
  right: 30%;
  animation-delay: -7s;
  animation-duration: 24s;
}

@keyframes floatLoginBubble {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -30px) scale(1.05); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(15px, 10px) scale(1.02); }
}

.login-card {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  position: relative;
  z-index: 1;
  animation: fadeInUp 0.5s ease;
}

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

.login-icon {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(59,55,134,0.08), rgba(91,79,214,0.12));
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.login-icon .material-icons-round { font-size: 44px; color: var(--secondary); }

.login-card h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 36px;
}

.input-group {
  position: relative;
  margin-bottom: 18px;
}

.input-group input {
  width: 100%;
  padding: 14px 16px 14px 48px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: var(--transition);
  background: #FAFBFC;
  color: var(--text-dark);
}

.input-group input::placeholder { color: #A0AEC0; }
.input-group input:focus { border-color: var(--secondary); background: #fff; box-shadow: 0 0 0 3px rgba(91,79,214,0.1); }


.input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: #A0AEC0;
  transition: var(--transition);
}

.input-group input:focus ~ .input-icon,
.input-group:focus-within .input-icon { color: var(--secondary); }

.toggle-password {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: #A0AEC0;
  cursor: pointer;
  transition: var(--transition);
}

.toggle-password:hover { color: var(--text-dark); }

/* ══════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════ */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  border: none;
  padding: 13px 28px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.2px;
  box-shadow: 0 2px 8px rgba(59,55,134,0.25);
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(59,55,134,0.35); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: transparent;
  color: var(--text-medium);
  border: 2px solid var(--border);
  padding: 11px 24px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover { border-color: #CBD5E0; background: #F7FAFC; }

.btn-full { width: 100%; margin-top: 8px; }

#loginBtn {
  position: relative;
  overflow: hidden;
  z-index: 1;
}
#loginBtn::before,
#loginBtn::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  z-index: -1;
  animation: floatLoginBubble 6s ease-in-out infinite;
}
#loginBtn::before {
  width: 40px;
  height: 40px;
  top: -10px;
  left: -8px;
  animation-delay: 0s;
}
#loginBtn::after {
  width: 28px;
  height: 28px;
  bottom: -6px;
  right: -4px;
  animation-delay: -2s;
}

.btn-edit {
  background: linear-gradient(135deg, var(--secondary), var(--secondary-light));
  color: #fff;
  border: none;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
  box-shadow: 0 1px 4px rgba(91,79,214,0.3);
}

.btn-edit:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(91,79,214,0.4); }

.btn-delete {
  background: linear-gradient(135deg, var(--error), #e8836c);
  color: #fff;
  border: none;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
  box-shadow: 0 1px 4px rgba(225,112,85,0.3);
}

.btn-delete:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(225,112,85,0.4); }

.login-links {
  display: flex;
  justify-content: space-between;
  margin-top: 18px;
}

.login-links a {
  font-size: 13px;
  color: var(--secondary);
  cursor: pointer;
  font-weight: 500;
  transition: var(--transition);
  text-decoration: none;
}

.login-links a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.login-card select {
  width: 100%;
  padding: 14px 16px 14px 48px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: var(--transition);
  background: #FAFBFC;
  color: var(--text-dark);
  appearance: none;
  -webkit-appearance: none;
}

.login-card select:focus {
  border-color: var(--secondary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(91,79,214,0.1);
}

.demo-text {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-light);
  opacity: 0.7;
  background: #F7FAFC;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

/* ══════════════════════════════════════
   DASHBOARD LAYOUT
   ══════════════════════════════════════ */
.dashboard-page {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
}

/* ══════════════════════════════════════
   CIRCLE BUBBLES
   ══════════════════════════════════════ */
.bubbles {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bubble {
  position: absolute;
  border-radius: 50%;
  opacity: 0.5;
  animation: floatBubble 20s ease-in-out infinite;
}

.bubble-1 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(91,79,214,0.08) 0%, transparent 70%);
  top: -80px;
  right: -60px;
  animation-delay: 0s;
  animation-duration: 18s;
}

.bubble-2 {
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(74,66,176,0.07) 0%, transparent 70%);
  bottom: 10%;
  left: 280px;
  animation-delay: -3s;
  animation-duration: 22s;
}

.bubble-3 {
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, rgba(59,55,134,0.06) 0%, transparent 70%);
  top: 30%;
  right: 15%;
  animation-delay: -6s;
  animation-duration: 25s;
}

.bubble-4 {
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(91,79,214,0.06) 0%, transparent 70%);
  bottom: -50px;
  right: 25%;
  animation-delay: -9s;
  animation-duration: 20s;
}

.bubble-5 {
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(74,66,176,0.08) 0%, transparent 70%);
  top: 15%;
  left: 300px;
  animation-delay: -4s;
  animation-duration: 16s;
}

.bubble-6 {
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(59,55,134,0.05) 0%, transparent 70%);
  top: 60%;
  right: 5%;
  animation-delay: -7s;
  animation-duration: 24s;
}

@keyframes floatBubble {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(15px, -20px) scale(1.05); }
  50% { transform: translate(-10px, 15px) scale(0.95); }
  75% { transform: translate(20px, 10px) scale(1.03); }
}

/* ══════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════ */
.sidebar {
  width: 230px;
  background: linear-gradient(180deg, #3B3786 0%, #4A42B0 50%, #5B4FD6 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 4px 0 20px rgba(0,0,0,0.15);
  overflow: hidden;
}

.sidebar-bubbles {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.sb-bubble {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  animation: sidebarFloat 15s ease-in-out infinite;
}

.sb-bubble-1 {
  width: 120px;
  height: 120px;
  top: -30px;
  right: -40px;
  animation-duration: 14s;
}

.sb-bubble-2 {
  width: 80px;
  height: 80px;
  top: 25%;
  left: -20px;
  background: rgba(255,255,255,0.04);
  animation-delay: -3s;
  animation-duration: 18s;
}

.sb-bubble-3 {
  width: 60px;
  height: 60px;
  top: 50%;
  right: -10px;
  background: rgba(255,255,255,0.05);
  animation-delay: -6s;
  animation-duration: 16s;
}

.sb-bubble-4 {
  width: 100px;
  height: 100px;
  bottom: 15%;
  left: -30px;
  background: rgba(255,255,255,0.04);
  animation-delay: -9s;
  animation-duration: 20s;
}

.sb-bubble-5 {
  width: 70px;
  height: 70px;
  bottom: -15px;
  right: 20px;
  background: rgba(255,255,255,0.05);
  animation-delay: -5s;
  animation-duration: 17s;
}

@keyframes sidebarFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(8px, -12px) scale(1.06); }
  50% { transform: translate(-6px, 8px) scale(0.94); }
  75% { transform: translate(10px, 5px) scale(1.04); }
}

.sidebar-close {
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  display: none;
  font-size: 22px;
  transition: var(--transition);
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
}

.sidebar-close:hover { color: #fff; }

.sidebar-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  margin: 0 16px;
  position: relative;
  z-index: 1;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 14px;
  overflow-y: auto;
  position: relative;
  z-index: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  margin-bottom: 4px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.nav-item:hover {
  color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.06);
}

.nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, #5B4FD6, #7B6FE8);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(91,79,214,0.4);
}

.nav-item .material-icons-round { font-size: 21px; }

/* Sidebar Submenu */
.nav-group {
  margin-bottom: 4px;
}

.nav-parent {
  justify-content: flex-start;
}

.nav-parent .nav-arrow {
  margin-left: auto;
  font-size: 18px;
  transition: transform 0.25s ease;
}

.nav-group.open .nav-parent .nav-arrow {
  transform: rotate(180deg);
}

.nav-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding-left: 16px;
}

.nav-group.open .nav-submenu {
  max-height: 200px;
}

.nav-sub-item {
  padding: 10px 16px !important;
  font-size: 13px !important;
  margin-bottom: 2px !important;
}

.nav-sub-item .material-icons-round {
  font-size: 18px !important;
}

.sidebar-user-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: rgba(255,255,255,0.06);
  position: relative;
  z-index: 1;
}

.sidebar-user-top .user-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5B4FD6, #7B6FE8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  flex-shrink: 0;
}

.sidebar-user-top .user-info { flex: 1; min-width: 0; }
.sidebar-user-top .user-name { color: #fff; font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-top .user-role { color: rgba(255,255,255,0.55); font-size: 12px; margin-top: 2px; font-weight: 500; }
.sidebar-user-top .user-school { color: rgba(255,255,255,0.4); font-size: 11px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  backdrop-filter: blur(2px);
  transition: opacity 0.3s;
}

/* ══════════════════════════════════════
   SIDEBAR FOOTER
   ══════════════════════════════════════ */
.sidebar-footer {
  padding: 16px 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
  position: relative;
  z-index: 1;
}

.sidebar-logout-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.12);
  color: #ffffff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.sidebar-logout-btn .material-icons-round { font-size: 20px; color: #ffffff; }

.sidebar-logout-btn:hover {
  background: rgba(255,255,255,0.2);
  color: #ffffff;
}

.sidebar-version {
  text-align: center;
  color: rgba(255,255,255,0.9);
  font-size: 11px;
  margin-top: 12px;
  font-weight: 500;
}

.sidebar-copyright {
  text-align: center;
  color: rgba(255,255,255,0.9);
  font-size: 10px;
  margin-top: 4px;
}

/* ══════════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════════ */
.main-content {
  flex: 1;
  margin-left: 230px;
  width: calc(100vw - 230px);
  max-width: calc(100vw - 230px);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.35s;
  position: relative;
  z-index: 1;
  overflow-x: hidden;
}

/* ══════════════════════════════════════
   TOPBAR
   ══════════════════════════════════════ */
.topbar {
  height: 68px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  box-shadow: 0 1px 0 var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-left h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: -0.3px;
}

.menu-toggle {
  display: none;
  cursor: pointer;
  font-size: 26px;
  color: var(--text-dark);
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.menu-toggle:hover { background: var(--bg); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 9px 14px;
  gap: 8px;
  transition: var(--transition);
}

.search-box:focus-within { border-color: var(--secondary); background: #fff; box-shadow: 0 0 0 3px rgba(91,79,214,0.08); }
.search-box .material-icons-round { font-size: 20px; color: var(--text-light); }

.search-box input {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  width: 200px;
  color: var(--text-dark);
}

.search-box input::placeholder { color: #A0AEC0; }

.topbar-icon {
  font-size: 22px;
  color: var(--text-light);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.topbar-icon:hover { background: var(--bg); color: var(--text-dark); }

.topbar-user {
  position: relative;
  cursor: pointer;
  margin-left: 4px;
}

.user-avatar-sm {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  transition: var(--transition);
  border: 2px solid transparent;
}

.user-avatar-sm:hover { border-color: var(--secondary); }

.user-dropdown {
  position: absolute;
  top: 52px;
  right: 0;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  overflow: hidden;
  z-index: 200;
  border: 1px solid var(--border);
  animation: dropdownIn 0.2s ease;
}

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-medium);
}

.dropdown-item .material-icons-round { font-size: 20px; }
.dropdown-item:hover { background: var(--bg); }
.dropdown-item.logout { color: var(--error); }
.dropdown-item.logout .material-icons-round { color: var(--error); }
.dropdown-divider { height: 1px; background: var(--border); }

/* ══════════════════════════════════════
   PAGE CONTENT
   ══════════════════════════════════════ */
.page-content {
  padding: 28px;
  flex: 1;
  min-width: 0;
}

.student-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: flex-end;
}

.student-action-btn {
  height: 42px;
  padding: 0 20px !important;
  display: flex !important;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-size: 13px !important;
  box-sizing: border-box;
}

.student-filter-wrap {
  position: relative;
}

.filter-badge {
  display: none;
  background: #fff;
  color: var(--primary);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 700;
  min-width: 14px;
  text-align: center;
}

.student-mobile-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.student-mobile-card:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--secondary);
}

.student-mobile-card:active {
  background: #f8f9fa;
}

@media (max-width: 768px) {
  #screen-3 .card {
    padding: 8px 0;
    border: none;
    box-shadow: none;
    border-radius: 0;
    background: transparent;
  }
  #screen-3 .card-header {
    padding: 0 10px;
    margin-bottom: 10px;
  }
  #screen-3 #studentCards {
    padding: 0 10px;
  }
  #screen-3 .pagination {
    padding: 8px 10px;
  }
  .student-mobile-card {
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    padding: 10px 12px;
  }
}

.student-filter-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  border: 1px solid var(--border);
  min-width: 260px;
  z-index: 999;
}

.student-filter-panel .btn-secondary,
.student-filter-panel .btn-primary {
  height: 36px !important;
  flex: 1;
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-size: 13px !important;
  padding: 0 16px !important;
  box-sizing: border-box;
}

.student-filter-panel .btn-secondary {
  background: #e74c3c !important;
  color: #fff !important;
  border-color: #e74c3c !important;
}

.student-filter-panel .btn-primary {
  background: #3B3786 !important;
  color: #fff !important;
  box-shadow: none !important;
}

.student-filter-wrap > .btn-primary .material-icons-round {
  color: #fff !important;
}

.card-header .btn-primary .material-icons-round {
  color: #fff;
}

@media (max-width: 768px) {
  .student-header-actions {
    flex-wrap: wrap;
    justify-content: stretch;
  }
  .student-header-actions .table-search-bar {
    flex: 1 1 100%;
    max-width: 100%;
    order: 1;
  }
  .student-filter-wrap {
    order: 2;
    flex: 1;
  }
  .student-action-btn {
    flex: 1;
    justify-content: center;
  }
  #addStudentBtn {
    order: 3;
    flex: 1;
  }
  .student-filter-panel {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    min-width: 100%;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 999;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
  }
  .student-filter-wrap .student-filter-panel[style*="display: block"] ~ .filter-overlay,
  .student-filter-panel[style*="display: block"]::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: -1;
  }
}

.screen { display: none; animation: fadeIn 0.3s ease; }
.screen.active { display: block; }


@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ══════════════════════════════════════
   STATS CARDS
   ══════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.stats-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 18px;
  transition: var(--transition);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.stats-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  transform: translate(20px, -20px);
}

.stats-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

.stats-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stats-icon .material-icons-round { font-size: 26px; color: var(--accent); }
.stats-info { position: relative; z-index: 1; }
.stats-value { font-size: 26px; font-weight: 700; color: var(--text-dark); letter-spacing: -0.5px; line-height: 1.2; }
.stats-title { font-size: 13px; color: var(--text-light); margin-top: 2px; font-weight: 500; }
.stats-subtitle { font-size: 11px; color: var(--text-light); opacity: 0.7; margin-top: 2px; }

/* ══════════════════════════════════════
   CARDS
   ══════════════════════════════════════ */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.card-header h3 {
  margin-right: auto;
}

.card-header .table-search-bar {
  min-width: 180px;
  max-width: 280px;
}

.card-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.card-header h3 > .material-icons-round {
  color: #fff;
  background: var(--primary);
  padding: 4px;
  border-radius: 6px;
}

/* Consistent header layout for all pages */
.card-header .table-search-bar {
  height: 42px;
  padding: 0 14px;
  box-sizing: border-box;
}

.card-header .btn-primary {
  height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  box-sizing: border-box;
}

.card-header .student-filter-wrap .btn-primary {
  height: 42px;
}

.card-header.super-admin-gradient {
  background: linear-gradient(135deg, #3B3786 0%, #4A42B0 50%, #5B4FD6 100%);
  padding: 16px 20px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  margin: -24px -24px 20px -24px;
}

.card-header.super-admin-gradient h3 {
  color: #fff;
}

.card-header.super-admin-gradient .btn-primary {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
}

.card-header.super-admin-gradient .btn-primary:hover {
  background: rgba(255, 255, 255, 0.35);
}

.card-header.super-admin-gradient .table-search-bar {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.card-header.super-admin-gradient .table-search-bar input {
  color: #fff;
}

.card-header.super-admin-gradient .table-search-bar input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.card-header.super-admin-gradient .table-search-bar .material-icons-round {
  color: rgba(255, 255, 255, 0.7);
}


.card-header .material-icons-round {
  color: var(--text-light);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.card-header .material-icons-round:hover { background: var(--bg); color: var(--text-dark); }

/* ══════════════════════════════════════
   DASHBOARD GRID
   ══════════════════════════════════════ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ══════════════════════════════════════
   LIST ITEMS
   ══════════════════════════════════════ */
.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.list-item:hover { background: #F7FAFC; }

.list-item + .list-item { border-top: 1px solid #f5f5f5; }

.list-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

.list-details { flex: 1; min-width: 0; }
.list-details .name { font-weight: 600; font-size: 14px; color: var(--text-dark); }
.list-details .sub { font-size: 14px; color: var(--text-light); margin-top: 1px; }

.payment-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.payment-amount { text-align: right; }
.payment-amount .amount { font-weight: 700; font-size: 14px; color: var(--text-dark); }

/* ══════════════════════════════════════
   STATUS CHIP
   ══════════════════════════════════════ */
.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.status-chip.active, .status-chip.paid {
  background: rgba(0, 184, 148, 0.1);
  color: var(--success);
}

.status-chip.free {
  background: rgba(108, 92, 231, 0.1);
  color: #6C5CE7;
}

.status-chip.inactive {
  background: rgba(99, 110, 114, 0.08);
  color: var(--text-light);
}

.status-chip.pending {
  background: rgba(253, 170, 91, 0.12);
  color: #E08A2B;
}

.status-chip.failed {
  background: rgba(225, 112, 85, 0.1);
  color: var(--error);
}

/* ══════════════════════════════════════
   BOARD OVERVIEW
   ══════════════════════════════════════ */
.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.board-item {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: var(--transition);
  background: #FAFBFC;
}

.board-item:hover {
  border-color: var(--secondary);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.board-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.board-item-header .name { font-weight: 700; font-size: 16px; color: var(--text-dark); }
.board-item .sub { font-size: 12px; color: var(--text-light); }

/* ══════════════════════════════════════
   DATA TABLES
   ══════════════════════════════════════ */
.table-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 180px);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: #F7FAFC;
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-light);
  white-space: nowrap;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}

.super-admin-thead th {
  background: #3B3786;
  color: #fff;
  border-bottom: none;
  font-size: 13px;
}

.hide-role-column th:nth-child(8),
.hide-role-column td:nth-child(8) {
  display: none;
}


tbody td {
  font-size: 14px;
}

.admin-list-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3B3786, #5B4FD6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
}

tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid #F0F4F8;
  white-space: nowrap;
  color: var(--text-medium);
  font-size: 13px;
}

tbody tr { transition: var(--transition); }
tbody tr:hover { background: #F7FAFC; }
tbody tr[style*="cursor:pointer"]:hover { background: #EEF2FF; }
tbody tr:last-child td { border-bottom: none; }

.action-btns { display: flex; gap: 6px; align-items: center; }

.btn-icon {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon .material-icons-round { font-size: 18px; }

.btn-icon.edit {
  background: rgba(91,79,214,0.1);
  color: var(--secondary);
}

.btn-icon.edit:hover {
  background: var(--secondary);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(91,79,214,0.35);
}

.btn-icon.delete {
  background: rgba(225,112,85,0.1);
  color: var(--error);
}

.btn-icon.delete:hover {
  background: var(--error);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(225,112,85,0.35);
}

/* ══════════════════════════════════════
   STATUS TOGGLE
   ══════════════════════════════════════ */
.status-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
  display: inline-block;
}

.status-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.status-toggle .slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #CBD5E0;
  border-radius: 24px;
  transition: var(--transition);
}

.status-toggle .slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.status-toggle input:checked + .slider {
  background: var(--success);
}

.status-toggle input:checked + .slider::before {
  transform: translateX(20px);
}

/* ══════════════════════════════════════
   MODAL
   ══════════════════════════════════════ */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: #fff;
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  z-index: 1;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-content.modal-full {
  max-width: 95vw;
  max-height: 95vh;
}

/* Wide modal for Payment Receive & Payment Plan */
.modal-content.modal-wide {
  max-width: 650px;
}
.modal-content.modal-aiworkflow-wide {
  max-width: 850px;
}


.pp-grid-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.pp-grid-row input[type="date"] {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.pp-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 768px) {
  .pp-grid-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .pp-grid-row {
    grid-template-columns: 1fr;
  }
  .pp-grid-2col {
    grid-template-columns: 1fr;
  }
}

/* Admin Student modal — full width & full height, beside sidebar */
.modal-content.modal-student-admin {
  max-width: 100%;
  max-height: 100vh;
  height: 100vh;
  border-radius: 0 !important;
  overflow-y: auto;
  box-shadow: none;
  animation: none;
}

.modal-student-admin .modal-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
}

.modal-student-admin .modal-fields-grid .modal-field.full-width {
  grid-column: 1 / -1;
}

/* When student modal is open, shift to right of sidebar */
.modal:has(.modal-student-admin) {
  padding: 0;
  left: 230px;
  right: 0;
  width: calc(100vw - 230px);
}

@media (max-width: 768px) {
  .modal:has(.modal-student-admin) {
    left: 0;
    width: 100vw;
  }
  .modal-content.modal-student-admin {
    max-width: 100%;
  }
  .modal-student-admin .modal-fields-grid {
    grid-template-columns: 1fr;
  }
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-content h3 {
  background: linear-gradient(135deg, #3B3786 0%, #4A42B0 50%, #5B4FD6 100%);
  color: #fff;
  margin: -32px -32px 24px -32px;
  padding: 20px 32px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-close-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.2s;
}

.modal-close-btn:hover {
  background: rgba(255,255,255,0.15);
}

.modal-field { margin-bottom: 16px; }

.modal-field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.modal-field input,
.modal-field select {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 16px;
  outline: none;
  transition: var(--transition);
  background: #FAFBFC;
  color: var(--text-dark);
}

.modal-field input:focus,
.modal-field select:focus,
.modal-field textarea:focus {
  border-color: var(--secondary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(91,79,214,0.08);
}

.board-tag {
  display: inline-block;
  padding: 4px 12px;
  margin: 2px 4px 2px 0;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.board-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px;
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  max-height: 150px;
  overflow-y: auto;
}
.board-check-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  background: #e8e6f0;
  color: #666;
}
.board-check-item.checked {
  background: var(--primary);
  color: #fff;
}
.board-check-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #fff;
  cursor: pointer;
}

.modal-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* Logo upload */
.logo-upload-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-preview {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-lg);
  border: 2px dashed #d0d0d0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #f8f8fa;
}

.logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.logo-preview .material-icons-round {
  font-size: 32px;
  color: #bbb;
}

/* Chapter image upload (multiple) */
.chapter-upload-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ch-images-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 20px;
}

.ch-img-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #e0e0e0;
  background: #f8f8fa;
}

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

.ch-img-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.ch-img-remove:hover {
  background: rgba(220,53,69,0.85);
}

.ch-table-imgs {
  display: flex;
  gap: 4px;
  align-items: center;
}

.ch-table-imgs img {
  border: 1px solid #e0e0e0;
}

/* Chapter videos preview in modal */
.ch-videos-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 20px;
  margin-top: 4px;
  margin-bottom: 4px;
}

.ch-video-thumb {
  position: relative;
  width: 120px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #e0e0e0;
  background: #f8f8fa;
}

.ch-video-preview {
  margin-top: 4px;
  margin-bottom: 4px;
}

.ch-vid-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #e0e0e0;
  border-top: 3px solid #3B3786;
  border-radius: 50%;
  animation: ch-spin 0.8s linear infinite;
}

@keyframes ch-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Chapter video player modal */
.ch-video-modal-content {
  position: relative;
  z-index: 1001;
  max-width: 720px;
  width: 90%;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.ch-vid-play:hover {
  transform: scale(1.2);
  transition: transform 0.15s;
}

.ch-vid-thumb {
  position: relative;
  width: 100px;
  height: 70px;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid #e0e0e0;
  background: #000;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
}

.btn-remove-logo {
  color: #e74c3c;
  border-color: #e74c3c;
}

.table-logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ══════════════════════════════════════
   SNACKBAR
   ══════════════════════════════════════ */
.snackbar {
  position: fixed;
  bottom: -80px;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 28px;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  transition: bottom 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
}

.snackbar.show { bottom: 28px; }
.snackbar.success { background: linear-gradient(135deg, var(--success), #2dd9a4); }
.snackbar.error { background: linear-gradient(135deg, var(--error), #e8836c); }

/* ══════════════════════════════════════
   MOBILE TABLE CARDS
   ══════════════════════════════════════ */
/* ══════════════════════════════════════
   STUDENT PROFILE PHOTO UPLOAD
   ══════════════════════════════════════ */
.profile-upload-area {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  background: #FAFBFC;
  transition: var(--transition);
}

.profile-upload-area:hover {
  border-color: var(--secondary);
  background: rgba(91, 79, 214, 0.02);
}

.profile-upload-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(59,55,134,0.08), rgba(91,79,214,0.12));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  border: 3px solid var(--border);
  transition: var(--transition);
}

.profile-upload-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-upload-preview .material-icons-round {
  font-size: 32px;
  color: var(--secondary);
  opacity: 0.5;
}

.profile-upload-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-upload-info .btn-sm {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  font-size: 12px;
  width: fit-content;
}

.profile-upload-hint {
  font-size: 11px;
  color: var(--text-light);
  opacity: 0.7;
}

@media (max-width: 480px) {
  .profile-upload-area {
    flex-direction: column;
    text-align: center;
    padding: 14px;
  }
  .profile-upload-preview {
    width: 64px;
    height: 64px;
  }
  .profile-upload-info {
    align-items: center;
  }
  .profile-upload-info .btn-sm {
    width: 100%;
    justify-content: center;
  }
}

.mobile-cards { display: none; }

.mobile-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  transition: var(--transition);
}

.mobile-card:hover { box-shadow: var(--shadow-sm); }
.mobile-card[style*="cursor:pointer"]:hover { box-shadow: var(--shadow-md); border-color: var(--secondary-light); }

.mobile-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
}

.mobile-card-row + .mobile-card-row {
  border-top: 1px solid #F0F4F8;
}

.mobile-card-label {
  font-weight: 600;
  color: var(--text-light);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
  margin-right: 12px;
}

.mobile-card-value {
  color: var(--text-medium);
  text-align: right;
  word-break: break-word;
}

.mobile-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}

.mobile-card-header .name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-dark);
}

.mobile-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.mobile-card-actions .btn-edit,
.mobile-card-actions .btn-delete {
  flex: 1;
  text-align: center;
  padding: 10px 12px;
  font-size: 13px;
}

/* ══════════════════════════════════════
   RESPONSIVE — TABLET (1024px)
   ══════════════════════════════════════ */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .search-box { display: none; }
  .page-content { padding: 20px; }
  .topbar { padding: 0 20px; }
  .card-header .table-search-bar { max-width: 280px; }
  .card-header .btn-primary { padding: 11px 20px; font-size: 13px; white-space: nowrap; }
}

/* ══════════════════════════════════════
   RESPONSIVE — MOBILE (768px)
   ══════════════════════════════════════ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); width: 280px; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .sidebar-overlay.show { display: block; }
  .main-content { margin-left: 0; width: 100vw; max-width: 100vw; }
  .menu-toggle { display: block; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stats-card { padding: 18px; }
  .stats-value { font-size: 22px; }

  .topbar { height: 60px; padding: 0 16px; }
  .topbar-left h2 { font-size: 17px; }
  .topbar-right { gap: 4px; }
  .topbar-icon { font-size: 20px; padding: 6px; }
  .user-avatar-sm { width: 34px; height: 34px; font-size: 13px; }
  .page-content { padding: 16px; }

  .card { padding: 18px; }
  .card-header { flex-wrap: wrap; gap: 8px; }
  .card-header h3 { font-size: 15px; width: 100%; margin-right: 0; margin-bottom: 4px; }
  .card-header .table-search-bar { flex: 1 1 100%; min-width: 0; max-width: 100%; order: 1; margin-bottom: 4px; }
  .card-header .student-filter-wrap { order: 2; flex: 1; }
  .card-header .student-filter-wrap .btn-primary { width: 100%; height: 38px !important; font-size: 12px !important; padding: 0 14px !important; }
  .card-header > .btn-primary,
  .card-header > .student-action-btn { order: 3; flex: 1; justify-content: center; }
  .card-header .btn-primary { font-size: 12px; height: 38px !important; padding: 0 14px !important; }
  .student-header-actions { width: 100%; flex-wrap: wrap; }
  .student-header-actions .table-search-bar { flex: 1 1 100%; max-width: 100%; margin-bottom: 4px; }

  .card-header.super-admin-gradient { margin: -18px -18px 18px -18px; padding: 14px 16px; }

  .board-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

  .modal { padding: 12px; }
  .modal-content { padding: 24px; margin: 0; border-radius: var(--radius-lg); max-height: 90vh; }
  .modal-row { grid-template-columns: 1fr; }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions button { flex: 1; min-width: 100px; text-align: center; }

  .profile-modal { max-width: 100%; max-height: 85vh; }

  .login-links { flex-wrap: wrap; gap: 8px; justify-content: center; }

  .logo-upload-wrapper { flex-wrap: wrap; }

  /* Hide desktop tables, show mobile cards */
  .table-wrapper { display: none; }
  .mobile-cards { display: block; }

  .pagination { flex-direction: column; align-items: center; gap: 12px; }
  .pagination-size { order: -1; }
}

/* ══════════════════════════════════════
   RESPONSIVE — SMALL MOBILE (480px)
   ══════════════════════════════════════ */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; gap: 10px; }
  .stats-card { padding: 14px; gap: 12px; flex-direction: row; align-items: center; }
  .stats-icon { width: 44px; height: 44px; }
  .stats-icon .material-icons-round { font-size: 22px; }
  .stats-value { font-size: 20px; }
  .stats-title { font-size: 11px; }

  .page-content { padding: 10px; }
  .topbar { padding: 0 10px; height: 56px; }
  .topbar-left h2 { font-size: 15px; }
  .topbar-icon { padding: 4px; font-size: 20px; }
  .user-avatar-sm { width: 32px; height: 32px; font-size: 12px; }

  .card { padding: 12px; border-radius: var(--radius-md); }
  .card-header { margin-bottom: 12px; gap: 8px; }
  .card-header h3 { font-size: 14px; }
  .card-header .btn-primary { padding: 9px 14px; font-size: 12px; }

  .list-item { gap: 10px; padding: 10px 4px; }
  .list-avatar { width: 36px; height: 36px; font-size: 13px; }
  .list-details .name { font-size: 13px; }
  .list-details .sub { font-size: 13px; }
  .payment-amount .amount { font-size: 13px; }

  .board-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .board-item { padding: 14px; }
  .board-item-header .name { font-size: 14px; }

  .login-card { padding: 28px 20px; max-width: 100%; }
  .login-card h1 { font-size: 22px; }
  .login-icon { width: 68px; height: 68px; }
  .login-icon .material-icons-round { font-size: 34px; }
  .login-subtitle { font-size: 13px; margin-bottom: 28px; }
  .input-group input { padding: 12px 14px 12px 44px; font-size: 13px; }
  .input-icon { left: 14px; font-size: 18px; }
  .toggle-password { right: 12px; font-size: 18px; }
  .btn-primary.btn-full { padding: 12px; font-size: 14px; }
  .login-links { flex-direction: column; align-items: center; gap: 10px; }
  .login-links a { font-size: 13px; }

  .modal { padding: 8px; }
  .modal-content { padding: 18px; border-radius: var(--radius-md); max-height: 92vh; }
  .modal-content h3 { font-size: 17px; margin: -24px -24px 18px -24px; padding: 16px 24px; }
  .modal-field label { font-size: 11px; }
  .modal-field input, .modal-field select { padding: 10px 12px; font-size: 13px; }
  .modal-actions { margin-top: 20px; padding-top: 16px; gap: 8px; }

  .snackbar { font-size: 13px; padding: 12px 20px; left: 12px; right: 12px; transform: none; text-align: center; white-space: normal; }

  .btn-edit, .btn-delete { padding: 6px 10px; font-size: 11px; }

  .mobile-card { padding: 12px; margin-bottom: 10px; }
  .mobile-card-header .name { font-size: 14px; }
  .mobile-card-row { font-size: 12px; }
  .mobile-card-label { font-size: 10px; }
  .mobile-card-actions .btn-edit,
  .mobile-card-actions .btn-delete { padding: 8px 10px; font-size: 12px; }

  .pagination-controls { flex-wrap: wrap; justify-content: center; }
  .pagination-btn { width: 32px; height: 32px; font-size: 12px; }

  .card-header.super-admin-gradient { margin: -12px -12px 14px -12px; padding: 12px 14px; }

  .board-check-item { padding: 6px 14px; font-size: 12px; }

  .sidebar { width: 260px; }
  .sidebar-user-top { padding: 14px 16px; gap: 10px; }
  .sidebar-user-top .user-avatar { width: 40px; height: 40px; font-size: 15px; }
  .sidebar-user-top .user-name { font-size: 13px; }
  .nav-item { padding: 10px 14px; font-size: 13px; }
  .nav-item .material-icons-round { font-size: 20px; }

  .user-dropdown { min-width: 170px; right: -8px; }
  .dropdown-item { padding: 10px 14px; font-size: 13px; }
}

/* ══════════════════════════════════════
   RESPONSIVE — VERY SMALL MOBILE (360px)
   ══════════════════════════════════════ */
@media (max-width: 360px) {
  .page-content { padding: 8px; }
  .card { padding: 10px; }
  .card-header h3 { font-size: 13px; }
  .topbar-left h2 { font-size: 14px; }
  .topbar { height: 52px; padding: 0 8px; }

  .stats-card { padding: 12px; gap: 10px; }
  .stats-value { font-size: 18px; }
  .stats-icon { width: 38px; height: 38px; }
  .stats-icon .material-icons-round { font-size: 20px; }

  .board-grid { grid-template-columns: 1fr; }

  .login-card { padding: 24px 16px; }
  .login-card h1 { font-size: 20px; }

  .modal-content { padding: 14px; }
  .modal-content h3 { font-size: 16px; margin: -18px -18px 14px -18px; padding: 14px 18px; }

  .mobile-card-row { flex-direction: column; align-items: flex-start; gap: 2px; }
  .mobile-card-value { text-align: left; }

  .sv-top { flex-direction: column; text-align: center; padding: 20px 16px; }
  .sv-photo { width: 70px; height: 70px; font-size: 28px; }
  .sv-name-block h2 { font-size: 18px; }
  .sv-tags { justify-content: center; }
  .sv-body { padding: 16px; gap: 16px; }
  .sv-footer { padding: 12px 16px; }

  .sidebar { width: 240px; }
}

/* ══════════════════════════════════════
   RESPONSIVE — LARGE DESKTOP (1400px+)
   ══════════════════════════════════════ */
@media (min-width: 1400px) {
  .page-content { padding: 32px 40px; }
  .stats-grid { gap: 24px; }
  .dashboard-grid { gap: 24px; }
}

/* ══════════════════════════════════════
   TABLE SEARCH BAR
   ══════════════════════════════════════ */
.table-search-bar {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  gap: 10px;
  transition: var(--transition);
  flex: 1;
  max-width: 400px;
}

.table-search-bar:focus-within {
  border-color: var(--secondary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(91,79,214,0.08);
}

.table-search-bar .material-icons-round {
  font-size: 20px;
  color: var(--text-light);
  flex-shrink: 0;
}

.table-search-bar input {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  width: 100%;
  color: var(--text-dark);
}

.table-search-bar input::placeholder { color: #A0AEC0; }

.table-search-clear {
  font-size: 18px !important;
  cursor: pointer;
  color: #A0AEC0 !important;
  transition: var(--transition);
  display: none;
}

.table-search-clear.visible { display: block; }
.table-search-clear:hover { color: var(--text-dark) !important; }

/* ══════════════════════════════════════
   PAGINATION
   ══════════════════════════════════════ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 16px 4px 0;
  gap: 16px;
  flex-wrap: wrap;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-medium);
  transition: var(--transition);
}

.pagination-btn:hover:not(:disabled) {
  border-color: var(--secondary);
  color: var(--secondary);
  background: rgba(91,79,214,0.04);
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(59,55,134,0.25);
}

.pagination-btn .material-icons-round { font-size: 18px; }

.pagination-size {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-light);
}

.pagination-info {
  font-size: 13px;
  color: var(--text-light);
  font-weight: 500;
  white-space: nowrap;
}

.pagination-size select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  background: #fff;
  color: var(--text-dark);
  cursor: pointer;
}

.no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
  font-size: 14px;
}

.no-results .material-icons-round {
  font-size: 48px;
  color: #E2E8F0;
  display: block;
  margin-bottom: 12px;
}

/* Pagination and card-header responsive already handled in main media queries above */

/* Chapter Filter Dropdown */
.chapter-filter-dropdown {
  position: relative;
}
.chapter-filter-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  transition: var(--transition);
  white-space: nowrap;
}
.chapter-filter-btn:hover {
  border-color: var(--primary);
  background: #F7F7FE;
}
.chapter-filter-btn .material-icons-round {
  font-size: 18px;
  color: var(--primary);
}
.chapter-filter-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 280px;
  max-height: 340px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.chapter-filter-list.hidden {
  display: none;
}
.chapter-filter-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.chapter-filter-search .material-icons-round {
  font-size: 20px;
  color: var(--text-light);
}
.chapter-filter-search input {
  border: none;
  outline: none;
  font-size: 13px;
  flex: 1;
  background: transparent;
}
.chapter-filter-items {
  overflow-y: auto;
  max-height: 270px;
  padding: 6px 0;
}
.chapter-filter-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: background 0.15s;
}
.chapter-filter-item:hover {
  background: #F7F7FE;
}
.chapter-filter-item input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.chapter-filter-item.checked {
  background: rgba(59,55,134,0.06);
  font-weight: 600;
}

.chapter-filter-done {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.chapter-filter-done .btn-primary {
  padding: 8px 24px;
  font-size: 13px;
}

.chapter-filter-btn.disabled {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

.chapter-modal-dropdown {
  width: 100%;
}
.chapter-modal-dropdown .chapter-filter-btn {
  width: 100%;
  justify-content: space-between;
}
.chapter-modal-dropdown .chapter-filter-list {
  left: 0;
  right: 0;
  min-width: auto;
}

/* Profile Modal */
.profile-modal { max-width: 420px; padding: 0 !important; overflow: hidden; display: flex; flex-direction: column; }
.profile-header {
  text-align: center;
  padding: 28px 24px 20px;
  background: linear-gradient(135deg, #3B3786 0%, #4A42B0 50%, #5B4FD6 100%);
  color: #fff;
  margin-bottom: 0;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

/* Profile Header Bubbles */
.profile-bubbles {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.profile-bubble {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  animation: svBubbleFloat 16s ease-in-out infinite;
}
.profile-bubble-1 { width: 130px; height: 130px; top: -45px; right: -35px; animation-duration: 14s; }
.profile-bubble-2 { width: 90px; height: 90px; bottom: -25px; left: -20px; background: rgba(255,255,255,0.05); animation-delay: -3s; animation-duration: 18s; }
.profile-bubble-3 { width: 60px; height: 60px; top: 10px; left: 35%; background: rgba(255,255,255,0.06); animation-delay: -6s; animation-duration: 15s; }
.profile-bubble-4 { width: 100px; height: 100px; bottom: -35px; right: 15%; background: rgba(255,255,255,0.04); animation-delay: -9s; animation-duration: 20s; }
.profile-bubble-5 { width: 70px; height: 70px; top: -15px; left: 10%; background: rgba(255,255,255,0.05); animation-delay: -4s; animation-duration: 17s; }

/* Profile Header Tags (School & Mobile) */
.profile-header-tags {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  position: relative;
  z-index: 1;
  flex-wrap: wrap;
}
.profile-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.9);
}
.profile-tag .material-icons-round {
  font-size: 14px;
  color: rgba(255,255,255,0.7);
}
.profile-header > *:not(.profile-bubbles) {
  position: relative;
  z-index: 1;
}
.profile-modal .modal-actions {
  padding: 12px 24px 20px;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
}
.profile-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: 3px solid rgba(255,255,255,0.4);
  color: #fff;
  font-size: 28px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
  overflow: hidden;
  cursor: pointer;
}
.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.profile-header h3 {
  display: block;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  margin: 0;
}
/* Full image overlay */
.profile-img-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  cursor: pointer;
}
.profile-img-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 12px;
  object-fit: contain;
}
.profile-role {
  color: rgba(255,255,255,0.75);
  font-size: 14px;
  margin-top: 4px;
}
.profile-details { display: flex; flex-direction: column; gap: 16px; padding: 20px 24px; overflow-y: auto; flex: 1; }
.profile-row {
  display: flex; align-items: flex-start; gap: 12px;
}
.profile-row .material-icons-round {
  color: var(--primary);
  font-size: 22px;
  margin-top: 2px;
}
.profile-row label {
  font-size: 12px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.profile-row p {
  font-size: 15px;
  color: var(--text);
  font-weight: 500;
  margin-top: 2px;
}

/* Student View */
.sv-modal { max-width: 600px !important; padding: 0 !important; overflow: hidden; border-radius: 16px !important; }
.sv-modal.sv-modal-wf { max-width: 700px !important; }
.sv-close {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  background: rgba(255,255,255,0.9); border: none; border-radius: 50%;
  width: 36px; height: 36px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.sv-close .material-icons-round { font-size: 20px; color: var(--text-dark); }
.sv-top {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  padding: 28px 24px 20px;
  display: flex; align-items: center; gap: 28px;
  position: relative;
  overflow: hidden;
}

/* Student View Header Bubbles */
.sv-bubbles {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.sv-bubble {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  animation: svBubbleFloat 16s ease-in-out infinite;
}

.sv-bubble-1 { width: 150px; height: 150px; top: -50px; right: -40px; animation-duration: 14s; }
.sv-bubble-2 { width: 100px; height: 100px; bottom: -30px; left: -25px; background: rgba(255,255,255,0.05); animation-delay: -3s; animation-duration: 18s; }
.sv-bubble-3 { width: 70px; height: 70px; top: 10px; left: 40%; background: rgba(255,255,255,0.06); animation-delay: -6s; animation-duration: 15s; }
.sv-bubble-4 { width: 110px; height: 110px; bottom: -40px; right: 20%; background: rgba(255,255,255,0.04); animation-delay: -9s; animation-duration: 20s; }
.sv-bubble-5 { width: 80px; height: 80px; top: -20px; left: 15%; background: rgba(255,255,255,0.05); animation-delay: -4s; animation-duration: 17s; }

@keyframes svBubbleFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(8px, -10px) scale(1.06); }
  50% { transform: translate(-6px, 8px) scale(0.94); }
  75% { transform: translate(10px, 5px) scale(1.04); }
}

.sv-photo {
  width: 90px; height: 90px; border-radius: 50%;
  background: rgba(255,255,255,0.2); color: #fff;
  font-size: 36px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
  border: 3px solid rgba(255,255,255,0.4);
  position: relative; z-index: 1;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.sv-photo:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}
.sv-photo img { width: 100%; height: 100%; object-fit: cover; }

.sv-name-block { position: relative; z-index: 1; min-width: 0; flex: 1; }

/* Photo Viewer Modal */
.photo-viewer-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 90vw;
  max-height: 90vh;
}

.photo-viewer-content img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  object-fit: contain;
  background: #fff;
}

.photo-viewer-close {
  position: absolute;
  top: -16px;
  right: -16px;
  z-index: 2;
  background: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
  transition: var(--transition);
}

.photo-viewer-close:hover {
  background: #f0f0f0;
  transform: scale(1.1);
}

.photo-viewer-close .material-icons-round {
  font-size: 22px;
  color: var(--text-dark);
}
.sv-name-block h2 { color: #fff; font-size: 24px; font-weight: 700; margin: 0; letter-spacing: -0.3px; word-break: break-word; overflow-wrap: break-word; }
.sv-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.sv-tags .sv-tag {
  background: rgba(255,255,255,0.2); color: #fff;
  padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 500;
}
.sv-body {
  padding: 24px 28px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
  max-height: 50vh; overflow-y: auto;
  overflow-x: hidden; word-break: break-word; overflow-wrap: break-word;
}
.sv-section h4 {
  font-size: 13px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--text-dark); margin: 0 0 12px; font-weight: 800;
}
.sv-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid #f0f0f0;
}
.sv-row:last-child { border-bottom: none; }
.sv-label { font-size: 13px; color: var(--text-light); }
.sv-value { font-size: 14px; color: var(--text-dark); font-weight: 600; text-align: right; word-break: break-all; overflow-wrap: break-word; }
#paymentDetailSection > div { overflow-wrap: break-word; word-break: break-word; }
.sv-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: #FAFBFC;
}
.sv-status { display: flex; align-items: center; gap: 6px; }
.sv-btns { display: flex; gap: 8px; }
.sv-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 8px 16px; border-radius: 8px; border: none;
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.sv-btn .material-icons-round { font-size: 16px; }
.sv-btn-edit { background: var(--primary); color: #fff; }
.sv-btn-edit:hover { background: var(--primary-light); }
.sv-btn-delete { background: #fff; color: var(--error); border: 1px solid var(--error); }
.sv-btn-delete:hover { background: #fef2f2; }
@media (max-width: 600px) {
  .sv-modal { max-width: 100vw !important; border-radius: 12px !important; }
  .sv-body { grid-template-columns: 1fr; padding: 20px; }
  .sv-top { padding: 24px 20px 20px; }
  .sv-photo { width: 72px; height: 72px; font-size: 30px; }
  .sv-name-block h2 { font-size: 19px; }
  .sv-footer { padding: 14px 20px; flex-direction: column; gap: 12px; }
  .sv-btns { width: 100%; }
  .sv-btn { flex: 1; justify-content: center; }
  .sv-row { flex-direction: column; align-items: flex-start; gap: 2px; }
  .sv-value { text-align: left; }
  #paymentDetailSection > div { padding: 16px !important; }
}
@media (max-width: 360px) {
  .sv-modal { margin: 4px !important; }
  .sv-top { padding: 18px 14px 16px; gap: 12px; }
  .sv-photo { width: 56px; height: 56px; font-size: 22px; }
  .sv-name-block h2 { font-size: 16px; }
  .sv-tags .sv-tag { font-size: 10px; padding: 2px 8px; }
  .sv-footer { padding: 10px 14px; }
  .sv-btn { padding: 6px 12px; font-size: 12px; }
  #paymentDetailSection > div { padding: 12px !important; }
}

/* ══════════════════════════════════════
   LOGOUT CONFIRMATION MODAL
   ══════════════════════════════════════ */
.logout-modal {
  max-width: 380px;
  text-align: center;
  background: linear-gradient(135deg, #3B3786 0%, #4A42B0 50%, #5B4FD6 100%);
  position: relative;
  overflow: hidden;
}
.logout-modal::before,
.logout-modal::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
}
.logout-modal::before {
  width: 120px;
  height: 120px;
  top: -30px;
  right: -20px;
}
.logout-modal::after {
  width: 80px;
  height: 80px;
  bottom: -20px;
  left: -15px;
}

.logout-modal h3 {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 8px 0;
  padding: 0;
  background: none;
  display: block;
  text-align: center;
  border-radius: 0;
  background: none;
  border-radius: 0;
  overflow: visible;
}
.logout-modal h3::before,
.logout-modal h3::after {
  display: none;
}

.logout-modal-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.logout-modal-icon .material-icons-round {
  font-size: 32px;
  color: #fff;
}

.logout-modal-text {
  font-size: 14px;
  color: rgba(255,255,255,0.85);
  margin-bottom: 24px;
}

.logout-modal .modal-actions {
  justify-content: center;
  gap: 12px;
}
.logout-modal .btn-secondary {
  color: #fff;
  border-color: rgba(255,255,255,0.4);
}
.logout-modal .btn-secondary:hover {
  background: rgba(255,255,255,0.15);
  border-color: #fff;
}

.btn-danger {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: 1.5px solid rgba(255,255,255,0.5);
  padding: 12px 28px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(225,112,85,0.3);
}

.btn-danger:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,0.35);
  border-color: #fff;
  box-shadow: 0 4px 16px rgba(255,255,255,0.15);
}

@media (max-width: 480px) {
  .logout-modal { max-width: 100%; }
  .logout-modal h3 { font-size: 18px; }
  .logout-modal-icon { width: 56px; height: 56px; }
  .logout-modal-icon .material-icons-round { font-size: 28px; }
  .logout-modal-text { font-size: 13px; }
  .btn-danger { padding: 10px 20px; font-size: 13px; }
  .btn-secondary { padding: 10px 20px; font-size: 13px; }

  .profile-modal { max-width: 100%; max-height: 90vh; }
  .profile-header { padding: 20px 16px 16px; }
  .profile-header h3 { font-size: 18px; }
  .profile-avatar { width: 60px; height: 60px; font-size: 24px; }
  .profile-details { padding: 16px; gap: 14px; }
  .profile-row .material-icons-round { font-size: 20px; }
  .profile-row p { font-size: 14px; }
  .profile-tag { font-size: 11px; padding: 3px 10px; }
  .profile-modal .modal-actions { padding: 10px 16px 16px; }
}

/* Searchable student dropdown */
.search-select-list > div:hover { background: #f5f3ff !important; }
.search-select-wrap input[type="text"] { width: 100%; padding: 10px 14px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; outline: none; }
.search-select-wrap input[type="text"]:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(59,55,134,0.1); }

/* Tables center align */
#plansubscriptionTable td { padding-top: 14px; padding-bottom: 14px; }
#plansubscriptionTable td, #plansubscriptionTable th,
#paymentreceiveTable td, #paymentreceiveTable th,
#paymentplanTable td, #paymentplanTable th,
#studentTable td, #studentTable th,
#subjectTable td, #subjectTable th,
#chapterTable td, #chapterTable th,
#topicTable td, #topicTable th { text-align: center; }

/* Search dropdown */
.search-dropdown { position: relative; }
.search-dropdown-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  background: #fff;
  transition: var(--transition);
  box-sizing: border-box;
}
.search-dropdown-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,55,134,0.1);
}
.search-dropdown-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: var(--shadow-md);
  margin-top: 4px;
}
.search-dropdown-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s;
}
.search-dropdown-item:hover {
  background: var(--primary);
  color: #fff;
}

/* Admin table wider */
#adminTable { min-width: 1100px; }
#screen-2 .table-wrapper { -webkit-overflow-scrolling: touch; }

/* Payment Receive & Plan Subscription responsive */
#screen-15 .table-wrapper,
#screen-14 .table-wrapper {
  -webkit-overflow-scrolling: touch;
}
#paymentreceiveTable, #plansubscriptionTable { min-width: 900px; }
@media (max-width: 1200px) {
  #paymentreceiveTable td, #paymentreceiveTable th,
  #plansubscriptionTable td, #plansubscriptionTable th { font-size: 13px; padding: 10px 8px; white-space: nowrap; }
}
@media (max-width: 768px) {
  #screen-15 .table-wrapper, #screen-14 .table-wrapper { display: none; }
  #screen-15 .mobile-cards, #screen-14 .mobile-cards { display: block; }
}

/* Full page layout for all list screens */
.screen.active:not(#screen-0) {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 136px);
  min-width: 0;
  max-width: 100%;
}
.screen:not(#screen-0) .card {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 0;
  min-width: 0;
}
.screen:not(#screen-0) .card-header {
  flex-shrink: 0;
}
.screen:not(#screen-0) .table-wrapper {
  flex: 1;
  max-height: none;
  overflow: auto;
}
.screen:not(#screen-0) .pagination {
  flex-shrink: 0;
}
#aiworkflowTable { min-width: 1100px; }

/* Line below header on student list */
#screen-3 .card-header {
  padding-bottom: 14px;
  margin-bottom: 0;
  border-bottom: 2px solid var(--border);
}
