/* ============================================================
   KIDLIN School of AI - Member Portal Styles
   Professional school design language consistent with main site.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Source+Serif+4:opsz,wght@8..60,400;8..60,500;8..60,600;8..60,700&display=swap');

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

:root {
  --navy: #1b2433;
  --navy-light: #2a3548;
  --blue: #246dad;
  --blue-light: #174f82;
  --blue-pale: rgba(36, 109, 173, 0.08);
  --amber: #e89a22;
  --amber-dark: #c97d13;
  --cream: #f8f6f0;
  --cream-dark: #eef1f4;
  --white: #ffffff;
  --text-primary: #202737;
  --text-secondary: #667085;
  --text-muted: #9ca3af;
  --border: #dfe4ea;
  --border-light: #edf0f3;
  --success: #15803d;
  --success-bg: #dcfce7;
  --error: #b91c1c;
  --error-bg: #fee2e2;
  --warning: #a16207;
  --warning-bg: #fef9c3;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow: 0 1px 3px rgba(27,36,51,0.08);
  --shadow-lg: 0 6px 18px rgba(27,36,51,0.10);
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 8px;
  --transition: 0.22s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  color: var(--text-primary);
  background-color: var(--cream);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, .auth-title, .page-title, .course-card-title {
  font-family: 'Source Serif 4', Georgia, serif;
  letter-spacing: 0;
  font-weight: 600;
}

h3, h4, h5, h6, .modal-header-title, .user-name {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 700;
}

/* ---- Layout ---- */
.portal-layout {
  display: flex;
  min-height: 100vh;
  --sidebar-collapsed: 72px;
  --sidebar-expanded: 260px;
  --sidebar-gap: 12px;
  --sidebar-easing: cubic-bezier(0.22, 1, 0.36, 1);
  --sidebar-duration: 280ms;
}

/* ---- Sidebar (Floating Navigation Rail) ---- */
.sidebar {
  width: var(--sidebar-collapsed);
  background: rgba(8, 20, 43, 0.95);
  color: rgba(255,255,255,0.85);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: var(--sidebar-gap);
  left: var(--sidebar-gap);
  height: calc(100vh - var(--sidebar-gap) * 2);
  overflow: hidden;
  z-index: 200;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25), 0 0 0 1px rgba(255,255,255,0.06);
  transition:
    width var(--sidebar-duration) var(--sidebar-easing),
    background var(--sidebar-duration) var(--sidebar-easing),
    backdrop-filter var(--sidebar-duration) var(--sidebar-easing),
    -webkit-backdrop-filter var(--sidebar-duration) var(--sidebar-easing),
    box-shadow var(--sidebar-duration) ease;
}

/* ---- Sidebar Expanded State ---- */
.sidebar.expanded {
  width: var(--sidebar-expanded);
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 12px 48px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.1);
}

/* ---- Logo ---- */
.sidebar-logo {
  padding: 20px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 0;
  min-height: 72px;
  justify-content: center;
  overflow: hidden;
  transition:
    padding var(--sidebar-duration) var(--sidebar-easing),
    gap var(--sidebar-duration) var(--sidebar-easing);
}

.sidebar.expanded .sidebar-logo {
  padding: 20px 20px;
  justify-content: flex-start;
  gap: 10px;
}

.logo-k-mark {
  content: url('/assets/images/brand/logo_k_white.png');
  width: 32px;
  height: auto;
  display: block;
  opacity: 1;
  flex-shrink: 0;
  transition:
    opacity var(--sidebar-duration) var(--sidebar-easing),
    width var(--sidebar-duration) var(--sidebar-easing);
}

.sidebar.expanded .logo-k-mark {
  opacity: 0;
  width: 0;
  height: 0;
  overflow: hidden;
}

.logo-text-group {
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition:
    opacity calc(var(--sidebar-duration) * 0.6) ease 60ms,
    max-width var(--sidebar-duration) var(--sidebar-easing);
}

.sidebar.expanded .logo-text-group {
  opacity: 1;
  max-width: 180px;
}

.logo-text-group img {
  content: url('/assets/images/brand/logo_full_white.png');
  height: 36px;
  width: auto;
  display: block;
}

/* Legacy .logo-mark (unused, kept for backwards compat) */
.logo-mark {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #4f93f5, #1d4ed8);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.logo-text strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.3px;
}

