/* ═══════════════════════════════════════════════════════════════
   coaching-style.css — QuantReflex Coaching Admin Design System
   Premium dark-mode, mobile-first.
   Inspired by Linear, Notion, Duolingo, modern fintech.
   ═══════════════════════════════════════════════════════════════ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700;800&display=swap');

/* ── CSS Custom Properties ── */
:root {
  /* Backgrounds */
  --bg-primary: #050914;
  --bg-secondary: #0d1222;
  --bg-card: #141b2e;
  --bg-card-hover: #1c243d;
  --bg-elevated: #1e2640;
  --bg-input: #171e33;
  --bg-overlay: rgba(0, 0, 0, 0.7);

  /* Text */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --text-muted: #475569;

  /* Accents */
  --accent-primary: #6366f1;
  --accent-primary-glow: rgba(99, 102, 241, 0.4);
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.25);
  --accent-amber: #f59e0b;
  --accent-amber-glow: rgba(245, 158, 11, 0.25);
  --accent-red: #ef4444;
  --accent-red-glow: rgba(239, 68, 68, 0.25);
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.25);
  --accent-violet: #8b5cf6;
  --accent-violet-glow: rgba(139, 92, 246, 0.25);

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #6366f1, #8b5cf6);
  --gradient-success: linear-gradient(135deg, #10b981, #06b6d4);
  --gradient-warning: linear-gradient(135deg, #f59e0b, #ef4444);
  --gradient-premium: linear-gradient(135deg, #8b5cf6, #ec4899);

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.15);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px var(--accent-primary-glow);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-2xl: 24px;
  --space-3xl: 32px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-family-display: 'Outfit', 'Inter', sans-serif;
  --font-xs: 0.6875rem;
  --font-sm: 0.8125rem;
  --font-base: 0.9375rem;
  --font-lg: 1.0625rem;
  --font-xl: 1.25rem;
  --font-2xl: 1.5rem;
  --font-3xl: 1.875rem;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;

  /* Bottom nav height */
  --bottom-nav-height: 64px;
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── Reset ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent-primary); text-decoration: none; }
img { max-width: 100%; display: block; }
input, button, textarea, select { font-family: inherit; font-size: inherit; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 4px; }

/* ═══════════════════════════════════════
   AUTH SCREEN
   ═══════════════════════════════════════ */
.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: var(--space-xl);
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

.auth-screen::before {
  content: '';
  position: absolute;
  top: -40%;
  left: -20%;
  width: 80%;
  height: 80%;
  background: radial-gradient(circle, var(--accent-primary-glow) 0%, transparent 70%);
  pointer-events: none;
  animation: authGlow 8s ease-in-out infinite alternate;
}

@keyframes authGlow {
  0% { transform: translate(0, 0) scale(1); opacity: 0.4; }
  100% { transform: translate(10%, 10%) scale(1.1); opacity: 0.6; }
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-3xl);
  position: relative;
  z-index: 1;
  backdrop-filter: blur(20px);
}

.auth-logo {
  width: 56px;
  height: 56px;
  background: var(--gradient-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  margin: 0 auto var(--space-xl);
  box-shadow: var(--shadow-glow);
}

.auth-title {
  font-size: var(--font-2xl);
  font-weight: 700;
  text-align: center;
  margin-bottom: var(--space-xs);
}

.auth-subtitle {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.auth-tabs {
  display: flex;
  gap: var(--space-xs);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: var(--space-2xl);
}

.auth-tab {
  flex: 1;
  padding: var(--space-md) var(--space-lg);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: var(--font-sm);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-base);
  min-height: 44px;
}

.auth-tab.active {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-primary-glow);
}

.auth-field {
  margin-bottom: var(--space-lg);
}

.auth-label {
  display: block;
  font-size: var(--font-xs);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
}

.auth-input {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--font-base);
  outline: none;
  transition: var(--transition-base);
  min-height: 48px;
}

