/* =========================================================
   Özel Ders & Eğitim Koçluğu Takip - Modern Design System
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Dark Theme (Default) */
  --bg-main: #0b0f19;
  --bg-sidebar: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-card-hover: rgba(30, 41, 59, 0.95);
  --bg-glass: rgba(15, 23, 42, 0.75);
  --bg-input: #1e293b;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-hover: rgba(99, 102, 241, 0.4);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.15);
  
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #a855f7;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-main: #f1f5f9;
  --bg-sidebar: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.85);
  --bg-input: #f8fafc;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-color-hover: rgba(99, 102, 241, 0.4);
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: rgba(79, 70, 229, 0.1);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 20px rgba(79, 70, 229, 0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  letter-spacing: -0.01em;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* App Container Layout */
.app-layout {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* =========================================================
   Sidebar Styling
   ========================================================= */
.sidebar {
  width: 270px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 40;
  transition: var(--transition);
}

.sidebar-header {
  padding: 24px 20px 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--border-color);
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.brand-text h1 {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.2;
  background: linear-gradient(to right, #f8fafc, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .brand-text h1 {
  background: linear-gradient(to right, #0f172a, #334155);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text span {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-nav {
  flex: 1;
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.nav-category {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 10px 12px 4px 12px;
  letter-spacing: 0.06em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.nav-item i {
  font-size: 1.15rem;
  width: 22px;
  display: flex;
  justify-content: center;
}

.nav-item:hover {
  color: var(--text-main);
  background: var(--primary-light);
  border-color: var(--border-color);
}

.nav-item.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
  border-color: rgba(255, 255, 255, 0.15);
}

.nav-badge {
  margin-left: auto;
  padding: 2px 7px;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.15);
}

.sidebar-footer {
  padding: 16px 14px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.coach-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.coach-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.coach-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
}

.coach-role {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* =========================================================
   Main Content Area
   ========================================================= */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-main);
  position: relative;
}

/* Background Ambient Glow */
.main-wrapper::before {
  content: '';
  position: absolute;
  top: -120px;
  right: -120px;
  width: 450px;
  height: 450px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Header */
.top-header {
  height: 72px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  z-index: 20;
}

.header-title-area h2 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.header-title-area p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Content Container */
.content-area {
  flex: 1;
  padding: 28px 32px 40px 32px;
  overflow-y: auto;
  position: relative;
  z-index: 1;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================================================
   UI Components & Cards
   ========================================================= */

.grid-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.metric-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-color-hover);
  box-shadow: var(--shadow-md);
}

.metric-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--metric-color, var(--primary));
}

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--metric-bg, var(--primary-light));
  color: var(--metric-color, var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.metric-info h4 {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}

.metric-info .metric-val {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}

.metric-info .metric-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 3px;
}

/* Glass Card */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  margin-bottom: 22px;
}

.glass-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.glass-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.glass-card-title h3 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.glass-card-title i {
  color: var(--primary);
  font-size: 1.2rem;
}

/* =========================================================
   Buttons & Inputs
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  font-family: inherit;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 12px 24px;
  font-size: 0.95rem;
  border-radius: var(--radius-lg);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-dim);
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  color: #f43f5e;
  border-color: rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
  background: #f43f5e;
  color: #ffffff;
}

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-color);
}

.btn-outline:hover {
  color: var(--text-main);
  border-color: var(--primary);
  background: var(--primary-light);
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-icon.btn-sm {
  width: 30px;
  height: 30px;
}

/* Form Controls */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.88rem;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

