/* ==========================================================================
   COSMO-EDU — 3D Kosmik va Shaffof (Glassmorphism) Dizayn Tizimi
   Ultra-Premium Frosted Glass, Cosmic Glows, 3D Perspective & Responsive UI
   ========================================================================== */

:root {
  --bg-space: #070913;
  --bg-deep: #0b0f19;
  --bg-nebula: #13112c;
  --glass-surface: rgba(15, 23, 42, 0.65);
  --glass-surface-hover: rgba(30, 27, 75, 0.55);
  --glass-border: rgba(139, 92, 246, 0.3);
  --glass-border-hover: rgba(168, 85, 247, 0.6);
  --glass-blur: blur(24px) saturate(190%);
  
  --primary-purple: #8b5cf6;
  --primary-indigo: #6366f1;
  --accent-cyan: #06b6d4;
  --accent-pink: #ec4899;
  --accent-emerald: #10b981;
  --accent-gold: #f59e0b;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --shadow-cosmic: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(139, 92, 246, 0.15);
  --shadow-neon: 0 0 25px rgba(99, 102, 241, 0.5);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;
  
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --transition-smooth: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-space);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.6;
}

/* Background 3D Canvas */
#cosmic-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

/* Glassmorphism Card Utility */
.glass-panel {
  background: var(--glass-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-cosmic);
  transition: var(--transition-smooth);
}

.glass-panel:hover {
  border-color: var(--glass-border-hover);
  background: var(--glass-surface-hover);
}

.glass-card-interactive {
  transform-style: preserve-3d;
  perspective: 1000px;
  transition: transform 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.glass-card-interactive:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 35px rgba(139, 92, 246, 0.3);
}

/* Header & Cosmic Nav */
.cosmic-header {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: min(1280px, calc(100% - 32px));
  height: 72px;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-radius: var(--radius-full);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #fff;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.5px;
}

.logo-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary-purple), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.6);
  font-size: 20px;
  overflow: hidden;
  flex-shrink: 0;
}

.logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}


.nav-menu {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: color 0.2s;
}

.nav-link:hover, .nav-link.active {
  color: #fff;
  text-shadow: 0 0 12px rgba(139, 92, 246, 0.8);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Buttons */
.btn-cosmic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-purple) 0%, var(--primary-indigo) 100%);
  color: #fff;
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 35px rgba(99, 102, 241, 0.6);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-cyan {
  background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
  color: #fff;
  box-shadow: 0 8px 25px rgba(6, 182, 212, 0.4);
}

.btn-emerald {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  color: #fff;
}

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

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

/* Main Content Container */
.main-wrapper {
  position: relative;
  z-index: 10;
  max-width: 1280px;
  margin: 0 auto;
  padding: 120px 24px 80px;
}

/* Hero Section */
.hero-section {
  text-align: center;
  padding: 60px 0 80px;
}

.cosmic-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  border-radius: var(--radius-full);
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.4);
  font-size: 13px;
  font-weight: 700;
  color: #c084fc;
  margin-bottom: 24px;
  animation: pulseBadge 3s infinite;
}

@keyframes pulseBadge {
  0%, 100% { box-shadow: 0 0 15px rgba(139, 92, 246, 0.2); }
  50% { box-shadow: 0 0 30px rgba(139, 92, 246, 0.6); }
}

.hero-title {
  font-size: clamp(38px, 6vw, 68px);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 24px;
  background: linear-gradient(135deg, #ffffff 30%, #c084fc 70%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: clamp(16px, 2vw, 20px);
  color: var(--text-muted);
  max-width: 820px;
  margin: 0 auto 36px;
}

.hero-ctas {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 60px;
}

/* Live Stats Ribbon */
.stats-ribbon {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 90px;
}

.stat-item {
  padding: 24px;
  text-align: center;
}

.stat-number {
  font-size: 38px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #fff, var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Section Header */
.section-header {
  text-align: center;
  margin-bottom: 50px;
}

.section-tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-purple);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 8px;
  display: block;
}

.section-title {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 800;
  color: #fff;
  margin-bottom: 12px;
}

.section-desc {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 650px;
  margin: 0 auto;
}

/* Subjects 3D Grid */
.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 100px;
}

.subject-card {
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.subject-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--subject-theme, var(--primary-purple));
  box-shadow: 0 0 20px var(--subject-theme, var(--primary-purple));
}

.subject-icon-box {
  width: 58px;
  height: 58px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 20px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.subject-name {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
}

.subject-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
  flex-grow: 1;
}

.subject-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 20px;
}

.subject-price {
  font-size: 18px;
  font-weight: 800;
  color: #38bdf8;
}

.subject-duration {
  font-size: 13px;
  color: var(--text-dim);
}

/* Teachers Grid */
.teachers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 28px;
  margin-bottom: 100px;
}