.auth-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.auth-input::placeholder {
  color: var(--text-muted);
}

/* ── Password Toggle ── */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper .auth-input {
  padding-right: 50px;
}

.password-toggle-btn {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color var(--transition-fast), background var(--transition-fast);
  min-height: 36px;
  min-width: 36px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.password-toggle-btn:hover,
.password-toggle-btn:focus-visible {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
}

.password-toggle-btn:active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.auth-error {
  background: var(--accent-red-glow);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  font-size: var(--font-sm);
  margin-bottom: var(--space-lg);
  display: none;
}

.auth-btn {
  width: 100%;
  padding: var(--space-lg);
  background: var(--gradient-primary);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: var(--font-base);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-base);
  min-height: 52px;
  position: relative;
  overflow: hidden;
}

.auth-btn:active {
  transform: scale(0.98);
}

.auth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-footer {
  text-align: center;
  font-size: var(--font-xs);
  color: var(--text-muted);
  margin-top: var(--space-2xl);
}

/* ═══════════════════════════════════════
   APP SHELL
   ═══════════════════════════════════════ */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(5, 9, 20, 0.7);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border-subtle);
  padding: var(--space-md) var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
}

.app-header-title {
  font-size: var(--font-lg);
  font-weight: 700;
}

.app-header-badge {
  font-size: var(--font-xs);
  color: var(--accent-emerald);
  background: var(--accent-emerald-glow);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 500;
}

.header-refresh-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-base);
  border: 1px solid var(--border-subtle);
}

.header-refresh-btn:active {
  background: var(--bg-elevated);
  transform: scale(0.92);
}

.header-refresh-btn.spinning svg {
  animation: spin 0.8s linear infinite;
}

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

/* ── Main Content ── */
.main-content {
  flex: 1;
  padding: var(--space-xl);
  padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom) + var(--space-xl));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.view {
  display: none;
  animation: viewFadeIn 0.25s ease;
}

.view.active {
  display: block;
}

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

/* ═══════════════════════════════════════
   BOTTOM NAVIGATION
   ═══════════════════════════════════════ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
  padding-bottom: var(--safe-area-bottom);
  background: rgba(13, 18, 34, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 200;
}

.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-sm) var(--space-md);
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
  min-width: 56px;
  min-height: 44px;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.nav-tab svg {
  width: 22px;
  height: 22px;
  transition: var(--transition-fast);
}

.nav-tab-label {
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.nav-tab.active {
  color: var(--accent-primary);
}

.nav-tab.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  background: var(--accent-primary);
  border-radius: 0 0 3px 3px;
  box-shadow: 0 2px 8px var(--accent-primary-glow);
}

/* ═══════════════════════════════════════
   CARDS
   ═══════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-lg);
  transition: var(--transition-base);
}

.card-compact {
  padding: var(--space-lg);
}

.card-title {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-md);
}

/* ── Dashboard Hero ── */
.dashboard-hero {
  margin-bottom: var(--space-xl);
}