.logo-text small {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
}

/* ---- User Card ---- */
.sidebar-user {
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 0;
  justify-content: center;
  overflow: hidden;
  transition:
    padding var(--sidebar-duration) var(--sidebar-easing),
    gap var(--sidebar-duration) var(--sidebar-easing);
}

.sidebar.expanded .sidebar-user {
  padding: 14px 20px;
  justify-content: flex-start;
  gap: 12px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f93f5, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-info {
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition:
    opacity calc(var(--sidebar-duration) * 0.6) ease 60ms,
    max-width var(--sidebar-duration) var(--sidebar-easing);
}

.sidebar.expanded .user-info {
  opacity: 1;
  max-width: 180px;
}

.user-info .user-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.user-info .user-email {
  font-size: 11px;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

/* ---- Navigation ---- */
.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-section-label {
  padding: 4px 12px 8px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.3);
  font-weight: 600;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition:
    opacity calc(var(--sidebar-duration) * 0.6) ease 60ms,
    max-height var(--sidebar-duration) var(--sidebar-easing);
}

.sidebar.expanded .nav-section-label {
  opacity: 1;
  max-height: 32px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 10px 0;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition:
    background var(--transition),
    color var(--transition),
    padding var(--sidebar-duration) var(--sidebar-easing),
    gap var(--sidebar-duration) var(--sidebar-easing);
  margin-bottom: 2px;
  justify-content: center;
  overflow: hidden;
}

.sidebar.expanded .sidebar-nav a {
  padding: 10px 12px;
  justify-content: flex-start;
  gap: 10px;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,0.07);
  color: #fff;
}

.sidebar-nav a.active {
  background: rgba(79,147,245,0.2);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 12px rgba(79,147,245,0.12);
}

.sidebar-nav a .nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-nav a.active .nav-icon { opacity: 1; }

/* Nav label text — hidden when collapsed */
.nav-label {
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition:
    opacity calc(var(--sidebar-duration) * 0.6) ease 60ms,
    max-width var(--sidebar-duration) var(--sidebar-easing);
}

.sidebar.expanded .nav-label {
  opacity: 1;
  max-width: 180px;
}

/* ---- Sidebar Footer ---- */
.sidebar-footer {
  padding: 12px 10px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 10px 0;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.5);
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  justify-content: center;
  overflow: hidden;
  transition:
    background var(--transition),
    color var(--transition),
    padding var(--sidebar-duration) var(--sidebar-easing),
    gap var(--sidebar-duration) var(--sidebar-easing);
}

.sidebar.expanded .btn-logout {
  padding: 10px 12px;
  justify-content: flex-start;
  gap: 10px;
}

.btn-logout:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.85);
}

.btn-logout svg {
  flex-shrink: 0;
}

/* ---- Main content ---- */
.main-content {
  flex: 1;
  margin-left: calc(var(--sidebar-collapsed, 72px) + var(--sidebar-gap, 12px) * 2);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: none; /* Content never moves */
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-content {
  flex: 1;
  padding: 32px;
  max-width: 100%;
  width: 100%;
}

/* ---- Cards ---- */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ---- Course cards ---- */
.course-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
  cursor: pointer;
  text-decoration: none;
  display: block;
}

.course-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.course-card-header {
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  padding: 24px 24px 20px;
  position: relative;
  overflow: hidden;
}

.course-card-header::before {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
}

.course-card-header::after {
  content: '';
  position: absolute;
  bottom: -20px;
  left: -20px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(79,147,245,0.12);
}

.course-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(79,147,245,0.2);
  border: 1px solid rgba(79,147,245,0.3);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  color: #93c5fd;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.course-name {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
  position: relative;
  z-index: 1;
}

.course-dates {
  font-size: 12.5px;
  color: rgba(255,255,255,0.6);
  position: relative;
  z-index: 1;
}

.course-card-body {
  padding: 20px 24px 24px;
}

.course-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.course-meta-row svg { flex-shrink: 0; }

.course-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.status-active { background: var(--success-bg); color: var(--success); }
.status-upcoming { background: var(--warning-bg); color: var(--warning); }
.status-completed { background: var(--border-light); color: var(--text-muted); }

.course-cta {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--navy);
  color: #fff;
}
.btn-primary:hover { background: var(--navy-light); }

