/* ============================================
   Student Dashboard — AnkiFlow
   Prefix: s-
   ============================================ */

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

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

/* Sidebar */
.s-sidebar {
  border-right: 1px solid var(--s-border);
  width: 260px;
  background: var(--s-sidebar-bg);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.s-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 12px;
}
.s-brand-icon {
  font-size: 26px;
}
.s-brand-name {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}
.s-role-tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: rgba(99,102,241,0.25);
  color: #a5b4fc;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

/* XP mini in sidebar */
.s-xp-sidebar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px 14px;
}
.s-level-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.s-level-num {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
}
.s-xp-info {
  flex: 1;
  min-width: 0;
}
.s-xp-total {
  font-size: 13px;
  font-weight: 600;
  color: #cbd5e1;
}
.s-xp-bar-mini {
  height: 5px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  margin-top: 4px;
  overflow: hidden;
}
.s-xp-bar-fill-mini {
  height: 100%;
  background: linear-gradient(90deg, #6366F1, #a78bfa);
  border-radius: 3px;
  transition: width 0.5s ease;
}
.s-streak-mini {
  font-size: 13px;
  font-weight: 700;
  color: #fbbf24;
  white-space: nowrap;
}

/* Nav */
.s-nav {
  padding: 4px 10px;
}
.s-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;
}
.s-nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: #e2e8f0;
}
.s-nav-item.active {
  background: rgba(99,102,241,0.15);
  color: #a5b4fc;
  font-weight: 600;
}
.s-nav-item ion-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.s-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;
}
.s-nav-count-alert {
  background: rgba(239,68,68,0.2);
  color: #fca5a5;
}
.s-nav-divider {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 6px 18px;
}

/* Sidebar Footer */
.s-sidebar-footer {
  margin-top: auto;
  padding: 14px 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 8px;
}
.s-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.s-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;
}
.s-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.s-user-avatar span {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}
.s-user-details {
  min-width: 0;
}
.s-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.s-user-email {
  font-size: 11px;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.s-logout-btn {
  background: none;
  border: none;
  color: #64748b;
  font-size: 18px;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.s-logout-btn:hover {
  color: #ef4444;
}

/* Main Area */
.s-main {
  flex: 1;
  margin-left: 260px;
  min-height: 100vh;
}
.s-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 28px;
}

/* Loading */
.s-loading,
.s-loading-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 100vh;
  color: #64748b;
  font-size: 15px;
}
.s-loading-content {
  min-height: 60vh;
}
.s-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #e5e7eb;
  border-top-color: #6366F1;
  border-radius: 50%;
  animation: s-spin 0.7s linear infinite;
}
@keyframes s-spin {
  to { transform: rotate(360deg); }
}

/* Page Header */
.s-page-header {
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
}
.s-page-header h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary, #1e293b);
  margin: 0;
}
.s-subtitle {
  font-size: 14px;
  color: #64748b;
  margin: 4px 0 0;
}

/* Stats Row */
.s-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.s-stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card-bg, #fff);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid var(--border, #e5e7eb);
}
.s-stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.s-stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary, #1e293b);
}
.s-stat-label {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

/* Alert */
.s-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 20px;
}
.s-alert-error {
  background: rgba(239,68,68,0.08);
  color: #dc2626;
  border: 1px solid rgba(239,68,68,0.15);
}
.s-alert ion-icon {
  font-size: 18px;
  flex-shrink: 0;
}

/* Quick Actions */
.s-quick-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.s-quick-action {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary, #1e293b);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  font-family: inherit;
}
.s-quick-action:hover {
  border-color: #6366F1;
  color: #6366F1;
  box-shadow: 0 2px 8px rgba(99,102,241,0.1);
}
.s-quick-action ion-icon {
  font-size: 18px;
}

/* Sections */
.s-section {
  margin-bottom: 28px;
}
.s-card {
  background: var(--bg-card, #1e1e2e);
  border: 1px solid var(--border-color, rgba(255,255,255,0.08));
  border-radius: 12px;
  transition: border-color 0.2s;
}
.s-card:hover {
  border-color: rgba(99, 102, 241, 0.3);
}
.s-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.s-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  margin: 0 0 14px;
}
.s-section-header .s-section-title {
  margin-bottom: 0;
}
.s-link-btn {
  background: none;
  border: none;
  color: #6366F1;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.s-link-btn:hover {
  text-decoration: underline;
}