.dashboard-hero-date {
  font-size: var(--font-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.dashboard-hero-text {
  font-size: var(--font-2xl);
  font-weight: 700;
  margin-top: 2px;
}

/* ── Coaching Health Display ── */
.health-display {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
}

.health-display-title {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-lg);
}

.health-factors {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.health-factor {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.health-factor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.health-factor-title {
  font-size: var(--font-sm);
  font-weight: 500;
  color: var(--text-primary);
}

.health-factor-value {
  font-size: var(--font-sm);
  font-weight: 700;
}

.health-factor-bar {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
}

.health-factor-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 600ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.health-factor-subtitle {
  font-size: var(--font-xs);
  color: var(--text-muted);
}

/* Health factor status colors */
.health-factor-strong .health-factor-value { color: var(--accent-emerald); }
.health-factor-strong .health-factor-fill {
  width: 85%;
  background: linear-gradient(90deg, var(--accent-emerald), #06b6d4);
}

.health-factor-moderate .health-factor-value { color: var(--accent-amber); }
.health-factor-moderate .health-factor-fill {
  width: 55%;
  background: linear-gradient(90deg, var(--accent-amber), #f97316);
}

.health-factor-needs-attention .health-factor-value { color: var(--accent-red); }
.health-factor-needs-attention .health-factor-fill {
  width: 25%;
  background: linear-gradient(90deg, var(--accent-red), #f87171);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
}

.metric-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
}

.metric-card.accent-emerald::after { background: var(--accent-emerald); }
.metric-card.accent-amber::after { background: var(--accent-amber); }
.metric-card.accent-primary::after { background: var(--accent-primary); }
.metric-card.accent-cyan::after { background: var(--accent-cyan); }
.metric-card.accent-violet::after { background: var(--accent-violet); }
.metric-card.accent-red::after { background: var(--accent-red); }

.metric-value {
  font-family: var(--font-family-display);
  font-size: var(--font-2xl);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 2px;
}

.metric-label {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  font-weight: 500;
}

.metric-icon {
  font-size: var(--font-xl);
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  opacity: 0.4;
}

/* ── Student Cards ── */
.student-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
  min-height: 44px;
}

.student-card:active {
  background: var(--bg-card-hover);
  transform: scale(0.98);
}

@media (hover: hover) {
  .student-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
  }
}

.student-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-lg);
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.student-info {
  flex: 1;
  min-width: 0;
}

.student-name {
  font-size: var(--font-base);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.student-meta {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-top: 2px;
}

.student-stats {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
  flex-wrap: wrap;
}

.stat-pill {
  font-size: var(--font-xs);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.stat-pill.accuracy {
  background: var(--accent-emerald-glow);
  color: var(--accent-emerald);
}

.stat-pill.speed {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
}

.stat-pill.streak {
  background: var(--accent-amber-glow);
  color: var(--accent-amber);
}

.stat-pill.premium {
  background: var(--accent-violet-glow);
  color: var(--accent-violet);
}

.stat-pill.weak-topic {
  background: var(--accent-red-glow);
  color: #fca5a5;
}

/* ── Leaderboard ── */
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
  transition: var(--transition-fast);
}

.leaderboard-item:last-child {
  border-bottom: none;
}

.leaderboard-rank {
  font-size: var(--font-xl);
  font-weight: 800;
  width: 36px;
  text-align: center;
  flex-shrink: 0;
}

.leaderboard-rank.gold { color: #fbbf24; }
.leaderboard-rank.silver { color: #d1d5db; }
.leaderboard-rank.bronze { color: #d97706; }

.podium-section {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: var(--space-md);
  margin-bottom: var(--space-2xl);
  padding: var(--space-xl) 0;
}

.podium-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

.podium-bar {
  width: 72px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: var(--space-md);
}

.podium-bar.first {
  height: 100px;
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.3), rgba(251, 191, 36, 0.1));
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.podium-bar.second {
  height: 76px;
  background: linear-gradient(180deg, rgba(209, 213, 219, 0.2), rgba(209, 213, 219, 0.05));
  border: 1px solid rgba(209, 213, 219, 0.2);
}

.podium-bar.third {
  height: 56px;
  background: linear-gradient(180deg, rgba(217, 119, 6, 0.2), rgba(217, 119, 6, 0.05));
  border: 1px solid rgba(217, 119, 6, 0.2);
}

.podium-name {
  font-size: var(--font-xs);
  font-weight: 600;
  max-width: 80px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.podium-value {
  font-size: var(--font-sm);
  font-weight: 700;
  color: var(--accent-amber);
}

/* Podium avatar glow effects */
.podium-avatar-first {
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.4);
  border: 2px solid rgba(251, 191, 36, 0.5);
}
.podium-avatar-second {
  box-shadow: 0 0 12px rgba(209, 213, 219, 0.3);
  border: 2px solid rgba(209, 213, 219, 0.4);
}
.podium-avatar-third {
  box-shadow: 0 0 12px rgba(217, 119, 6, 0.3);
  border: 2px solid rgba(217, 119, 6, 0.4);
}

/* ── Segmented Control ── */
.segmented-control {
  display: flex;
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: var(--space-lg);
  overflow: hidden;
}

.segmented-scroll {
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.segmented-scroll::-webkit-scrollbar { display: none; }

.segmented-indicator {
  position: absolute;
  top: 3px;
  left: 3px;
  height: calc(100% - 6px);
  background: var(--accent-primary);
  border-radius: calc(var(--radius-md) - 2px);
  transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1),
              width 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 8px var(--accent-primary-glow);
  z-index: 0;
}

.segmented-btn {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: var(--font-sm);
  cursor: pointer;
  transition: color var(--transition-fast);
  min-height: 38px;
  white-space: nowrap;
  position: relative;
  z-index: 1;
  -webkit-tap-highlight-color: transparent;
}

.segmented-btn.active {
  color: #fff;
  font-weight: 600;
}

.segmented-btn:active {
  transform: scale(0.96);
}

/* ── Retry / Empty State Enhancements ── */
.btn-retry {
  margin-top: var(--space-md);
  padding: var(--space-sm) var(--space-xl);
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--font-sm);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  min-height: 36px;
}

.btn-retry:active {
  background: var(--bg-card-hover);
  transform: scale(0.96);
}

/* ── Tabs/Pills ── */
.tab-group {
  display: flex;
  gap: var(--space-xs);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.tab-group::-webkit-scrollbar { display: none; }

.tab-pill {
  padding: var(--space-sm) var(--space-lg);
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--font-sm);
  font-weight: 500;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
  min-height: 36px;
}

.tab-pill:active {
  transform: scale(0.95);
}

.tab-pill.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

/* ── Search ── */
.search-bar {
  position: relative;
  margin-bottom: var(--space-lg);
}

.search-input {
  width: 100%;
  padding: var(--space-md) var(--space-lg) var(--space-md) 44px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--font-base);
  outline: none;
  transition: var(--transition-base);
  min-height: 48px;
}

.search-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.search-input::placeholder { color: var(--text-muted); }

.search-icon {
  position: absolute;
  left: var(--space-lg);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* ── Notice Compose ── */
.notice-compose {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
}

.notice-textarea {
  width: 100%;
  padding: var(--space-md);
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--font-base);
  resize: vertical;
  min-height: 80px;
  outline: none;
  transition: var(--transition-base);
}

.notice-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.notice-history-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}

.notice-history-title {
  font-weight: 600;
  margin-bottom: 2px;
}

.notice-history-body {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.notice-history-meta {
  font-size: var(--font-xs);
  color: var(--text-muted);
  display: flex;
  gap: var(--space-md);
  align-items: center;
  flex-wrap: wrap;
}

/* ── Schedule Toggle ── */
.schedule-toggle-section {
  margin-bottom: var(--space-lg);
}

.notice-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.notice-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.notice-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--bg-elevated);
  border-radius: 24px;
  transition: var(--transition-base);
}

.notice-toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: var(--transition-base);
}