.btn-secondary {
  background: var(--white);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--cream); }

.btn-blue {
  background: var(--blue);
  color: #fff;
}
.btn-blue:hover { background: #1e40af; }

.btn-sm {
  padding: 7px 14px;
  font-size: 13px;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
}

/* ---- Forms ---- */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-label .required { color: var(--error); margin-left: 2px; }
.form-label .readonly-tag {
  font-size: 10px;
  font-weight: 500;
  background: var(--border-light);
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

.form-input {
  display: block;
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--white);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
}

.form-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29,78,216,0.08);
}

.form-input:disabled,
.form-input[readonly] {
  background: var(--cream);
  color: var(--text-muted);
  cursor: not-allowed;
}

.form-hint {
  margin-top: 5px;
  font-size: 12px;
  color: var(--text-muted);
}

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

/* ---- Alerts ---- */
.alert {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-error { background: var(--error-bg); color: var(--error); border: 1px solid #fecaca; }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #bbf7d0; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid #fde68a; }
.alert-info { background: var(--blue-pale); color: var(--blue); border: 1px solid #bfdbfe; }

/* ---- Tables ---- */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  background: var(--cream);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  font-weight: 600;
  padding: 11px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 13px 16px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--cream); }

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-neutral { background: var(--border-light); color: var(--text-muted); }
.badge-blue { background: var(--blue-pale); color: var(--blue); }

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 13.5px;
  line-height: 1.6;
  max-width: 360px;
  margin: 0 auto;
}

/* ---- Stats row ---- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

/* ---- Profile image ---- */
.profile-image-container {
  position: relative;
  width: 96px;
  height: 96px;
}

.profile-image {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
  background: linear-gradient(135deg, #4f93f5, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
}

.profile-image-upload-btn {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 28px;
  height: 28px;
  background: var(--navy);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid var(--white);
  transition: background var(--transition);
}

.profile-image-upload-btn:hover { background: var(--navy-light); }

/* ---- OTP inputs ---- */
.otp-container {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 28px 0;
}

.otp-input {
  width: 52px;
  height: 60px;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--white);
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
  caret-color: var(--blue);
  font-family: 'Courier New', monospace;
}

.otp-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29,78,216,0.1);
}

.otp-input.filled {
  border-color: var(--blue);
  background: #f0f4ff;
}

.otp-input.error {
  border-color: var(--error);
  background: var(--error-bg);
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ---- Login page ---- */
.auth-page {
  min-height: 100vh;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 40px 36px;
  width: 100%;
  max-width: 440px;
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
}

.auth-logo-img {
  content: url('/assets/images/brand/kidlin_new.png');
  display: block;
  height: 54px;
  width: auto;
  margin: 0 auto;
}

html.dark-mode .auth-logo-img {
  content: url('/assets/images/brand/kidlin_new1.png');
}

.auth-logo .logo-mark {
  width: 40px;
  height: 40px;
  font-size: 16px;
}

.auth-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 28px;
}

.terms-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
}

.terms-row input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
  cursor: pointer;
}

.terms-row label {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  cursor: pointer;
}

.terms-row label a {
  color: var(--blue);
  text-decoration: none;
}

.terms-row label a:hover { text-decoration: underline; }

.auth-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* ---- Spinner ---- */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Divider ---- */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* ---- Page header ---- */
.page-header {
  margin-bottom: 28px;
}

.page-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.page-desc {
  font-size: 14px;
  color: var(--text-muted);
}

/* ---- Grid layouts ---- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr));
  gap: 20px;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .sidebar {
    width: var(--sidebar-expanded);
    top: 0;
    left: 0;
    height: 100vh;
    border-radius: 0;
    transform: translateX(-100%);
    transition: transform 0.3s var(--sidebar-easing);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  /* On mobile, always show labels (drawer is always "expanded" width) */
  .sidebar .nav-label,
  .sidebar .logo-text-group,
  .sidebar .user-info,
  .sidebar .nav-section-label {
    opacity: 1;
    max-width: 180px;
    max-height: 32px;
  }
  .sidebar .sidebar-logo {
    padding: 20px 20px;
    justify-content: flex-start;
  }
  .sidebar .sidebar-user {
    padding: 14px 20px;
    justify-content: flex-start;
  }
  .sidebar .sidebar-nav a,
  .sidebar .btn-logout {
    padding: 10px 12px;
    justify-content: flex-start;
  }
  .main-content {
    margin-left: 0;
  }
  .form-row { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .page-content { padding: 20px; }
  .auth-card { padding: 28px 24px; }
  .otp-container { gap: 8px; }
  .otp-input { width: 44px; height: 52px; font-size: 20px; }
  .mobile-menu-btn {
    display: flex;
  }
}