textarea.form-control {
  min-height: 80px;
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

/* Badges & Status */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: var(--radius-full);
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.badge-danger { background: rgba(244, 63, 94, 0.15); color: #f43f5e; }
.badge-cyan { background: rgba(6, 182, 212, 0.15); color: #06b6d4; }
.badge-purple { background: rgba(168, 85, 247, 0.15); color: #a855f7; }

/* =========================================================
   Students Grid & Cards
   ========================================================= */
.students-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.student-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
}

.student-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-color-hover);
  box-shadow: var(--shadow-md);
}

.student-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.student-avatar {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.2rem;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.student-card-info h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.student-card-info p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.student-card-target {
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.78rem;
  border: 1px dashed var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}

.student-card-target strong {
  color: var(--text-main);
}

.student-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

.student-stat-item {
  display: flex;
  flex-direction: column;
}

.student-stat-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.student-stat-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.student-card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

/* =========================================================
   Student Detail Sub-Navigation & Panes
   ========================================================= */
.student-profile-header {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.student-profile-main {
  display: flex;
  align-items: center;
  gap: 18px;
}

.student-profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.6rem;
  font-weight: 800;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.student-subtabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.student-subtab-btn {
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.student-subtab-btn:hover {
  color: var(--text-main);
  border-color: var(--text-dim);
}

.student-subtab-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* =========================================================
   Curriculum / Topic Matrix
   ========================================================= */
.topic-matrix-table {
  width: 100%;
  border-collapse: collapse;
}

.topic-matrix-table th {
  text-align: left;
  padding: 12px 14px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-color);
}

.topic-matrix-table td {
  padding: 12px 14px;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

.topic-matrix-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.status-pill-btn {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.status-not_started { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }
.status-in_progress { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.status-solved_questions { background: rgba(6, 182, 212, 0.15); color: #06b6d4; }
.status-completed { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.status-need_review { background: rgba(244, 63, 94, 0.15); color: #f43f5e; }

/* =========================================================
   Weekly Calendar View
   ========================================================= */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
}

.calendar-day-col {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  min-height: 480px;
  overflow: hidden;
}

.calendar-day-header {
  padding: 12px 10px;
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-color);
}

.calendar-day-header.today {
  background: var(--primary-light);
  border-bottom-color: var(--primary);
}

.calendar-day-header .day-name {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.calendar-day-header .day-number {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 2px;
}

.calendar-day-body {
  flex: 1;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.calendar-lesson-card {
  padding: 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border-left: 4px solid var(--primary);
  font-size: 0.78rem;
  cursor: pointer;
  transition: var(--transition);
}

.calendar-lesson-card:hover {
  background: rgba(255, 255, 255, 0.09);
  transform: translateY(-2px);
}

.calendar-lesson-time {
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.calendar-lesson-student {
  font-weight: 600;
  color: var(--text-main);
}

.calendar-lesson-subj {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.calendar-lesson-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.btn-quick-status {
  padding: 3px 7px;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  user-select: none;
}

.btn-quick-status:hover {
  transform: scale(1.05);
  filter: brightness(1.2);
}

.btn-quick-status.status-done {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.45);
  color: #10b981;
}

.btn-quick-status.status-pending {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.35);
  color: #818cf8;
}

.btn-quick-status.pay-done {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.45);
  color: #10b981;
}

.btn-quick-status.pay-pending {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.35);
  color: #f43f5e;
}

/* =========================================================
   Modal Window Styles
   ========================================================= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-container {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.96);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-container {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* =========================================================
   Toast Notification System
   ========================================================= */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.toast {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-success { border-left: 4px solid #10b981; }
.toast-error { border-left: 4px solid #f43f5e; }
.toast-info { border-left: 4px solid var(--primary); }

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* =========================================================
   Print / Report View Styles
   ========================================================= */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .sidebar, .top-header, .btn, .student-subtabs, .modal-overlay {
    display: none !important;
  }
  .main-wrapper {
    overflow: visible !important;
    height: auto !important;
  }
  .content-area {
    padding: 0 !important;
  }
  .glass-card {
    border: 1px solid #ddd !important;
    background: #fff !important;
    box-shadow: none !important;
  }
}

/* =========================================================
   Student Portal Base Styles
   ========================================================= */
.portal-overview-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  width: 100%;
}

.student-portal-header {
  height: 70px;
  padding: 0 28px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.student-portal-container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px 60px 20px;
  flex: 1;
  box-sizing: border-box;
}

.student-portal-banner {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(16, 185, 129, 0.08) 100%);
  border-color: rgba(99, 102, 241, 0.25);
  padding: 24px;
  margin-bottom: 22px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.student-portal-metrics {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.sp-metric-item {
  text-align: right;
}

.sp-metric-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.sp-metric-val {
  font-size: 1.25rem;
  font-weight: 800;
}

/* =========================================================
   Mobile Bottom Navigation & Drawer Styles
   ========================================================= */
.mobile-bottom-nav {
  display: none;
}

.mobile-sidebar-backdrop {
  display: none;
}

/* =========================================================
   Responsive Design (Tablets & Mobile Devices - ZERO HORIZONTAL SCROLL)
   ========================================================= */

@media (max-width: 960px) {
  .calendar-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  /* Prevent Any Horizontal Scroll Across Entire Viewport */
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100% !important;
    position: relative;
  }

  .app-layout,
  .main-wrapper,
  .content-area,
  #student-portal-shell,
  .student-portal-container,
  .glass-card,
  .tab-pane,
  .portal-tab-content {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Layout adjustments */
  .app-layout {
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
  }

  /* Sidebar Drawer on Mobile */
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: -300px;
    width: 285px;
    z-index: 1000;
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.7);
    transition: left 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .sidebar.mobile-open {
    left: 0 !important;
  }

  .sidebar .brand-text,
  .sidebar .nav-item span,
  .sidebar .nav-category,
  .sidebar .coach-info,
  .sidebar .nav-badge {
    display: flex !important;
  }

  .sidebar .brand-text h1 {
    display: block !important;
  }

  .sidebar-header {
    padding: 18px 16px;
  }

  /* Mobile Backdrop */
  .mobile-sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 990;
  }

  /* Mobile Bottom Navigation Bar */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border-color);
    z-index: 900;
    align-items: center;
    justify-content: space-around;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35);
  }

  .mobile-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 600;
    padding: 6px 8px;
    cursor: pointer;
    flex: 1;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.2s ease;
  }

  .mobile-nav-btn i {
    width: 20px;
    height: 20px;
  }

  .mobile-nav-btn.active {
    color: var(--primary);
    font-weight: 800;
  }

  /* Top Header on Mobile */
  .top-header {
    height: auto;
    min-height: 56px;
    padding: 8px 12px;
    gap: 6px;
  }

  .mobile-menu-toggle-btn {
    display: inline-flex !important;
    min-width: 36px;
    min-height: 36px;
    padding: 6px;
  }

  .header-title-area h2 {
    font-size: 0.95rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
    line-height: 1.2;
  }

  .header-title-area p {
    display: none;
  }

  .header-actions {
    gap: 5px;
    flex-shrink: 0;
  }

  .header-actions .btn {
    padding: 6px 9px;
    font-size: 0.72rem;
    min-height: 36px;
  }

  .btn-text-responsive {
    display: none;
  }

  /* Content Area */
  .content-area {
    padding: 12px 10px 75px 10px;
    -webkit-overflow-scrolling: touch;
  }

  /* Dashboard Metrics */
  .grid-metrics {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
  }

  .metric-card {
    padding: 12px 10px;
    gap: 10px;
    border-radius: var(--radius-md);
  }

  .metric-icon {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
  }

  .metric-info h4 {
    font-size: 0.68rem;
    margin-bottom: 1px;
  }

  .metric-info .metric-val {
    font-size: 1.15rem;
  }

  .metric-info .metric-sub {
    font-size: 0.65rem;
  }

  /* Glass Card */
  .glass-card {
    padding: 14px 12px;
    border-radius: var(--radius-md);
    margin-bottom: 14px;
  }

  .glass-card-header {
    margin-bottom: 14px;
    padding-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Student Profile Header on Mobile */
  .student-profile-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    padding: 14px 12px !important;
    border-radius: var(--radius-md) !important;
  }

  .student-profile-main {
    width: 100%;
    align-items: center;
  }

  .student-profile-avatar {
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
    flex-shrink: 0;
  }

  .student-profile-header > div:last-child {
    display: grid !important;
    grid-template-columns: 1fr 1fr 1fr auto !important;
    gap: 8px !important;
    align-items: center !important;
    width: 100% !important;
    background: rgba(255, 255, 255, 0.04) !important;
    padding: 10px !important;
    border-radius: var(--radius-md) !important;
    border: 1px solid var(--border-color) !important;
  }

  .student-profile-header > div:last-child > div {
    text-align: center !important;
  }

  .student-profile-header #ws-progress-percent,
  .student-profile-header #ws-solved-questions,
  .student-profile-header #ws-student-balance {
    font-size: 0.98rem !important;
  }

  /* Student Sub-tabs: 2-Column Grid (NO SIDE SCROLLING!) */
  .student-subtabs {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
    padding: 0 !important;
    margin-bottom: 14px !important;
    overflow-x: hidden !important;
    width: 100% !important;
  }

  .student-subtabs::-webkit-scrollbar {
    display: none !important;
  }

  .student-subtab-btn {
    width: 100% !important;
    flex-shrink: 1 !important;
    padding: 9px 8px !important;
    font-size: 0.74rem !important;
    font-weight: 700 !important;
    border-radius: var(--radius-md) !important;
    text-align: center !important;
    justify-content: center !important;
    white-space: normal !important;
    min-height: 42px !important;
  }

  /* Student Portal Responsive Adjustments */
  .student-portal-header {
    height: auto !important;
    min-height: 56px !important;
    padding: 8px 12px !important;
    gap: 6px !important;
  }

  .student-portal-container {
    padding: 12px 10px 75px 10px !important;
  }

  .student-portal-banner {
    padding: 14px 12px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    margin-bottom: 14px !important;
  }

  .student-portal-metrics {
    display: grid !important;
    grid-template-columns: 1fr 1fr 1fr !important;
    gap: 8px !important;
    width: 100% !important;
    background: rgba(255, 255, 255, 0.04) !important;
    padding: 10px 6px !important;
    border-radius: var(--radius-md) !important;
    border: 1px solid var(--border-color) !important;
  }

  .sp-metric-item {
    text-align: center !important;
  }

  .sp-metric-label {
    font-size: 0.62rem !important;
    line-height: 1.1 !important;
    margin-bottom: 2px !important;
  }

  .sp-metric-val {
    font-size: 1.05rem !important;
  }

  .portal-overview-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Students Grid */
  .students-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Topic Matrix Table Responsive (Fixed layout, no horizontal overflow) */
  .topic-matrix-table {
    width: 100% !important;
    display: table !important;
    table-layout: fixed !important;
  }

  .topic-matrix-table th:first-child,
  .topic-matrix-table td:first-child {
    width: 44% !important;
    padding: 8px 4px !important;
    font-size: 0.78rem !important;
    word-break: break-word !important;
  }

  .topic-matrix-table th:nth-child(2),
  .topic-matrix-table td:nth-child(2) {
    width: 32% !important;
    padding: 8px 3px !important;
  }

  .topic-matrix-table th:nth-child(3),
  .topic-matrix-table td:nth-child(3) {
    width: 24% !important;
    padding: 8px 3px !important;
  }

  .topic-matrix-table .form-control {
    font-size: 0.74rem !important;
    padding: 4px 4px !important;
    min-height: 34px !important;
  }

  .status-pill-btn {
    padding: 4px 6px;
    font-size: 0.65rem;
  }

  /* Calendar on Mobile */
  .calendar-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .calendar-day-col {
    min-height: auto !important;
    border-radius: var(--radius-md) !important;
  }

  .calendar-day-header {
    padding: 8px 10px !important;
  }

  /* Modals on Mobile */
  .modal-container {
    width: 95% !important;
    max-width: 95% !important;
    max-height: 88vh !important;
    border-radius: var(--radius-lg) !important;
  }

  .modal-header {
    padding: 14px 16px !important;
  }

  .modal-header h3 {
    font-size: 1rem !important;
  }

  .modal-body {
    padding: 14px 14px !important;
  }

  .form-row {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  .form-group {
    margin-bottom: 10px !important;
  }

  .form-label {
    font-size: 0.75rem !important;
    margin-bottom: 3px !important;
  }

  /* Prevents iOS Safari auto-zoom on input focus by setting 16px */
  .form-control {
    font-size: 16px !important;
    min-height: 42px !important;
    padding: 8px 12px !important;
  }

  .modal-footer {
    padding: 12px 14px !important;
    flex-direction: column-reverse !important;
    gap: 8px !important;
  }

  .modal-footer .btn {
    width: 100% !important;
    min-height: 42px !important;
    font-size: 0.9rem !important;
  }

  /* Goal toggle button */
  #goal-toggle-btn {
    min-height: 46px !important;
    font-size: 0.88rem !important;
  }
}

@media (max-width: 480px) {
  .grid-metrics {
    grid-template-columns: 1fr;
  }

  .student-profile-header > div:last-child {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  .student-profile-header > div:last-child > div:nth-child(3) {
    grid-column: 1 / -1;
    border-top: 1px solid var(--border-color);
    padding-top: 6px;
  }

  .student-profile-header > div:last-child > div:last-child {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    gap: 10px;
    width: 100%;
  }

  .student-profile-header > div:last-child > div:last-child a,
  .student-profile-header > div:last-child > div:last-child button {
    flex: 1;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}