.notice-toggle input:checked + .notice-toggle-slider {
  background: var(--accent-primary);
}

.notice-toggle input:checked + .notice-toggle-slider::before {
  transform: translateX(20px);
  background: #fff;
}

/* ── Cancel Scheduled Button ── */
.btn-cancel-scheduled {
  background: none;
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--font-xs);
  cursor: pointer;
  transition: var(--transition-fast);
  margin-left: auto;
}

.btn-cancel-scheduled:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.5);
}

/* ── Quick Templates ── */
.template-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.template-btn {
  padding: var(--space-md);
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--font-xs);
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: center;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.template-btn:active {
  background: var(--bg-elevated);
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: var(--font-sm);
  cursor: pointer;
  transition: var(--transition-base);
  min-height: 44px;
}

.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
}

.btn-outline:active {
  background: var(--bg-elevated);
}

.btn-danger {
  background: var(--accent-red);
  color: #fff;
}

.btn-full {
  width: 100%;
}

.btn-sm {
  padding: var(--space-sm) var(--space-md);
  font-size: var(--font-xs);
  min-height: 36px;
}

/* ── Badges ── */
.badge {
  font-size: var(--font-xs);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
  display: inline-block;
}

.badge-active {
  background: var(--accent-emerald-glow);
  color: var(--accent-emerald);
}

