/* ===========================================
   Teacher Dashboard - Professional UI
   =========================================== */

/* CSS Variables for dashboard theming */
.t-dashboard {
  --t-bg: #0f0f14;
  --t-bg-card: #16161e;
  --t-bg-input: #1a1a26;
  --t-border: #2a2a3a;
  --t-text: #e5e7eb;
  --t-text-secondary: #9ca3af;
  --t-text-muted: #6b7280;
  --t-accent: #6366F1;
  --t-hover: #1e1e2e;
  display: flex;
  min-height: 100vh;
  background: var(--t-bg);
  color: var(--t-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Light theme overrides */
[data-theme="light"] .t-dashboard {
  --t-bg: #f5f5f7;
  --t-bg-card: #ffffff;
  --t-bg-input: #f9fafb;
  --t-border: #e5e7eb;
  --t-text: #111827;
  --t-text-secondary: #6b7280;
  --t-text-muted: #9ca3af;
  --t-hover: #f3f4f6;
}

/* Teacher/Student dashboard pages need scroll */
body:has(.t-dashboard),
body:has(.s-dashboard),
body:has(.teacher-container) {
  overflow: auto;
  height: auto;
}

.teacher-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 12px;
  color: var(--t-text-secondary);
}

.teacher-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--t-border);
  border-top-color: #6366F1;
  border-radius: 50%;
  animation: t-spin 0.7s linear infinite;
}

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

/* Sidebar */
.t-sidebar {
  width: 260px;
  background: var(--t-bg-card);
  border-right: 1px solid var(--t-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  z-index: 20;
}

.t-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--t-border);
}

.t-brand-icon {
  font-size: 22px;
}

.t-brand-name {
  font-size: 18px;
  font-weight: 700;
}

.t-role-tag {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.15);
  color: #10B981;
  margin-left: auto;
}

.t-nav {
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.t-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--t-text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
  text-align: left;
  text-decoration: none;
}

.t-nav-item:hover {
  background: var(--t-hover);
  color: var(--t-text);
}

.t-nav-item.active {
  background: rgba(99, 102, 241, 0.1);
  color: #6366F1;
}

.t-nav-item ion-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.t-nav-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--t-hover);
  min-width: 20px;
  text-align: center;
}
.t-nav-count-alert {
  background: rgba(239,68,68,0.2);
  color: #fca5a5;
}

.t-nav-divider {
  height: 1px;
  background: var(--t-border);
  margin: 4px 16px;
}

.t-sidebar-footer {
  margin-top: auto;
  padding: 12px 14px;
  border-top: 1px solid var(--t-border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.t-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  overflow: hidden;
}

.t-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

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

.t-user-avatar span {
  font-size: 14px;
  font-weight: 600;
  color: white;
}

.t-user-details {
  overflow: hidden;
}

.t-user-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.t-user-email {
  font-size: 11px;
  color: var(--t-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.t-logout-btn {
  background: none;
  border: 1px solid var(--t-border);
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  color: var(--t-text-muted);
  display: flex;
  transition: all 0.15s;
  flex-shrink: 0;
}

.t-logout-btn:hover {
  color: #EF4444;
  border-color: rgba(239, 68, 68, 0.3);
}

/* Main */
.t-main {
  flex: 1;
  overflow-y: auto;
  position: relative;
}

.t-content {
  max-width: 1000px;
  margin: 0 auto;
  padding: 28px 32px;
}

.t-loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 60vh;
  gap: 12px;
  color: var(--t-text-secondary);
}

/* Alerts */
.t-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin: 16px 24px 0;
  animation: t-fadeIn 0.2s;
}

@keyframes t-fadeIn { from { opacity: 0; transform: translateY(-6px); } }

.t-alert ion-icon { font-size: 18px; flex-shrink: 0; }
.t-alert button { background: none; border: none; font-size: 18px; cursor: pointer; margin-left: auto; color: inherit; opacity: 0.7; }

.t-alert-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.t-alert-success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #34D399;
}

/* Page Header */
.t-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.t-page-header h1 {
  font-size: 24px;
  font-weight: 700;
}

.t-subtitle {
  font-size: 14px;
  color: var(--t-text-muted);
  margin-top: 4px;
}

/* Stats Row */
.t-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.t-stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: var(--t-bg-card);
  border: 1px solid var(--t-border);
  border-radius: 12px;
}

.t-stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.t-stat-value {
  font-size: 22px;
  font-weight: 700;
}

.t-stat-label {
  font-size: 12px;
  color: var(--t-text-muted);
}

/* Section */
.t-section { margin-bottom: 28px; }

.t-section-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 14px;
}

.t-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.t-link-btn {
  background: none;
  border: none;
  font-size: 13px;
  color: #6366F1;
  cursor: pointer;
  font-weight: 500;
}

.t-link-btn:hover { text-decoration: underline; }

/* Quick Actions */
.t-quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.t-quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 16px;
  background: var(--t-bg-card);
  border: 1px solid var(--t-border);
  border-radius: 12px;
  cursor: pointer;
  color: var(--t-text-secondary);
  transition: all 0.15s;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.t-quick-action:hover {
  border-color: rgba(99, 102, 241, 0.3);
  color: #6366F1;
  background: rgba(99, 102, 241, 0.03);
}