/* Buttons */
.s-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;
}
.s-btn-primary {
  background: #6366F1;
  color: #fff;
}
.s-btn-primary:hover {
  background: #4F46E5;
}
.s-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.s-btn-outline {
  background: none;
  border: 1px solid var(--border, #d1d5db);
  color: var(--text-primary, #374151);
}
.s-btn-outline:hover {
  border-color: #6366F1;
  color: #6366F1;
}
.s-btn-sm {
  padding: 7px 14px;
  font-size: 13px;
  border-radius: 7px;
}

/* Assignment Cards */
.s-assign-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.s-assign-card {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 16px 18px;
  transition: box-shadow 0.15s;
}
.s-assign-card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.s-assign-card.overdue {
  border-left: 3px solid #ef4444;
}
.s-assign-card.completed {
  border-left: 3px solid #10B981;
  opacity: 0.85;
}
.s-assign-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}
.s-assign-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  margin-bottom: 4px;
}
.s-assign-desc {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 6px;
}
.s-assign-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
}
.s-group-chip {
  color: #fff;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}
.s-deadline {
  display: flex;
  align-items: center;
  gap: 3px;
  color: #64748b;
}
.s-deadline.overdue {
  color: #ef4444;
  font-weight: 600;
}
.s-xp-tag {
  color: #f59e0b;
  font-weight: 600;
}
.s-status {
  font-weight: 600;
  color: #64748b;
}
.s-status.completed { color: #10B981; }
.s-status.in_progress { color: #6366F1; }

/* Progress Bars */
.s-assign-progress {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border, #f0f0f0);
}
.s-progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #64748b;
  margin-bottom: 6px;
}
.s-progress-bar {
  height: 6px;
  background: #f1f5f9;
  border-radius: 4px;
  overflow: hidden;
}
.s-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366F1, #a78bfa);
  border-radius: 4px;
  transition: width 0.4s ease;
}
.s-progress-extra {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: #94a3b8;
  margin-top: 6px;
}

/* Join Group Card */
.s-join-card {
  background: var(--card-bg, #fff);
  border: 2px dashed var(--border, #d1d5db);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 24px;
  text-align: center;
}
.s-join-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  margin: 0 0 4px;
}
.s-join-desc {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 16px;
}
.s-join-form {
  display: flex;
  gap: 10px;
  justify-content: center;
  max-width: 360px;
  margin: 0 auto;
}
.s-join-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  text-align: center;
  text-transform: uppercase;
  font-family: 'Courier New', monospace;
  background: var(--input-bg, #f8f9fa);
  color: var(--text-primary, #1e293b);
}
.s-join-input::placeholder {
  font-weight: 400;
  letter-spacing: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #94a3b8;
}
.s-join-input:focus {
  outline: none;
  border-color: #6366F1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.s-join-msg {
  font-size: 13px;
  margin-top: 10px;
  font-weight: 500;
}
.s-join-error { color: #ef4444; }
.s-join-success { color: #10B981; }

/* Group Cards */
.s-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.s-group-card {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 18px;
  border-top: 3px solid #6366F1;
  transition: box-shadow 0.15s;
}
.s-group-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.s-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.s-group-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.s-group-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  margin: 0;
}
.s-group-desc {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 10px;
  line-height: 1.4;
}
.s-group-stats {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: #64748b;
}
.s-group-stats span {
  display: flex;
  align-items: center;
  gap: 4px;
}
.s-group-stats ion-icon {
  font-size: 14px;
}
.s-group-joined {
  font-size: 11px;
  color: #94a3b8;
}
.s-group-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #ffffff08;
}
.s-btn-danger {
  background: transparent !important;
  color: #EF4444 !important;
  border: 1px solid #EF444430 !important;
}
.s-btn-danger:hover {
  background: #EF444420 !important;
  border-color: #EF4444 !important;
}

/* Level Card (Progress Tab) */
.s-level-card {
  display: flex;
  align-items: center;
  gap: 24px;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  border-radius: 16px;
  padding: 28px 32px;
  margin-bottom: 24px;
  color: #fff;
}
.s-level-circle-lg {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 3px solid rgba(255,255,255,0.3);
}
.s-level-num-lg {
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}
.s-level-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  opacity: 0.8;
}
.s-level-details {
  flex: 1;
}
.s-level-details h2 {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 10px;
}
.s-xp-bar-lg-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.s-xp-bar-lg {
  flex: 1;
  height: 10px;
  background: rgba(255,255,255,0.2);
  border-radius: 6px;
  overflow: hidden;
}
.s-xp-bar-fill-lg {
  height: 100%;
  background: #fff;
  border-radius: 6px;
  transition: width 0.5s ease;
}
.s-xp-bar-label {
  font-size: 13px;
  font-weight: 500;
  opacity: 0.85;
  white-space: nowrap;
}

/* XP Stats Grid */
.s-xp-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.s-xp-stat-card {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 18px;
  text-align: center;
}
.s-xp-stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary, #1e293b);
}
.s-xp-stat-label {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}

/* How to Earn XP */
.s-earn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.s-earn-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 14px 16px;
}
.s-earn-icon {
  font-size: 24px;
  flex-shrink: 0;
}
.s-earn-item div {
  display: flex;
  flex-direction: column;
}
.s-earn-item strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #1e293b);
}
.s-earn-item span {
  font-size: 12px;
  color: #64748b;
}