.teacher-card {
  padding: 32px 24px;
  text-align: center;
}

.teacher-avatar-wrapper {
  position: relative;
  width: 110px;
  height: 110px;
  margin: 0 auto 20px;
}

.teacher-avatar {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 3px solid var(--primary-purple);
  box-shadow: 0 0 25px rgba(139, 92, 246, 0.5);
}

.teacher-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  background: #10b981;
  color: #fff;
  border-radius: var(--radius-full);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.teacher-name {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.teacher-title {
  font-size: 13px;
  color: #c084fc;
  font-weight: 600;
  margin-bottom: 14px;
}

.teacher-certs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
}

.cert-pill {
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.3);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  color: #e2e8f0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s;
}

.cert-pill:hover {
  background: rgba(139, 92, 246, 0.25);
  border-color: rgba(139, 92, 246, 0.6);
  transform: scale(1.02);
}

/* Center Certificates & Showcase */
.showcase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  margin-bottom: 100px;
}

.cert-card {
  padding: 24px;
  display: flex;
  gap: 18px;
  align-items: center;
}

.cert-thumb {
  width: 90px;
  height: 90px;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
}

.cert-info h4 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.cert-info p {
  font-size: 13px;
  color: var(--text-muted);
}

/* Leaderboard */
.leaderboard-panel {
  padding: 36px;
  margin-bottom: 100px;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table th {
  text-align: left;
  padding: 14px 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard-table td {
  padding: 16px;
  font-size: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

.leaderboard-table tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.rank-badge {
  font-weight: 800;
  font-size: 16px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.rank-1 { background: rgba(245, 158, 11, 0.2); color: #f59e0b; border: 1px solid #f59e0b; }
.rank-2 { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; border: 1px solid #cbd5e1; }
.rank-3 { background: rgba(180, 83, 9, 0.2); color: #d97706; border: 1px solid #d97706; }

.student-col {
  display: flex;
  align-items: center;
  gap: 12px;
}

.student-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  object-fit: cover;
}

.subject-badge {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #c084fc;
}

.coin-amount {
  font-weight: 800;
  color: #fbbf24;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 7, 15, 0.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 2000;
  display: none !important;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

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

.modal-card {
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 36px;
  position: relative;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(139, 92, 246, 0.4);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(139, 92, 246, 0.25);
  border-radius: var(--radius-xl);
}

.modal-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  color: #94a3b8;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 10;
}

.modal-close-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
  color: #ef4444;
  transform: rotate(90deg);
}

.modal-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
  background: rgba(0, 0, 0, 0.3);
  padding: 6px;
  border-radius: var(--radius-md);
}

.modal-tab-btn {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-tab-btn.active {
  background: var(--primary-purple);
  color: #fff;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

/* Form Controls */
.form-group {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 12px;
  font-weight: 700;
  color: #cbd5e1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.7);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary-purple);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

.form-input[readonly], .form-input:disabled {
  background: rgba(30, 41, 59, 0.6) !important;
  color: #cbd5e1 !important;
  cursor: not-allowed;
  border-color: rgba(148, 163, 184, 0.2) !important;
  opacity: 0.85;
}

/* Dashboards (Student, Teacher, Admin) */
.dashboard-view {
  display: none;
  padding-top: 100px;
}

.dashboard-view.active {
  display: block;
}

.dash-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  padding: 20px 28px;
}

.dash-title h2 { font-size: 24px; font-weight: 800; color: #fff; }
.dash-title p { font-size: 14px; color: var(--text-muted); }

/* Chat Floating Trigger & Window (Disabled/Hidden per User Request) */
.chat-widget-fab,
.chat-floating-window {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.chat-header {
  padding: 16px 20px;
  background: rgba(30, 27, 75, 0.8);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-messages-body {
  flex-grow: 1;
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-bubble {
  max-width: 80%;
  padding: 10px 16px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.5;
}

.chat-bubble.mine {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--primary-purple), var(--primary-indigo));
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-bubble.other {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
  border-bottom-left-radius: 4px;
}

.chat-input-bar {
  padding: 14px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  gap: 8px;
  background: rgba(15, 23, 42, 0.9);
}

/* Lightbox Modal */
.lightbox-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.92);
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lightbox-modal.active {
  display: flex;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: var(--radius-md);
  box-shadow: 0 0 50px rgba(139, 92, 246, 0.4);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 4000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(139, 92, 246, 0.5);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ==========================================================================
   COMPREHENSIVE RESPONSIVE DESIGN FOR ALL SCREEN SIZES
   ========================================================================== */

/* Lightbox preview styling */
.cert-thumb-preview {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  cursor: pointer;
}

.cert-thumb-preview img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  transition: transform 0.4s ease;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
}

.cert-thumb-preview:hover img {
  transform: scale(1.04);
}

.cert-zoom-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  gap: 6px;
}

.cert-thumb-preview:hover .cert-zoom-overlay {
  opacity: 1;
}

.teacher-qualification-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(139, 92, 246, 0.18);
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: 8px;
  font-size: 12px;
  color: #c084fc;
  margin-bottom: 12px;
}

/* Tablet & Smaller Desktops (max-width: 992px) */
@media (max-width: 992px) {
  .cosmic-header {
    height: 64px;
    padding: 0 16px;
    width: calc(100% - 24px);
    top: 10px;
  }
  .nav-menu { display: none; }
  .stats-ribbon { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .main-wrapper { padding: 100px 16px 60px; }
  .hero-title { font-size: clamp(30px, 6vw, 50px); }
  .modal-card { max-height: 90vh; }
}

/* Mobile Screens (max-width: 768px) */
@media (max-width: 768px) {
  .cosmic-header {
    height: auto;
    min-height: 56px;
    padding: 8px 12px;
    top: 6px;
    width: calc(100% - 12px);
    border-radius: 14px;
  }
  
  .brand-logo {
    font-size: 16px;
    gap: 8px;
  }
  
  .logo-icon {
    width: 32px;
    height: 32px;
    font-size: 16px;
    border-radius: 8px;
  }
  
  .header-actions {
    gap: 6px;
  }

  .header-actions .btn-cosmic {
    padding: 6px 10px;
    font-size: 11px;
    border-radius: 8px;
  }

  .main-wrapper {
    padding: 78px 12px 50px;
  }

  .hero-section {
    padding: 20px 0 35px;
  }

  .cosmic-badge {
    font-size: 11px;
    padding: 6px 14px;
    margin-bottom: 16px;
  }

  .hero-title {
    font-size: clamp(24px, 7vw, 36px);
    line-height: 1.2;
    margin-bottom: 14px;
  }

  .hero-subtitle {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 24px;
    padding: 0 6px;
  }

  .hero-ctas {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 10px;
    margin-bottom: 40px;
  }

  .hero-ctas .btn-cosmic {
    width: 100%;
    justify-content: center;
    padding: 12px 18px;
    font-size: 14px;
  }

  .stats-ribbon {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 60px;
  }

  .stat-item {
    padding: 14px 10px;
    border-radius: 12px;
  }

  .stat-number {
    font-size: clamp(20px, 6vw, 28px);
    font-weight: 800;
  }

  .stat-label {
    font-size: 11px;
  }

  .section-header {
    margin-bottom: 30px;
  }

  .section-title {
    font-size: clamp(22px, 5.5vw, 30px);
  }

  .section-desc {
    font-size: 13px;
  }

  .showcase-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 60px;
  }

  .cert-card {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
    gap: 14px;
  }

  .cert-thumb {
    width: 100%;
    height: 190px;
    max-height: 200px;
    border-radius: 10px;
  }

  .teacher-card {
    padding: 18px 14px;
  }

  .leaderboard-panel {
    padding: 14px;
  }

  /* Form & Modal Grids on Mobile */
  .modal-overlay {
    padding: 10px;
  }

  .modal-card {
    width: 100% !important;
    max-width: 100% !important;
    padding: 20px 14px !important;
    max-height: 92vh !important;
    border-radius: 16px !important;
    margin: auto;
  }

  .modal-close-btn {
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    font-size: 18px;
  }

  /* Force multi-column form layouts to single column on mobile */
  form div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .form-input, .form-select, textarea.form-input {
    font-size: 16px !important; /* Prevents auto-zoom on iOS */
    padding: 10px 12px !important;
  }

  /* Dashboard Nav & Tabs */
  .dash-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px !important;
  }

  .dash-title h2 {
    font-size: 18px;
  }

  .modal-tabs {
    display: flex;
    overflow-x: auto;
    flex-wrap: nowrap;
    gap: 6px;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  .modal-tab-btn {
    white-space: nowrap;
    padding: 8px 12px;
    font-size: 12px;
    flex-shrink: 0;
  }

  /* Tables horizontal scroll container */
  .table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: block;
    margin-bottom: 12px;
  }

  .leaderboard-table {
    min-width: 580px;
  }

  /* Toast notification on mobile */
  .toast-container {
    top: 66px;
    left: 10px;
    right: 10px;
    width: auto;
    max-width: 100%;
  }

  .toast {
    padding: 10px 14px;
    font-size: 13px;
    width: 100%;
    box-sizing: border-box;
  }
}

/* Extra Small Mobile (max-width: 380px) */
@media (max-width: 380px) {
  .cosmic-header {
    padding: 6px 8px;
  }
  .brand-logo {
    font-size: 14px;
  }
  .logo-icon {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }
  .header-actions .btn-cosmic {
    padding: 5px 8px;
    font-size: 10px;
  }
  .stats-ribbon {
    grid-template-columns: 1fr;
  }
}