.t-quick-action ion-icon { font-size: 24px; }

/* Card Grid */
.t-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.t-card {
  background: var(--t-bg-card);
  border: 1px solid var(--t-border);
  border-radius: 12px;
  transition: border-color 0.2s;
}
.t-card:hover {
  border-color: rgba(99, 102, 241, 0.3);
}

/* Group Card */
.t-group-card {
  background: var(--t-bg-card);
  border: 1px solid var(--t-border);
  border-radius: 12px;
  border-top: 3px solid #6366F1;
  padding: 18px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.t-group-card:hover { border-color: rgba(99, 102, 241, 0.4); }

.t-group-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.t-group-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.t-group-card-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.t-group-desc {
  font-size: 13px;
  color: var(--t-text-muted);
  line-height: 1.4;
}

.t-group-footer {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--t-text-secondary);
}

.t-group-footer span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.t-group-footer ion-icon { font-size: 14px; }

.t-group-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--t-hover);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.t-group-code:hover { background: rgba(99, 102, 241, 0.08); }
.t-group-code strong { font-family: 'SF Mono', monospace; letter-spacing: 1.5px; }
.t-group-code ion-icon { font-size: 14px; color: #6366F1; }

.t-group-actions {
  display: flex;
  gap: 8px;
}

/* Assignment List */
.t-assign-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.t-assign-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--t-bg-card);
  border: 1px solid var(--t-border);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s;
}

.t-assign-row:hover { border-color: rgba(99, 102, 241, 0.3); }
.t-assign-row.overdue { border-color: rgba(239, 68, 68, 0.3); }

.t-assign-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.t-assign-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.t-assign-title { font-size: 14px; font-weight: 600; }
.t-assign-title-lg { font-size: 16px; font-weight: 600; }

.t-assign-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.t-assign-group { font-size: 12px; color: var(--t-text-secondary); }

.t-group-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  color: white;
}

.t-assign-deadline {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  color: var(--t-text-secondary);
}

.t-assign-deadline.overdue { color: #f87171; font-weight: 600; }
.t-assign-deadline ion-icon { font-size: 12px; }

.t-assign-xp {
  font-size: 12px;
  font-weight: 600;
  color: #F59E0B;
}

.t-assign-row-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.t-mini-progress {
  width: 80px;
  height: 6px;
  background: var(--t-hover);
  border-radius: 3px;
  overflow: hidden;
}

.t-mini-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366F1, #8B5CF6);
  border-radius: 3px;
}

.t-assign-pct {
  font-size: 12px;
  font-weight: 600;
  color: var(--t-text-secondary);
  min-width: 32px;
  text-align: right;
}

/* Assignment Card Full */
.t-assign-card-full {
  padding: 18px;
  background: var(--t-bg-card);
  border: 1px solid var(--t-border);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s;
  display: block;
}

.t-assign-card-full:hover { border-color: rgba(99, 102, 241, 0.3); }
.t-assign-card-full.overdue { border-color: rgba(239, 68, 68, 0.3); }

.t-assign-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.t-status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  text-transform: capitalize;
}