/* Activity List */
.s-activity-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.s-activity-item {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border, #f0f0f0);
  font-size: 13px;
}
.s-activity-item:last-child {
  border-bottom: none;
}
.s-activity-type {
  flex: 1;
  color: var(--text-primary, #374151);
  text-transform: capitalize;
}
.s-activity-xp {
  font-weight: 700;
  color: #6366F1;
  margin-right: 16px;
}
.s-activity-time {
  color: #94a3b8;
  font-size: 12px;
}

/* Notifications */
.s-notif-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.s-notif-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card-bg, #fff);
  border-bottom: 1px solid var(--border, #f0f0f0);
  transition: background 0.15s;
  position: relative;
}
.s-notif-item:first-child {
  border-radius: 12px 12px 0 0;
}
.s-notif-item:last-child {
  border-radius: 0 0 12px 12px;
  border-bottom: none;
}
.s-notif-item:only-child {
  border-radius: 12px;
}
.s-notif-item.unread {
  background: rgba(99,102,241,0.04);
}
.s-notif-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}
.s-notif-body {
  flex: 1;
  min-width: 0;
}
.s-notif-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #1e293b);
}
.s-notif-msg {
  font-size: 13px;
  color: #64748b;
  margin-top: 2px;
  line-height: 1.4;
}
.s-notif-time {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
}
.s-notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6366F1;
  flex-shrink: 0;
  margin-top: 6px;
}