.badge-inactive {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

.badge-premium {
  background: var(--accent-violet-glow);
  color: var(--accent-violet);
}

.badge-premium-plus {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.2));
  color: #e879f9;
}

/* ── Section Headers ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.section-title {
  font-size: var(--font-lg);
  font-weight: 700;
}

.section-subtitle {
  font-size: var(--font-sm);
  color: var(--text-tertiary);
  margin-top: 2px;
}

.section-link {
  font-size: var(--font-sm);
  color: var(--accent-primary);
  font-weight: 500;
  cursor: pointer;
}

/* ── Skeleton Loaders ── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-elevated) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton-line {
  height: 16px;
  margin-bottom: var(--space-sm);
}

.skeleton-line.w-50 { width: 50%; }
.skeleton-line.w-75 { width: 75%; }
.skeleton-line.w-full { width: 100%; }

.skeleton-card {
  height: 80px;
  margin-bottom: var(--space-md);
}

.skeleton-metric {
  height: 90px;
}

/* ── Empty States ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-3xl) var(--space-xl);
  text-align: center;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-lg);
  opacity: 0.6;
}

.empty-state-text {
  font-size: var(--font-base);
  color: var(--text-secondary);
  max-width: 280px;
}

.empty-state-hint {
  font-size: var(--font-sm);
  color: var(--text-muted);
  margin-top: var(--space-sm);
}

/* ── Toast ── */
.toast-container {
  position: fixed;
  top: var(--space-xl);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  width: 90%;
  max-width: 380px;
  pointer-events: none;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-sm);
  font-size: var(--font-sm);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.toast.success { border-left: 3px solid var(--accent-emerald); }
.toast.error { border-left: 3px solid var(--accent-red); }

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

.toast-exit {
  animation: toastOut 0.2s ease forwards;
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(-16px); }
}

/* ── Bottom Sheet ── */
.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 500;
  opacity: 0;
  transition: opacity var(--transition-slow);
  pointer-events: none;
}

.bottom-sheet-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 90dvh;
  background: var(--bg-secondary);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  z-index: 501;
  transform: translateY(100%);
  transition: transform var(--transition-slow);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.bottom-sheet.active {
  transform: translateY(0);
}

.bottom-sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--border-strong);
  border-radius: var(--radius-full);
  margin: var(--space-md) auto;
}

.bottom-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-xl) var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
}

.bottom-sheet-title {
  font-size: var(--font-lg);
  font-weight: 700;
}

.bottom-sheet-close {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg-card);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bottom-sheet-content {
  padding: var(--space-xl);
  padding-bottom: calc(var(--space-xl) + var(--safe-area-bottom));
}

/* ── More Menu ── */
.more-item {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: var(--transition-fast);
  min-height: 52px;
}

.more-item:active {
  background: var(--bg-card-hover);
}

.more-icon {
  font-size: var(--font-xl);
  width: 36px;
  text-align: center;
}

.more-text {
  flex: 1;
}

.more-label {
  font-weight: 500;
}

.more-hint {
  font-size: var(--font-xs);
  color: var(--text-muted);
}

.more-chevron {
  color: var(--text-muted);
}