.t-status-badge.active { background: rgba(16, 185, 129, 0.1); color: #10B981; }
.t-status-badge.draft { background: rgba(107, 114, 128, 0.1); color: #9CA3AF; }
.t-status-badge.completed { background: rgba(99, 102, 241, 0.1); color: #6366F1; }

.t-assign-progress-section { margin-top: 14px; }

.t-progress-bar-lg {
  height: 8px;
  background: var(--t-hover);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.t-progress-fill-lg {
  height: 100%;
  background: linear-gradient(90deg, #6366F1, #8B5CF6);
  border-radius: 4px;
  transition: width 0.3s;
}

.t-progress-stats {
  display: flex;
  gap: 14px;
  font-size: 11px;
}

.t-progress-done { color: #10B981; }
.t-progress-wip { color: #F59E0B; }
.t-progress-pending { color: var(--t-text-muted); }
.t-progress-acc { color: #6366F1; }

/* Buttons */
.t-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}

.t-btn-primary { background: #6366F1; color: white; }
.t-btn-primary:hover { background: #5558e8; }
.t-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.t-btn-outline { background: none; border: 1px solid var(--t-border); color: var(--t-text-secondary); }
.t-btn-outline:hover { border-color: #6366F1; color: #6366F1; }

.t-btn-danger { background: rgba(239, 68, 68, 0.1); color: #EF4444; border: 1px solid rgba(239, 68, 68, 0.2); }
.t-btn-danger:hover { background: rgba(239, 68, 68, 0.2); }

.t-btn-sm { padding: 5px 10px; font-size: 12px; }
.t-btn-lg { padding: 12px 24px; font-size: 15px; width: 100%; justify-content: center; }
.t-btn ion-icon { font-size: 14px; }

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

.t-empty-icon { font-size: 48px; margin-bottom: 8px; }
.t-empty-state h3 { font-size: 18px; color: var(--t-text); margin-bottom: 6px; }
.t-empty-state p { margin-bottom: 20px; }

/* Forms */
.t-form-card {
  background: var(--t-bg-card);
  border: 1px solid var(--t-border);
  border-radius: 14px;
  padding: 28px;
  max-width: 600px;
}

.t-form-group {
  margin-bottom: 18px;
}

.t-form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--t-text-secondary);
}

.t-form-group input,
.t-form-group textarea,
.t-form-group select {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--t-border);
  background: var(--t-bg);
  color: var(--t-text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}

.t-form-group input:focus,
.t-form-group textarea:focus,
.t-form-group select:focus {
  border-color: #6366F1;
}

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

.t-color-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.t-color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}

.t-color-swatch.active { border-color: white; box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.5); }
.t-color-swatch:hover { transform: scale(1.1); }

/* Deck Select */
.t-deck-select {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  padding: 4px;
}

.t-deck-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--t-bg);
  border: 1px solid var(--t-border);
  cursor: pointer;
  transition: all 0.15s;
}

.t-deck-option.selected { border-color: #6366F1; background: rgba(99, 102, 241, 0.05); }
.t-deck-option input { accent-color: #6366F1; }
.t-deck-option-name { font-size: 14px; flex: 1; }
.t-deck-option-count { font-size: 12px; color: var(--t-text-muted); }

/* Mobile Header Bar */
.t-mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--t-bg-card);
  border-bottom: 1px solid var(--t-border);
  z-index: 50;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}
.t-mobile-header .t-brand-icon { font-size: 22px; }
.t-mobile-header .t-brand-name { font-size: 17px; font-weight: 700; color: var(--t-text); }
.t-mobile-header .t-role-tag { font-size: 9px; }

.t-hamburger {
  background: none;
  border: none;
  color: var(--t-text);
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}

.t-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 90;
}
.t-overlay.visible { display: block; }

/* Toggle Switch */
.t-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  display: inline-block;
  flex-shrink: 0;
}
.t-toggle input { opacity: 0; width: 0; height: 0; }
.t-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #374151;
  border-radius: 24px;
  transition: 0.2s;
}
.t-toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}
.t-toggle input:checked + .t-toggle-slider { background: #6366F1; }
.t-toggle input:checked + .t-toggle-slider::before { transform: translateX(20px); }

/* Mobile Bottom Nav */
.t-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--t-bg-card);
  border-top: 1px solid var(--t-border);
  z-index: 50;
  justify-content: space-around;
  align-items: center;
  padding: 0 4px;
}
.t-bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--t-text-muted);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  text-decoration: none;
  font-family: inherit;
}
.t-bottom-nav-item ion-icon { font-size: 22px; }
.t-bottom-nav-item.active { color: #6366F1; }
.t-bottom-nav-item:hover { color: var(--t-text); }

/* ============ Light Theme Overrides ============ */
[data-theme="light"] .t-mobile-header { background: var(--t-bg-card); border-color: var(--t-border); }
[data-theme="light"] .t-mobile-header .t-brand-name { color: var(--t-text); }
[data-theme="light"] .t-hamburger { color: var(--t-text); }
[data-theme="light"] .t-bottom-nav { background: var(--t-bg-card); border-color: var(--t-border); }
[data-theme="light"] .t-bottom-nav-item:hover { color: var(--t-text); }
[data-theme="light"] .t-sidebar { background: var(--t-bg-card); border-color: var(--t-border); }
[data-theme="light"] .t-toggle-slider { background: #d1d5db; }

/* ============ Settings Styles ============ */
/* These styles are shared between teacher and student dashboards */
.t-settings-card {
  background: var(--t-bg-card, var(--s-bg-card, #16161e));
  border: 1px solid var(--t-border, var(--s-border, #2a2a3a));
  border-radius: 14px;
  padding: 24px;
}
.t-settings-account {
  display: flex;
  align-items: center;
  gap: 16px;
}
.t-settings-account-name {
  font-weight: 700;
  font-size: 16px;
  color: var(--t-text);
}
.t-settings-account-email {
  font-size: 13px;
  color: var(--t-text-muted);
}
.t-settings-account-role {
  font-size: 12px;
  color: #6366F1;
  font-weight: 600;
  margin-top: 2px;
}
.t-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--t-border, var(--s-border, #2a2a3a));
  gap: 16px;
}
.t-settings-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.t-settings-row:first-child {
  padding-top: 0;
}
.t-settings-label {
  font-weight: 600;
  font-size: 14px;
  color: var(--t-text, var(--s-text, #e5e7eb));
}
.t-settings-sublabel {
  font-size: 13px;
  color: var(--t-text-muted, var(--s-text-muted, #6b7280));
  margin-top: 2px;
}
.t-settings-input {
  width: 80px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--t-border, var(--s-border, #2a2a3a));
  background: var(--t-bg-input, var(--s-bg-input, #1a1a26));
  color: var(--t-text, var(--s-text, #e5e7eb));
  font-size: 14px;
  text-align: center;
}
.t-settings-select {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--t-border, var(--s-border, #2a2a3a));
  background: var(--t-bg-input, var(--s-bg-input, #1a1a26));
  color: var(--t-text, var(--s-text, #e5e7eb));
  font-size: 14px;
}
@media (max-width: 768px) {
  .t-settings-card { padding: 16px; }
  .t-settings-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .t-settings-row > *:last-child { align-self: flex-start; }
}

/* Responsive */
@media (max-width: 768px) {
  .t-dashboard { flex-direction: column; }
  
  .t-mobile-header { display: flex; }
  .t-bottom-nav { display: flex; }
  
  .t-sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    transition: left 0.3s ease;
    width: 260px;
    z-index: 100;
  }
  .t-sidebar.open { left: 0; }
  
  .t-main {
    margin-left: 0;
    padding-top: 68px;
    padding-bottom: 76px;
    min-height: 100vh;
    overflow-y: auto;
  }
  
  .t-content { padding: 16px; }
  
  .t-page-header h1 { font-size: 22px; }
  
  .t-stats-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .t-stat-card { padding: 14px 12px; }
  .t-stat-value { font-size: 22px; }
  
  .t-quick-actions { grid-template-columns: 1fr 1fr; gap: 10px; }
  .t-quick-action { padding: 16px 12px; }
  
  .t-card-grid { grid-template-columns: 1fr; gap: 12px; }
  
  .t-form-row { grid-template-columns: 1fr; }
  .t-form-card { padding: 16px; }
  
  .t-assign-row { flex-direction: column; gap: 10px; align-items: flex-start; }
  .t-assign-row-right { width: 100%; }
  .t-mini-progress { flex: 1; }
  
  .t-sidebar-footer { display: none; }
  .t-page-header { flex-direction: column; gap: 10px; }
  .t-page-header .t-btn { width: 100%; justify-content: center; }
}

/* ============================================
   Backward-compatible aliases for sub-pages
   (groups/[id], assignments/[id])
   ============================================ */
.teacher-loading { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 12px; min-height: 100vh; color: #64748b; font-size: 15px; }
.teacher-spinner { width: 28px; height: 28px; border: 3px solid #e5e7eb; border-top-color: #6366F1; border-radius: 50%; animation: t-spin 0.7s linear infinite; }
.teacher-container { display: flex; min-height: 100vh; background: var(--bg-primary, #f8f9fb); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
.teacher-sidebar { width: 260px; background: var(--sidebar-bg, #1a1a2e); color: #e2e8f0; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; overflow-y: auto; }
.teacher-sidebar-header { padding: 20px 18px 12px; }
.teacher-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; font-weight: 700; font-size: 20px; }
.teacher-logo-icon { font-size: 26px; }
.teacher-nav { padding: 4px 10px; }
.teacher-nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; font-size: 14px; color: #94a3b8; cursor: pointer; transition: all 0.15s; width: 100%; text-align: left; background: none; border: none; text-decoration: none; font-family: inherit; }
.teacher-nav-item:hover { background: rgba(255,255,255,0.06); color: #e2e8f0; }
.teacher-nav-item.active { background: rgba(99,102,241,0.15); color: #a5b4fc; font-weight: 600; }
.teacher-nav-item ion-icon { font-size: 18px; flex-shrink: 0; }
.teacher-nav-count { margin-left: auto; font-size: 11px; font-weight: 700; background: rgba(99,102,241,0.2); color: #a5b4fc; padding: 2px 7px; border-radius: 10px; min-width: 20px; text-align: center; }
.teacher-nav-divider { height: 1px; background: rgba(255,255,255,0.08); margin: 6px 18px; border: none; }
.teacher-main { flex: 1; margin-left: 260px; padding: 32px 28px; max-width: 1100px; }
.teacher-stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 24px; }
.teacher-stat-card { background: var(--card-bg, #fff); border: 1px solid var(--border, #e5e7eb); border-radius: 12px; padding: 16px 18px; text-align: center; }
.teacher-stat-value { font-size: 22px; font-weight: 800; color: var(--text-primary, #1e293b); }
.teacher-stat-label { font-size: 12px; color: #64748b; font-weight: 500; margin-top: 2px; }
.teacher-section { margin-bottom: 28px; }
.teacher-section h2 { font-size: 18px; font-weight: 700; color: var(--text-primary, #1e293b); margin: 0 0 16px; }
.teacher-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.teacher-section-header h2 { margin-bottom: 0; }
.teacher-subsection-title { font-size: 14px; font-weight: 600; color: #64748b; margin: 14px 0 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.teacher-btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; border: none; transition: all 0.15s; text-decoration: none; font-family: inherit; }
.teacher-btn-primary { background: #6366F1; color: #fff; }
.teacher-btn-primary:hover { background: #4F46E5; }
.teacher-btn-outline { background: none; border: 1px solid var(--border, #d1d5db); color: var(--text-primary, #374151); }
.teacher-btn-outline:hover { border-color: #6366F1; color: #6366F1; }
.teacher-btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 7px; }
.teacher-btn-icon { background: none; border: none; cursor: pointer; padding: 6px; border-radius: 6px; display: flex; align-items: center; font-size: 18px; }
.teacher-btn-danger { color: #ef4444; }
.teacher-btn-danger:hover { background: rgba(239,68,68,0.08); }
.teacher-empty-inline { background: var(--card-bg, #fff); border: 1px dashed var(--border, #d1d5db); border-radius: 10px; padding: 20px; text-align: center; color: #64748b; font-size: 14px; }
.teacher-empty-inline p { margin: 0; }
.teacher-empty-inline code { background: rgba(99,102,241,0.1); color: #6366F1; padding: 2px 6px; border-radius: 4px; font-weight: 600; }

/* Group Detail */
.teacher-group-header { background: var(--card-bg, #fff); border: 1px solid var(--border, #e5e7eb); border-radius: 12px; padding: 24px; margin-bottom: 24px; display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 16px; }
.teacher-group-header h1 { font-size: 24px; font-weight: 800; color: var(--text-primary, #1e293b); margin: 0 0 4px; }
.teacher-group-header p { font-size: 14px; color: #64748b; margin: 0; }
.teacher-join-code-large { display: flex; align-items: center; gap: 10px; }
.teacher-join-code-large span { font-size: 13px; color: #64748b; }
.teacher-join-code-large code { font-size: 18px; font-weight: 800; color: #6366F1; letter-spacing: 3px; background: rgba(99,102,241,0.08); padding: 6px 14px; border-radius: 8px; }

/* Member Cards */
.teacher-member-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.teacher-member-card { display: flex; align-items: center; gap: 12px; background: var(--card-bg, #fff); border: 1px solid var(--border, #e5e7eb); border-radius: 10px; padding: 12px 16px; }
.teacher-member-avatar, .teacher-member-avatar-sm { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, #6366F1, #8B5CF6); display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.teacher-member-avatar-sm { width: 28px; height: 28px; }
.teacher-member-avatar img, .teacher-member-avatar-sm img { width: 100%; height: 100%; object-fit: cover; }
.teacher-member-avatar span, .teacher-member-avatar-sm span { font-size: 14px; font-weight: 700; color: #fff; }
.teacher-member-avatar-sm span { font-size: 11px; }
.teacher-member-info { flex: 1; }
.teacher-member-name { font-size: 14px; font-weight: 600; color: var(--text-primary, #1e293b); display: block; }
.teacher-member-role { font-size: 12px; color: #6366F1; font-weight: 500; }
.teacher-member-stats { display: flex; gap: 12px; font-size: 12px; color: #64748b; margin-top: 2px; }
.teacher-member-inline { display: flex; align-items: center; gap: 8px; }

/* Assignment detail in sub-pages */
.teacher-assignment-hero { background: var(--card-bg, #fff); border: 1px solid var(--border, #e5e7eb); border-radius: 12px; padding: 24px; margin-bottom: 20px; }
.teacher-assignment-hero h1 { font-size: 24px; font-weight: 800; color: var(--text-primary, #1e293b); margin: 0 0 8px; }
.teacher-assignment-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; }
.teacher-group-tag { color: #fff; padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.teacher-deadline { display: flex; align-items: center; gap: 4px; color: #64748b; }
.teacher-deadline.overdue { color: #ef4444; font-weight: 600; }
.teacher-xp-badge { font-size: 13px; font-weight: 700; color: #f59e0b; }
.teacher-assignment-desc { font-size: 14px; color: #64748b; line-height: 1.5; margin: 0; }
.teacher-assignment-decks { display: flex; gap: 8px; flex-wrap: wrap; }
.teacher-deck-chip { display: inline-flex; align-items: center; gap: 4px; background: rgba(99,102,241,0.08); color: #6366F1; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 500; }
.teacher-deck-chip ion-icon { font-size: 14px; }
.teacher-assignment-detail { background: var(--card-bg, #fff); border: 1px solid var(--border, #e5e7eb); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.teacher-assignment-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.teacher-assignment-header h3 { font-size: 16px; font-weight: 700; color: var(--text-primary, #1e293b); margin: 0 0 4px; }
.teacher-assignment-summary { display: flex; gap: 16px; font-size: 12px; color: #64748b; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border, #f0f0f0); }

/* Progress Table */
.teacher-progress-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.teacher-progress-table th { text-align: left; padding: 10px 12px; border-bottom: 2px solid var(--border, #e5e7eb); font-weight: 600; color: #64748b; font-size: 12px; text-transform: uppercase; letter-spacing: 0.3px; }
.teacher-progress-table td { padding: 10px 12px; border-bottom: 1px solid var(--border, #f0f0f0); color: var(--text-primary, #374151); }
.teacher-progress-table tr.row-completed { background: rgba(16,185,129,0.04); }
.teacher-progress-table-full { font-size: 12px; }
.teacher-progress-table-full th, .teacher-progress-table-full td { padding: 8px 10px; }
.teacher-status-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; text-transform: capitalize; }
.teacher-status-badge.status-completed { background: rgba(16,185,129,0.1); color: #10B981; }
.teacher-status-badge.status-in_progress { background: rgba(99,102,241,0.1); color: #6366F1; }
.teacher-status-badge.status-pending { background: rgba(107,114,128,0.1); color: #6B7280; }
.teacher-status-badge.status-overdue { background: rgba(239,68,68,0.1); color: #EF4444; }
.teacher-mini-progress { display: flex; align-items: center; gap: 8px; }
.teacher-mini-bar { width: 60px; height: 5px; background: #f1f5f9; border-radius: 3px; overflow: hidden; }
.teacher-mini-bar div { height: 100%; background: linear-gradient(90deg, #6366F1, #a78bfa); border-radius: 3px; }
.text-green { color: #10B981; font-weight: 600; }
.text-yellow { color: #F59E0B; font-weight: 600; }
.text-red { color: #EF4444; font-weight: 600; }

/* Dark mode for sub-pages */
[data-theme="dark"] .teacher-container { --bg-primary: #0f172a; --card-bg: #1e293b; --border: #334155; --text-primary: #f1f5f9; }
[data-theme="dark"] .teacher-sidebar { background: #0c0c1d; }

/* Chart cards compatibility with teacher-container */
.teacher-container .t-chart-card {
  background: var(--card-bg, #fff);
  border-color: var(--border, #e5e7eb);
}
.teacher-container .t-bar-track {
  background: var(--bg-primary, #f3f4f6);
}
.teacher-container .t-bar-label,
.teacher-container .t-chart-title {
  color: var(--text-primary, #1e293b);
}
.teacher-container .t-bar-value {
  color: var(--text-primary, #1e293b);
}
.teacher-container .t-student-stat-card {
  background: var(--bg-primary, #f9fafb);
  border-color: var(--border, #e5e7eb);
}
.teacher-container .t-student-stat-name {
  color: var(--text-primary, #1e293b);
}
.teacher-container .t-student-metric-val {
  color: var(--text-primary, #1e293b);
}
.teacher-container .t-student-progress-bar {
  background: var(--border, #e5e7eb);
}
[data-theme="dark"] .teacher-container .t-chart-card {
  background: #1e293b;
  border-color: #334155;
}
[data-theme="dark"] .teacher-container .t-bar-track {
  background: #0f172a;
}
[data-theme="dark"] .teacher-container .t-bar-label,
[data-theme="dark"] .teacher-container .t-chart-title,
[data-theme="dark"] .teacher-container .t-bar-value,
[data-theme="dark"] .teacher-container .t-student-stat-name,
[data-theme="dark"] .teacher-container .t-student-metric-val {
  color: #f1f5f9;
}
[data-theme="dark"] .teacher-container .t-student-stat-card {
  background: #0f172a;
  border-color: #334155;
}
[data-theme="dark"] .teacher-container .t-student-progress-bar {
  background: #334155;
}

/* Mobile back button for sub-pages */
.teacher-mobile-back {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-primary, #f8f9fb);
  border-bottom: 1px solid var(--border, #e5e7eb);
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  z-index: 50;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary, #1e293b);
}
.teacher-mobile-back a {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: #6366F1;
  font-weight: 600;
  font-size: 14px;
}
[data-theme="dark"] .teacher-mobile-back {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}

/* Responsive for sub-pages */
@media (max-width: 768px) {
  .teacher-sidebar { display: none; }
  .teacher-mobile-back { display: flex; }
  .teacher-main { margin-left: 0; padding: 72px 16px 24px; }
  .teacher-group-header { flex-direction: column; }
  .teacher-join-code-large { flex-wrap: wrap; }
  .teacher-progress-table { font-size: 11px; display: block; overflow-x: auto; }
  .teacher-progress-table th, .teacher-progress-table td { padding: 6px 8px; white-space: nowrap; }
  .teacher-stats-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .teacher-stat-card { padding: 12px 10px; }
  .teacher-stat-value { font-size: 20px; }
  .teacher-stat-label { font-size: 11px; }
  .t-student-grid { grid-template-columns: 1fr; }
  .teacher-assignment-hero { padding: 16px; }
  .teacher-assignment-hero h1 { font-size: 18px; }
  .teacher-assignment-meta { gap: 8px; font-size: 12px; }
  .teacher-section h2 { font-size: 16px; }
  .teacher-assignment-detail { padding: 14px; }
  .teacher-assignment-detail h3 { font-size: 15px; }
  .teacher-nav-divider { margin: 8px 16px; border-color: #334155; }
  .teacher-subsection-title { font-size: 13px; }
  .teacher-member-card { padding: 10px 12px; }
  .teacher-section-header { flex-direction: column; gap: 10px; align-items: flex-start; }
  .teacher-assignment-hero { flex-direction: column; }
  .teacher-assignment-actions { width: 100%; }
  .teacher-assignment-actions .teacher-btn { flex: 1; justify-content: center; }
  .teacher-student-detail-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .teacher-inactive-banner { font-size: 13px; padding: 10px 12px; }
}

/* ===== STUDENT PROGRESS CARDS (mobile-friendly) ===== */
.teacher-progress-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.teacher-progress-card {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 16px;
}
.teacher-progress-card.card-completed {
  border-color: #10B981;
  background: rgba(16, 185, 129, 0.04);
}
.teacher-progress-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}
.teacher-progress-card-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.teacher-progress-card-bar .teacher-mini-bar {
  flex: 1;
  height: 8px;
  background: var(--border, #e5e7eb);
  border-radius: 4px;
  overflow: hidden;
}
.teacher-progress-card-bar .teacher-mini-bar div {
  height: 100%;
  background: #6366F1;
  border-radius: 4px;
  transition: width 0.4s ease;
}
.card-completed .teacher-progress-card-bar .teacher-mini-bar div {
  background: #10B981;
}
.teacher-progress-card-pct {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  min-width: 36px;
  text-align: right;
}
.teacher-progress-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.teacher-pcs {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 6px 0;
}
.teacher-pcs-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
}
.teacher-pcs-label {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-top: 2px;
}
.teacher-progress-card-footer {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border, #e5e7eb);
  font-size: 12px;
  color: #64748b;
}

/* Dark theme for progress cards */
[data-theme="dark"] .teacher-progress-card {
  background: #1e293b;
  border-color: #334155;
}
[data-theme="dark"] .teacher-progress-card.card-completed {
  background: rgba(16, 185, 129, 0.08);
  border-color: #10B981;
}
[data-theme="dark"] .teacher-progress-card-pct,
[data-theme="dark"] .teacher-pcs-val {
  color: #f1f5f9;
}
[data-theme="dark"] .teacher-pcs-label {
  color: #94a3b8;
}
[data-theme="dark"] .teacher-progress-card-footer {
  border-color: #334155;
  color: #94a3b8;
}
[data-theme="dark"] .teacher-progress-card-bar .teacher-mini-bar {
  background: #334155;
}

/* Assignment action buttons */
.teacher-assignment-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}
.teacher-assignment-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.teacher-btn-danger {
  background: #EF4444 !important;
  color: #fff !important;
  border: none !important;
}
.teacher-btn-danger:hover {
  background: #DC2626 !important;
}
.teacher-btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Inactive assignment banner */
.teacher-inactive-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 14px;
  color: #F59E0B;
  font-weight: 500;
}
.teacher-inactive-banner ion-icon {
  font-size: 18px;
  flex-shrink: 0;
}

/* Expandable student detail */
.teacher-progress-card.card-expanded {
  border-color: #6366F1;
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.3);
}
.teacher-student-detail {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border, #e5e7eb);
}
.teacher-student-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.teacher-sd-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.teacher-sd-label {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.teacher-sd-val {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #1e293b);
}
[data-theme="dark"] .teacher-student-detail {
  border-color: #334155;
}
[data-theme="dark"] .teacher-sd-val {
  color: #f1f5f9;
}
[data-theme="dark"] .teacher-sd-label {
  color: #94a3b8;
}

@media (max-width: 480px) {
  .teacher-progress-card-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
  }
  .teacher-pcs-val { font-size: 13px; }
  .teacher-pcs-label { font-size: 10px; }
  .teacher-stats-row { grid-template-columns: 1fr 1fr; }
}

/* ===== GROUP STATISTICS CHARTS ===== */

.t-chart-card {
  background: var(--t-bg-card, #16161e);
  border: 1px solid var(--t-border, #2a2a3a);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
}

.t-chart-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--t-text, #e5e7eb);
  margin: 0 0 16px 0;
}

.t-bar-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.t-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.t-bar-rank {
  width: 28px;
  min-width: 28px;
  text-align: center;
  font-size: 16px;
}

.t-bar-label {
  width: 120px;
  min-width: 120px;
  font-size: 13px;
  color: var(--t-text-secondary, #9ca3af);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.t-bar-track {
  flex: 1;
  height: 28px;
  background: var(--t-bg-input, #1a1a26);
  border-radius: 8px;
  overflow: hidden;
}

.t-bar-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 0.6s ease;
  min-width: 3px;
}

.t-bar-value {
  width: 60px;
  min-width: 60px;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: var(--t-text, #e5e7eb);
}

/* Student Progress Cards */
.t-student-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.t-student-stat-card {
  background: var(--t-bg-input, #1a1a26);
  border: 1px solid var(--t-border, #2a2a3a);
  border-radius: 12px;
  padding: 16px;
}

.t-student-stat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.t-student-stat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #6366F1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  overflow: hidden;
  flex-shrink: 0;
}
.t-student-stat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.t-student-stat-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--t-text, #e5e7eb);
}

.t-student-stat-xp {
  font-size: 12px;
  color: var(--t-text-muted, #6b7280);
  margin-top: 2px;
}

.t-student-stat-metrics {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

.t-student-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.t-student-metric-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--t-text, #e5e7eb);
}

.t-student-metric-label {
  font-size: 11px;
  color: var(--t-text-muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.t-student-progress-bar {
  height: 6px;
  background: var(--t-border, #2a2a3a);
  border-radius: 3px;
  overflow: hidden;
}

.t-student-progress-fill {
  height: 100%;
  background: #10B981;
  border-radius: 3px;
  transition: width 0.6s ease;
}

/* Light theme */
[data-theme="light"] .t-chart-card {
  background: #fff;
  border-color: #e5e7eb;
}
[data-theme="light"] .t-bar-track {
  background: #f3f4f6;
}
[data-theme="light"] .t-student-stat-card {
  background: #f9fafb;
  border-color: #e5e7eb;
}
[data-theme="light"] .t-student-progress-bar {
  background: #e5e7eb;
}

/* ===== STATISTICS TAB ===== */
.t-stats-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.t-stats-table-header { display: grid; grid-template-columns: 2fr repeat(5, 1fr); gap: 8px; padding: 10px 16px; background: var(--bg); border-radius: 10px; font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.t-stats-table-row { display: grid; grid-template-columns: 2fr repeat(5, 1fr); gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); align-items: center; font-size: 14px; transition: background 0.2s; }
.t-stats-table-row:hover { background: var(--bg); }
.t-stats-table-row:last-child { border-bottom: none; }
.t-stats-group-name { font-weight: 600; color: var(--text); }
.t-stats-student-name { font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.t-stats-student-avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, #8B5CF6, #3B82F6); display: flex; align-items: center; justify-content: center; font-size: 12px; color: #fff; font-weight: 700; flex-shrink: 0; overflow: hidden; }
.t-stats-student-avatar img { width: 100%; height: 100%; object-fit: cover; }
.t-pct { font-weight: 600; }
.t-accuracy-badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.t-accuracy-badge.good { background: #10B98120; color: #10B981; }
.t-accuracy-badge.mid { background: #F59E0B20; color: #F59E0B; }
.t-accuracy-badge.low { background: #EF444420; color: #EF4444; }

/* Leaderboard */
.t-leaderboard { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.t-leaderboard-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; transition: transform 0.2s, box-shadow 0.2s; }
.t-leaderboard-item:hover { transform: translateX(4px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.t-leaderboard-item.top-1 { border-color: #F59E0B60; background: linear-gradient(135deg, var(--card-bg), #F59E0B08); }
.t-leaderboard-item.top-2 { border-color: #94A3B860; background: linear-gradient(135deg, var(--card-bg), #94A3B808); }
.t-leaderboard-item.top-3 { border-color: #CD7F3260; background: linear-gradient(135deg, var(--card-bg), #CD7F3208); }
.t-lb-rank { font-size: 24px; width: 40px; text-align: center; flex-shrink: 0; }
.t-lb-avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #8B5CF6, #3B82F6); display: flex; align-items: center; justify-content: center; font-size: 16px; color: #fff; font-weight: 700; flex-shrink: 0; overflow: hidden; }
.t-lb-avatar img { width: 100%; height: 100%; object-fit: cover; }
.t-lb-info { flex: 1; min-width: 0; }
.t-lb-name { font-size: 15px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-lb-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.t-lb-xp { font-size: 18px; font-weight: 700; color: #F59E0B; white-space: nowrap; }

/* ===== PROFILE TAB ===== */
.t-profile-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 16px; padding: 24px; margin-bottom: 16px; }
.t-profile-header { display: flex; align-items: center; gap: 20px; margin-bottom: 24px; }
.t-profile-avatar-lg { width: 80px; height: 80px; border-radius: 50%; background: linear-gradient(135deg, #10B981, #3B82F6); display: flex; align-items: center; justify-content: center; font-size: 36px; color: #fff; font-weight: 700; flex-shrink: 0; overflow: hidden; }
.t-profile-avatar-lg img { width: 100%; height: 100%; object-fit: cover; }
.t-profile-header-info { flex: 1; }
.t-profile-header-info h2 { font-size: 24px; font-weight: 700; color: var(--text); margin: 0 0 4px; }
.t-profile-role { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; background: #10B98120; color: #10B981; margin-bottom: 8px; }
.t-profile-joined { font-size: 13px; color: var(--text-secondary); }

.t-profile-form { display: flex; flex-direction: column; gap: 16px; }
.t-profile-form label { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; display: block; }
.t-profile-form input,
.t-profile-form textarea { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; font-size: 14px; color: var(--text); transition: border-color 0.2s; font-family: inherit; }
.t-profile-form input:focus,
.t-profile-form textarea:focus { outline: none; border-color: #3B82F6; }
.t-profile-form textarea { min-height: 80px; resize: vertical; }
.t-char-count { font-size: 11px; color: var(--text-secondary); text-align: right; margin-top: 2px; }
.t-form-hint { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

/* Form row layout */
.t-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ===== MOBILE: Stats & Profile ===== */
@media (max-width: 768px) {
  .t-stats-table-header { grid-template-columns: 1.5fr repeat(3, 1fr); font-size: 11px; }
  .t-stats-table-header > span:nth-child(5),
  .t-stats-table-header > span:nth-child(6) { display: none; }
  .t-stats-table-row { grid-template-columns: 1.5fr repeat(3, 1fr); font-size: 13px; }
  .t-stats-table-row > span:nth-child(5),
  .t-stats-table-row > span:nth-child(6) { display: none; }
  .t-profile-header { flex-direction: column; text-align: center; }
  .t-profile-avatar-lg { width: 64px; height: 64px; font-size: 28px; }
  .t-lb-xp { font-size: 15px; }
  .t-form-row { grid-template-columns: 1fr; }
}

/* ===== LIGHT MODE ===== */
[data-theme="light"] .t-stats-table-header { background: #f9fafb; }
[data-theme="light"] .t-stats-table-row:hover { background: #f9fafb; }
[data-theme="light"] .t-leaderboard-item { background: #fff; border-color: #e5e7eb; }
[data-theme="light"] .t-leaderboard-item.top-1 { background: linear-gradient(135deg, #fff, #FFFBEB); border-color: #F59E0B60; }
[data-theme="light"] .t-leaderboard-item.top-2 { background: linear-gradient(135deg, #fff, #f4f5f7); border-color: #94A3B860; }
[data-theme="light"] .t-leaderboard-item.top-3 { background: linear-gradient(135deg, #fff, #FFF7ED); border-color: #CD7F3260; }
[data-theme="light"] .t-profile-card { background: #fff; border-color: #e5e7eb; }
[data-theme="light"] .t-profile-form input,
[data-theme="light"] .t-profile-form textarea { background: #f9fafb; border-color: #e5e7eb; }