/* Empty State */
.s-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #64748b;
}
.s-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.s-empty-state h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary, #374151);
  margin: 0 0 8px;
}
.s-empty-state p {
  font-size: 14px;
  margin: 0 0 20px;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

/* ============ Dark Mode ============ */
[data-theme="dark"] .s-dashboard {
  --bg-primary: #0f172a;
  --card-bg: #1e293b;
  --border: #334155;
  --text-primary: #f1f5f9;
  --input-bg: #1e293b;
}
[data-theme="dark"] .s-sidebar {
  border-right: 1px solid var(--s-border);
  background: #0c0c1d;
}
[data-theme="dark"] .s-join-input {
  border-color: #475569;
  color: #f1f5f9;
}

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

.s-hamburger {
  background: none;
  border: none;
  color: #e2e8f0;
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}

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

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

/* ============ Light Theme Overrides ============ */
[data-theme="light"] .s-sidebar { background: var(--s-sidebar-bg); border-right: 1px solid var(--s-border); }
[data-theme="light"] .s-sidebar,
[data-theme="light"] .s-nav-item { color: var(--s-text-secondary); }
[data-theme="light"] .s-brand-name { color: var(--s-text); }
[data-theme="light"] .s-nav-item:hover { background: var(--s-hover); color: var(--s-text); }
[data-theme="light"] .s-nav-item.active { background: rgba(99,102,241,0.1); color: #6366F1; }
[data-theme="light"] .s-nav-divider { background: var(--s-border); }
[data-theme="light"] .s-sidebar-footer { border-top-color: var(--s-border); }
[data-theme="light"] .s-user-name { color: var(--s-text); }
[data-theme="light"] .s-user-email { color: var(--s-text-muted); }
[data-theme="light"] .s-xp-total { color: var(--s-text-secondary); }
[data-theme="light"] .s-xp-bar-mini { background: #e5e7eb; }
[data-theme="light"] .s-mobile-header { background: var(--s-bg-card); border-color: var(--s-border); }
[data-theme="light"] .s-mobile-header .s-brand-name { color: var(--s-text); }
[data-theme="light"] .s-hamburger { color: var(--s-text); }
[data-theme="light"] .s-bottom-nav { background: var(--s-bg-card); border-color: var(--s-border); }
[data-theme="light"] .s-bottom-nav-item:hover { color: var(--s-text); }
[data-theme="light"] .s-group-footer { border-top-color: var(--s-border); }

/* ============ Responsive ============ */
@media (max-width: 768px) {
  .s-dashboard { flex-direction: column; }
  
  .s-mobile-header { display: flex; }
  .s-bottom-nav { display: flex; }
  
  .s-sidebar {
  border-right: 1px solid var(--s-border);
    left: -280px;
    transition: left 0.3s ease;
  }
  .s-sidebar.open { left: 0; }
  
  .s-main {
    margin-left: 0;
    padding-top: 68px;
    padding-bottom: 76px;
    min-height: 100vh;
    overflow-y: auto;
  }
  .s-content {
    padding: 16px;
  }
  .s-page-header h1 { font-size: 22px; }
  .s-stats-row {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .s-level-card {
    flex-direction: column;
    text-align: center;
    padding: 24px 20px;
  }
  .s-xp-bar-lg-wrap {
    flex-direction: column;
    gap: 6px;
  }
  .s-join-form {
    flex-direction: column;
  }
  .s-assign-top {
    flex-direction: column;
    gap: 10px;
  }
  .s-quick-actions {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .s-card-grid { grid-template-columns: 1fr; }
  .s-sidebar-footer { display: none; }
  .s-page-header { flex-direction: column; gap: 10px; }
  .s-earn-grid { grid-template-columns: 1fr; }
  .s-xp-stats-grid { grid-template-columns: 1fr 1fr; }
  .s-stats-grid-4 { grid-template-columns: 1fr 1fr; }
}

/* ===== STATISTICS STYLES ===== */

.s-stats-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.s-stat-card-mini {
  background: var(--s-bg-card, #16161e);
  border: 1px solid var(--s-border, #2a2a3a);
  border-radius: 14px;
  padding: 16px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.s-stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.s-stat-value-sm {
  font-size: 24px;
  font-weight: 700;
  color: var(--s-text, #e5e7eb);
}

.s-stat-label-sm {
  font-size: 12px;
  color: var(--s-text-muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

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

.s-chart-empty {
  text-align: center;
  padding: 24px;
  color: var(--s-text-muted, #6b7280);
  font-size: 14px;
}

/* Bar Chart */
.s-bar-chart {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

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

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

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

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

/* Groups Stats */
.s-groups-stats {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.s-group-stat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--s-bg-input, #1a1a26);
  border-radius: 10px;
}

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

.s-group-stat-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--s-text, #e5e7eb);
  flex: 1;
}

.s-group-stat-meta {
  font-size: 12px;
  color: var(--s-text-muted, #6b7280);
}

/* Light theme for statistics */
[data-theme="light"] .s-chart-card {
  background: #fff;
  border-color: #e5e7eb;
}
[data-theme="light"] .s-stat-card-mini {
  background: #fff;
  border-color: #e5e7eb;
}
[data-theme="light"] .s-bar-track {
  background: #f3f4f6;
}
[data-theme="light"] .s-group-stat-row {
  background: #f9fafb;
}

/* ========= Complete Assignment Button ========= */
.s-assign-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
.s-btn-success {
  background: #10B981 !important;
  color: #fff !important;
  border: none !important;
  font-weight: 600;
}
.s-btn-success:hover {
  background: #059669 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}
.s-btn-success:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.s-btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== ENHANCED STATISTICS ===== */
.s-xp-bar-lg-wrap { flex: 1; }
.s-xp-bar-lg { height: 10px; background: var(--border); border-radius: 5px; overflow: hidden; }
.s-xp-bar-fill-lg { height: 100%; background: linear-gradient(90deg, #8B5CF6, #3B82F6); border-radius: 5px; transition: width 0.4s; }
.s-xp-bar-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; display: block; }
.s-today-xp { display: inline-block; background: #10B98120; color: #10B981; padding: 2px 10px; border-radius: 20px; font-size: 13px; font-weight: 600; margin-top: 8px; }

.s-stats-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.s-stat-card-mini { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 16px 12px; text-align: center; }
.s-stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin: 0 auto 8px; font-size: 20px; }
.s-stat-value-sm { font-size: 24px; font-weight: 700; color: var(--text); }
.s-stat-label-sm { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }

/* Study Summary */
.s-summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.s-summary-item { text-align: center; padding: 12px; background: var(--bg); border-radius: 10px; }
.s-summary-val { display: block; font-size: 22px; font-weight: 700; color: var(--text); }
.s-summary-label { font-size: 12px; color: var(--text-secondary); margin-top: 2px; display: block; }

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

.s-profile-form { display: flex; flex-direction: column; gap: 16px; }
.s-profile-form label { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; display: block; }
.s-profile-form input,
.s-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; }
.s-profile-form input:focus,
.s-profile-form textarea:focus { outline: none; border-color: #3B82F6; }
.s-profile-form textarea { min-height: 80px; resize: vertical; }
.s-char-count { font-size: 11px; color: var(--text-secondary); text-align: right; margin-top: 2px; }
.s-form-hint { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

/* Form layout */
.s-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.s-form-group { display: flex; flex-direction: column; }
.s-form-group label { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.s-form-group input,
.s-form-group 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; }
.s-form-group input:focus,
.s-form-group textarea:focus { outline: none; border-color: #3B82F6; }
.s-form-group textarea { min-height: 80px; resize: vertical; }

/* Achievements Grid */
.s-achievements-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 16px; }
.s-achievement { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 16px 8px; text-align: center; transition: transform 0.2s, box-shadow 0.2s; }
.s-achievement:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.s-achievement.locked { opacity: 0.4; filter: grayscale(0.8); }
.s-achievement.unlocked { border-color: #F59E0B40; background: linear-gradient(135deg, var(--card-bg), #F59E0B08); }
.s-ach-icon { font-size: 32px; margin-bottom: 6px; display: block; }
.s-achievement strong { font-size: 12px; color: var(--text); display: block; margin-bottom: 2px; }
.s-achievement span:last-child { font-size: 10px; color: var(--text-secondary); display: block; }

/* ===== MOBILE: Stats & Profile ===== */
@media (max-width: 640px) {
  .s-stats-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .s-summary-grid { grid-template-columns: repeat(2, 1fr); }
  .s-achievements-grid { grid-template-columns: repeat(2, 1fr); }
  .s-profile-header { flex-direction: column; text-align: center; }
  .s-profile-badges { justify-content: center; }
  .s-profile-avatar-lg { width: 64px; height: 64px; font-size: 28px; }
  .s-form-row { grid-template-columns: 1fr; }
}

/* ===== LIGHT MODE ===== */
[data-theme="light"] .s-stat-card-mini { background: #fff; border-color: #e5e7eb; }
[data-theme="light"] .s-summary-item { background: #f9fafb; }
[data-theme="light"] .s-profile-card { background: #fff; border-color: #e5e7eb; }
[data-theme="light"] .s-achievement { background: #fff; border-color: #e5e7eb; }
[data-theme="light"] .s-achievement.unlocked { background: linear-gradient(135deg, #fff, #FFFBEB); border-color: #F59E0B40; }
[data-theme="light"] .s-profile-form input,
[data-theme="light"] .s-profile-form textarea { background: #f9fafb; border-color: #e5e7eb; }