/* ── Bar Charts (inline) ── */
.bar-chart-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.bar-chart-label {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  width: 80px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.bar-chart-track {
  flex: 1;
  height: 8px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.bar-chart-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.bar-chart-fill.emerald { background: var(--accent-emerald); }
.bar-chart-fill.red { background: var(--accent-red); }
.bar-chart-fill.amber { background: var(--accent-amber); }
.bar-chart-fill.primary { background: var(--accent-primary); }

.bar-chart-value {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  width: 36px;
  flex-shrink: 0;
}

/* ── Coaching Info Card ── */
.coaching-info-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
}

.coaching-info-header {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.coaching-logo {
  width: 48px;
  height: 48px;
  background: var(--gradient-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-xl);
  font-weight: 800;
  color: #fff;
}

.coaching-name {
  font-size: var(--font-xl);
  font-weight: 700;
}

.coaching-id {
  font-size: var(--font-xs);
  color: var(--text-muted);
  font-family: monospace;
}

.coaching-info-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-md) 0;
  border-top: 1px solid var(--border-subtle);
  font-size: var(--font-sm);
}

.coaching-info-label { color: var(--text-tertiary); }
.coaching-info-value { font-weight: 500; }

/* ── Profile Avatar Ring ── */
.profile-avatar-ring {
  border: 2px solid transparent;
  background-image: var(--gradient-premium);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: 0 0 12px var(--accent-violet-glow);
}

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */

/* Small phones (320px - 374px) */
@media (max-width: 374px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .auth-card {
    padding: var(--space-lg);
    margin: var(--space-md);
  }

  .podium-section {
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .student-stats {
    flex-wrap: wrap;
  }

  .segmented-btn {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-xs);
  }

  .health-factors {
    gap: var(--space-md);
  }

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

/* Standard phones (375px - 430px) */
@media (max-width: 430px) {
  .main-content {
    padding: var(--space-md);
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom) + var(--space-xl));
  }

  .dashboard-hero-text {
    font-size: var(--font-xl);
  }
}

/* Tablet */
@media (min-width: 768px) {
  .metrics-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .main-content {
    max-width: 720px;
    margin: 0 auto;
    padding: var(--space-2xl);
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom) + var(--space-2xl));
  }

  .template-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .health-factors {
    flex-direction: row;
    gap: var(--space-xl);
  }

  .health-factor {
    flex: 1;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .metrics-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .main-content {
    max-width: 900px;
  }

  .bottom-nav {
    max-width: 600px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border: 1px solid var(--border-subtle);
    border-bottom: none;
  }
}

/* ── Utility Classes ── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-emerald { color: var(--accent-emerald); }
.text-amber { color: var(--accent-amber); }
.text-red { color: var(--accent-red); }
.text-primary-accent { color: var(--accent-primary); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

/* ═══════════════════════════════════════
   PRINT STYLES (Parent Report Cards)
   ═══════════════════════════════════════ */
@media print {
  body {
    background: white;
    color: black;
  }
  
  .app-header, .bottom-nav, button, .app-shell, .bottom-sheet-overlay {
    display: none !important;
  }

  .bottom-sheet {
    position: static;
    transform: none;
    background: white;
    border: none;
    box-shadow: none;
    padding: 0;
  }

  .sheet-header {
    display: none;
  }

  .card {
    border: 1px solid #ccc;
    box-shadow: none;
    page-break-inside: avoid;
    background: white;
  }

  .metric-card {
    border: 1px solid #ddd;
    background: #f9f9f9;
  }

  .metric-value {
    color: black;
  }

  .text-secondary, .text-tertiary, .text-muted {
    color: #555;
  }

  .bar-chart-fill {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .stat-pill {
    border: 1px solid #ccc;
    background: transparent !important;
    color: black !important;
  }
}
.mb-xl { margin-bottom: var(--space-xl); }
.d-none { display: none; }
.d-flex { display: flex; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.w-full { width: 100%; }
.flex-1 { flex: 1; }