/* ---- Mobile menu button ---- */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: none;
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text-secondary);
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: flex;
  }
}

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

.sidebar-overlay.active { display: block; }

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

.toast {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: var(--shadow);
  font-size: 13.5px;
  font-weight: 500;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.2s ease;
}

.toast-success { border-left: 4px solid var(--success); color: var(--success); }
.toast-error { border-left: 4px solid var(--error); color: var(--error); }
.toast-info { border-left: 4px solid var(--blue); color: var(--blue); }

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

/* ============================================================
   DARK MODE STYLING & VARIABLE OVERRIDES
   ============================================================ */
html.dark-mode {
  --cream: #090e1a;
  --cream-dark: #121926;
  --white: #111b33;
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --border: #1e293b;
  --border-light: #1e293b;
  --navy: #050914; /* Darker sidebar background */
}

html.dark-mode .sidebar {
  background: rgba(5, 9, 20, 0.95);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04);
}

html.dark-mode .sidebar.expanded {
  background: rgba(15, 20, 35, 0.85);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border-color: rgba(255,255,255,0.08);
  box-shadow: 0 12px 48px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.06);
}

html.dark-mode .topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

html.dark-mode .card,
html.dark-mode .course-card {
  background: var(--white);
  border-color: var(--border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

html.dark-mode .course-card-header {
  border-bottom: 1px solid var(--border-light);
}

html.dark-mode .course-meta-row {
  color: var(--text-secondary);
}

html.dark-mode input,
html.dark-mode select,
html.dark-mode textarea {
  background-color: var(--cream-dark);
  color: var(--text-primary);
  border-color: var(--border);
}

html.dark-mode input:focus,
html.dark-mode select:focus,
html.dark-mode textarea:focus {
  border-color: var(--blue);
  background-color: var(--white);
}

html.dark-mode input:disabled,
html.dark-mode select:disabled,
html.dark-mode textarea:disabled {
  background-color: var(--cream);
  color: var(--text-muted);
}

html.dark-mode .otp-input {
  background: #0f172a;
  color: #f8fafc;
  border-color: #334155;
  caret-color: #60a5fa;
}

html.dark-mode .otp-input:focus {
  background: #111b33;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.22);
}

html.dark-mode .otp-input.filled {
  background: #172554;
  color: #ffffff;
  border-color: #60a5fa;
}

html.dark-mode .otp-input.error {
  background: rgba(127, 29, 29, 0.35);
  color: #fee2e2;
  border-color: #ef4444;
}

html.dark-mode .btn-secondary {
  background: #1e293b;
  color: var(--text-primary);
  border-color: #334155;
}

html.dark-mode .btn-secondary:hover {
  background: #263449;
  border-color: #60a5fa;
}

html.dark-mode .btn-primary,
html.dark-mode .btn-blue {
  background: #3b82f6;
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.22);
}

html.dark-mode .btn-primary:hover,
html.dark-mode .btn-blue:hover {
  background: #60a5fa;
}

html.dark-mode .profile-image-upload-btn {
  background: #3b82f6;
  border-color: var(--white);
}

html.dark-mode .profile-image-upload-btn:hover {
  background: #60a5fa;
}

html.dark-mode .data-table tr:hover td {
  background: var(--cream-dark);
}

html.dark-mode .data-table th {
  background: var(--cream-dark);
  border-bottom: 1px solid var(--border);
}

html.dark-mode .data-table td {
  border-bottom: 1px solid var(--border);
}

html.dark-mode .theme-toggle-btn:hover {
  background: var(--cream-dark) !important;
  color: var(--text-primary) !important;
}


/* ---- Support & Community grid ---- */
.support-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

/* ============================================================
   PROFESSIONAL PORTAL DESIGN SYSTEM
   ============================================================ */

.sidebar,
.sidebar.expanded,
html.dark-mode .sidebar,
html.dark-mode .sidebar.expanded {
  background: #1b2433;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 16px rgba(27, 36, 51, 0.18);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.sidebar.expanded .sidebar-nav a,
.sidebar.expanded .btn-logout,
.sidebar.expanded .nav-section-label,
.sidebar.expanded .sidebar-user .user-name,
.sidebar.expanded .sidebar-user .user-email {
  color: rgba(255, 255, 255, 0.82) !important;
}

.sidebar.expanded .sidebar-nav a:hover,
.sidebar.expanded .sidebar-nav a.active,
.sidebar.expanded .btn-logout:hover {
  background: rgba(255, 255, 255, 0.09) !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

.topbar {
  background: rgba(255, 255, 255, 0.97);
  border-bottom-color: var(--border);
  box-shadow: 0 1px 2px rgba(27, 36, 51, 0.04);
}

.card,
.course-card,
.auth-card,
.modal-content,
.support-card,
.session-card,
.module-card,
.certificate-card,
.billing-card,
.order-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.card:hover,
.course-card:hover {
  box-shadow: var(--shadow-lg);
}

.course-card-header {
  background: var(--navy);
}

.course-card-header::before,
.course-card-header::after {
  content: none;
}

.course-badge,
.course-status,
.status-badge,
.badge {
  border-radius: var(--radius-sm);
}

.course-name,
.course-card-title,
.program-title,
.course-page-title {
  font-family: 'Source Serif 4', Georgia, serif;
  letter-spacing: 0;
  font-weight: 600;
}

.btn-primary,
.btn-blue,
.profile-image-upload-btn {
  background: var(--amber);
  border-color: var(--amber);
  color: #18202d;
  box-shadow: none;
}

.btn-primary:hover,
.btn-blue:hover,
.profile-image-upload-btn:hover {
  background: var(--amber-dark);
  border-color: var(--amber-dark);
  color: #111827;
  box-shadow: 0 4px 10px rgba(201, 125, 19, 0.18);
}

.btn-secondary {
  background: var(--white);
  color: var(--blue-light);
  border: 1px solid var(--blue);
}

.btn-secondary:hover {
  background: var(--blue-pale);
  border-color: var(--blue-light);
}

input,
select,
textarea,
.otp-input {
  border-radius: var(--radius-sm);
  box-shadow: none;
}

input:focus,
select:focus,
textarea:focus,
.otp-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(36, 109, 173, 0.12);
}

.auth-page {
  background: var(--cream);
}

.auth-card {
  background: var(--white);
  box-shadow: 0 8px 28px rgba(27, 36, 51, 0.10);
}

.auth-title {
  font-weight: 600;
}

html.dark-mode {
  --cream: #0f1724;
  --cream-dark: #182234;
  --white: #141f31;
  --text-primary: #f4f6f8;
  --text-secondary: #c5ccd5;
  --text-muted: #97a1af;
  --border: #344055;
  --border-light: #2a3548;
  --navy: #0b1220;
  --blue: #6da7d9;
  --blue-light: #91bee3;
  --blue-pale: rgba(109, 167, 217, 0.12);
}

html.dark-mode .sidebar,
html.dark-mode .sidebar.expanded {
  background: #1b2433;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 16px rgba(27, 36, 51, 0.18);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

html.dark-mode .btn-primary,
html.dark-mode .btn-blue,
html.dark-mode .profile-image-upload-btn {
  background: var(--amber);
  border-color: var(--amber);
  color: #18202d;
  box-shadow: none;
}

html.dark-mode .btn-primary:hover,
html.dark-mode .btn-blue:hover,
html.dark-mode .profile-image-upload-btn:hover {
  background: #f0ad48;
  color: #111827;
}

html.dark-mode .btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border-color: #536077;
}

html.dark-mode .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--blue);
}

html.dark-mode .otp-input,
html.dark-mode .otp-input.filled {
  background: #0f1724;
  color: #ffffff;
  border-color: #52617a;
  caret-color: var(--blue);
}

html.dark-mode .otp-input:focus {
  background: #182234;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(109, 167, 217, 0.18);
}

@media (max-width: 768px) {
  .sidebar,
  .sidebar.expanded {
    border-radius: 0;
  }

  .page-content {
    padding: 24px 18px;
  }

  .auth-card {
    padding: 32px 24px;
  }
}
