/* ============================================
   EDUPLATFORM - Modern UI Stylesheet
   ============================================ */

:root {
  --primary-50:  #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-400: #60a5fa;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;
  --primary-900: #1e3a8a;

  --success:       #10b981;
  --success-light: #d1fae5;
  --warning:       #f59e0b;
  --warning-light: #fef3c7;
  --danger:        #ef4444;
  --danger-light:  #fee2e2;
  --info:          #06b6d4;
  --info-light:    #cffafe;

  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  --bg-primary:   #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary:  #f1f5f9;

  --border-light:  #e2e8f0;
  --border-medium: #cbd5e1;

  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,.1), 0 10px 10px -5px rgba(0,0,0,.04);

  --radius-sm:   .25rem;
  --radius-md:   .5rem;
  --radius-lg:   .75rem;
  --radius-xl:   1rem;
  --radius-full: 9999px;

  --transition-fast: 150ms cubic-bezier(.4,0,.2,1);
  --transition-base: 300ms cubic-bezier(.4,0,.2,1);
  --transition-slow: 500ms cubic-bezier(.4,0,.2,1);
}

/* ============================================
   RESET
   ============================================ */

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--gray-900);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;   /* previene scroll horizontal sin cortar contenido vertical */
}

/* Normalizar headings — Bootstrap los sobreescribe con line-height: 1.2 */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
  margin-top: 0;
  font-weight: 600;
  color: var(--gray-900);
}

p { margin-top: 0; margin-bottom: .5rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--primary-600); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--primary-700); }

/* ============================================
   LAYOUT PRINCIPAL
   ============================================ */

.app-container {
  display: flex;
  flex-direction: column;   /* ← columna: header arriba, footer abajo */
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: linear-gradient(180deg, var(--primary-900) 0%, var(--primary-800) 100%);
  color: white;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: var(--shadow-xl);
  transition: transform var(--transition-base);
}

.sidebar-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding-bottom: 2rem;
}

.sidebar-menu {
  padding: 1.5rem 1rem;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: .875rem 1rem;
  color: var(--primary-100);
  text-decoration: none;
  border-radius: var(--radius-md);
  margin-bottom: .5rem;
  transition: all var(--transition-fast);
  font-weight: 500;
  font-size: .9375rem;
  line-height: 1.4;   /* ← asegura texto completo */
  cursor: pointer;
}

.nav-link:hover {
  background: rgba(255,255,255,.1);
  color: white;
  transform: translateX(4px);
  text-decoration: none;
}

.nav-link:active {
  background: var(--primary-600);
  color: white;
}

.nav-link > a {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  width: 100%;
}

.nav-link > a:hover { text-decoration: none; color: inherit; }

/* Main Content */
.main-content {
  margin-left: 280px;     /* espacio para sidebar fijo */
  flex: 1;
  padding: 2rem;
  min-height: 100vh;      /* asegura que el contenido siempre tiene altura suficiente */
  display: flex;
  flex-direction: column;
}

.main-header {
  background: var(--bg-secondary);
  padding: 2rem;
  border-radius: var(--radius-xl);
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  overflow: visible;      /* nunca cortar el contenido del header */
}

/* Gradient text solo en el título principal — no heredar a hijos */
.app-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: .5rem;
  display: inline-block;  /* necesario para que background-clip funcione */
  background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-800) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  /* Evitar que el efecto se herede */
  isolation: isolate;
}

/* Restablecer text-fill para TODOS los hijos del header */
.main-header * { -webkit-text-fill-color: initial; }
.main-header .app-title { -webkit-text-fill-color: transparent; }

.app-subtitle {
  color: var(--gray-600);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
}

.page-content {
  flex: 1;
  animation: fadeIn .4s ease-out;
}

/* ============================================
   PAGE CONTAINERS — usados en todas las páginas
   ============================================ */

.page-container {
  padding: 0;              /* padding lo da main-content */
  overflow: visible;
}

.page-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.page-title {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.3;
  margin-bottom: .25rem;
}

.page-subtitle {
  font-size: 1rem;
  color: var(--gray-500);
  line-height: 1.5;
  margin: 0;
}

/* ============================================
   CARDS
   ============================================ */

.card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
  margin-bottom: 1.5rem;
  overflow: visible;       /* nunca cortar contenido de cards */
}

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

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-800);
  line-height: 1.4;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* ============================================
   STAT CARDS
   ============================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  color: white;
  box-shadow: var(--shadow-lg);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  overflow: visible;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.stat-card.bg-success  { background: linear-gradient(135deg, var(--success) 0%, #059669 100%); }
.stat-card.bg-warning  { background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%); }
.stat-card.bg-info     { background: linear-gradient(135deg, var(--info) 0%, #0891b2 100%); }
.stat-card.bg-primary  { background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-800) 100%); }
.stat-card.bg-danger   { background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%); }

/* Estructura interna de stat-card */
.stat-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  font-size: 2.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.stat-content {
  flex: 1;
  min-width: 0;       /* permite que el texto se ajuste */
}

.stat-value {
  font-size: 2rem !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  margin: 0 0 .25rem 0 !important;
  color: white !important;
  -webkit-text-fill-color: white !important;  /* anular herencia de gradient text */
  white-space: nowrap;
  overflow: visible;
}

.stat-label {
  font-size: .875rem !important;
  font-weight: 500 !important;
  line-height: 1.4 !important;
  margin: 0 !important;
  color: rgba(255,255,255,.9) !important;
  -webkit-text-fill-color: rgba(255,255,255,.9) !important;
}

.stat-card-title {
  font-size: .875rem;
  font-weight: 500;
  opacity: .9;
  margin-bottom: .5rem;
  line-height: 1.4;
  color: white;
}

/* Headings genéricos dentro de stat-card */
.stat-card h2,
.stat-card h3 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin: .25rem 0;
  color: white;
  -webkit-text-fill-color: white;
}

/* ============================================
   BOTONES
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .75rem 1.5rem;
  font-size: .9375rem;
  font-weight: 500;
  line-height: 1.4;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary  {
  background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
  color: white;
  box-shadow: var(--shadow-md);
}
.btn-primary:hover  {
  background: linear-gradient(135deg, var(--primary-700) 0%, var(--primary-800) 100%);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  color: white;
}

.btn-success { background: linear-gradient(135deg, var(--success) 0%, #059669 100%); color: white; }
.btn-danger  { background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);  color: white; }
.btn-warning { background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%); color: white; }

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary-600);
  color: var(--primary-600);
}
.btn-outline:hover { background: var(--primary-50); }

.btn-secondary {
  background: var(--gray-200);
  color: var(--gray-700);
}
.btn-secondary:hover { background: var(--gray-300); }

.btn-block  { width: 100%; }
.btn-small  { padding: .375rem .875rem; font-size: .8125rem; }
.btn-large  { padding: 1rem 2rem; font-size: 1rem; }

/* ============================================
   INPUTS
   ============================================ */

.input, .textarea {
  width: 100%;
  padding: .75rem 1rem;
  font-size: .9375rem;
  line-height: normal;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--gray-900);
  transition: all var(--transition-fast);
  font-family: inherit;
}

.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px var(--primary-100);
}

.input::placeholder, .textarea::placeholder { color: var(--gray-400); }

/* ============================================
   TABS
   ============================================ */

.tab {
  padding: .75rem 1.5rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-weight: 500;
  color: var(--gray-600);
  border: none;
  line-height: 1.4;
}

.tab:hover { background: var(--gray-200); }

.tab--selected {
  background: var(--bg-secondary);
  color: var(--primary-700);
  border-bottom: 2px solid var(--bg-secondary);
}

.tab-content {
  padding: 1.5rem 0;
  overflow: visible;
}

/* ============================================
   LESSON VIEW — clases específicas
   ============================================ */

.lesson-tabs  { margin-bottom: 0; }
.lesson-meta  { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: .5rem; }
.meta-item    { font-size: .875rem; color: var(--gray-500); line-height: 1.4; }

.lesson-content {
  line-height: 1.8;
  color: var(--gray-800);
  font-size: 1rem;
  overflow: visible;
}

.lesson-content h1,
.lesson-content h2,
.lesson-content h3 { margin: 1.5rem 0 .75rem; line-height: 1.4; }

.lesson-content pre {
  background: var(--gray-900);
  color: #e2e8f0;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: .875rem;
  line-height: 1.6;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  color: var(--primary-600);
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: .75rem;
  line-height: 1.4;
}
.back-link:hover { color: var(--primary-800); text-decoration: none; }

/* Progress card (lesson sidebar) */
.progress-card   { padding: .5rem 0; }
.progress-row    { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.progress-label  { font-size: .875rem; color: var(--gray-500); line-height: 1.4; }
.progress-value  { font-size: .875rem; font-weight: 600; color: var(--gray-800); line-height: 1.4; }
.progress-details { margin-top: .75rem; }

/* Exercises */
.exercises-grid  { display: flex; flex-direction: column; gap: 1rem; }
.exercise-container { }
.exercise-card   {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  background: var(--bg-secondary);
  transition: box-shadow var(--transition-fast);
  overflow: visible;
}
.exercise-card:hover { box-shadow: var(--shadow-md); }
.exercise-card-header {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: .75rem;
}
.exercise-icon        { font-size: 1.5rem; line-height: 1; flex-shrink: 0; }
.exercise-header      { flex: 1; }
.exercise-order       { font-size: .75rem; color: var(--gray-500); line-height: 1.4; display: block; }
.exercise-title       { font-size: 1rem; font-weight: 600; color: var(--gray-800); line-height: 1.3; margin: .125rem 0 0; }
.exercise-description { font-size: .875rem; color: var(--gray-600); line-height: 1.5; margin-bottom: .75rem; }
.exercise-meta-container { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.exercise-meta   { display: flex; align-items: center; gap: .25rem; }
.meta-label      { font-size: .75rem; color: var(--gray-500); line-height: 1.4; }
.difficulty-stars { font-size: .875rem; line-height: 1.4; }
.points-badge    { font-size: .75rem; font-weight: 600; color: var(--primary-700); background: var(--primary-50); padding: 2px 8px; border-radius: var(--radius-full); line-height: 1.4; }
.type-badge      { font-size: .75rem; color: var(--gray-600); background: var(--gray-100); padding: 2px 8px; border-radius: var(--radius-full); line-height: 1.4; }

/* Navigation card */
.navigation-card { }
.nav-btn {
  display: inline-flex;
  align-items: center;
  padding: .5rem 1rem;
  background: var(--primary-50);
  color: var(--primary-700);
  border-radius: var(--radius-md);
  font-size: .875rem;
  font-weight: 500;
  line-height: 1.4;
  transition: all var(--transition-fast);
  text-decoration: none;
}
.nav-btn:hover { background: var(--primary-100); text-decoration: none; }
.nav-btn-next  { background: var(--primary-600); color: white; }
.nav-btn-next:hover { background: var(--primary-700); color: white; }
.nav-info      { font-size: .875rem; color: var(--gray-500); line-height: 1.4; margin: 0; }
.nav-info-container { margin-top: .5rem; }

/* Resources */
.resources-card  { }
.resources-list  { list-style: none; padding: 0; margin: 0; }
.resource-item   { margin-bottom: .5rem; line-height: 1.5; }
.resource-link   { font-size: .875rem; color: var(--primary-600); }
.resource-link:hover { color: var(--primary-800); }

/* Actions card */
.actions-card    { display: flex; flex-direction: column; gap: .75rem; }

/* ============================================
   COLUMN LAYOUTS
   ============================================ */

.two-columns {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;   /* ← no estirar columnas a igual altura (evita overflow oculto) */
}

.column--main    { width: 65%; min-width: 0; }
.column--sidebar { width: 35%; min-width: 0; }

.column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 0;
}

@media (max-width: 1024px) {
  .two-columns    { flex-direction: column; }
  .column--main,
  .column--sidebar,
  .column         { width: 100% !important; }
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .5; }
}

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

.loading-spinner {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary-600);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* ============================================
   PROGRESS BARS (solo para barras, nunca texto)
   ============================================ */

.progress-container {
  width: 100%;
  height: 8px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--transition-base);
  /* sin font-size ni text dentro — overflow:hidden es seguro aquí */
}

.progress-bar--success { background: linear-gradient(90deg, var(--success) 0%, #059669 100%); }
.progress-bar--warning { background: linear-gradient(90deg, var(--warning) 0%, #d97706 100%); }
.progress-bar--danger  { background: linear-gradient(90deg, var(--danger) 0%, #dc2626 100%); }
.progress-bar--primary { background: linear-gradient(90deg, var(--primary-500) 0%, var(--primary-700) 100%); }

/* ============================================
   NOTIFICATIONS
   ============================================ */

.notification {
  padding: 15px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;   /* alinear arriba para textos largos */
  gap: 10px;
  animation: slideIn .3s ease-out;
  overflow: visible;
}

.notification__icon    { font-size: 20px; flex-shrink: 0; line-height: 1.4; }
.notification__message { font-size: 14px; font-weight: 500; flex: 1; line-height: 1.5; }

.notification--success { background-color: var(--success-light); border-left: 4px solid var(--success); color: #065f46; }
.notification--error   { background-color: var(--danger-light);  border-left: 4px solid var(--danger);  color: #991b1b; }
.notification--warning { background-color: var(--warning-light); border-left: 4px solid var(--warning); color: #92400e; }
.notification--info    { background-color: var(--info-light);    border-left: 4px solid var(--info);    color: #0e7490; }

/* ============================================
   LEADERBOARD
   ============================================ */

.leaderboard-container { padding: 1rem; }

.leaderboard-header {
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  color: var(--gray-500);
  letter-spacing: .05em;
  flex: 1;
  line-height: 1.4;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  border: 1px solid var(--border-light);
  transition: all var(--transition-fast);
  min-height: 0;
  overflow: visible;
}

.leaderboard-row.header-row {
  background: var(--gray-50);
  border: none;
  margin-bottom: 12px;
  padding: 12px;
}
.leaderboard-row.header-row:hover { transform: none; box-shadow: none; }

.leaderboard-cell            { flex: 1; font-size: 14px; line-height: 1.5; }
.leaderboard-cell.position-cell { flex: 0 0 60px; text-align: center; }
.leaderboard-cell.student-cell  { flex: 2; }
.leaderboard-cell.points-cell   { flex: 0 0 120px; text-align: right; }

.leaderboard-row:hover { transform: translateX(4px); box-shadow: var(--shadow-sm); }

.leaderboard-row.first-place  { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); border-color: #f59e0b; }
.leaderboard-row.second-place { background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%); border-color: #9ca3af; }
.leaderboard-row.third-place  { background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%); border-color: #f97316; }
.leaderboard-row.highlighted  { background-color: #fef9e7; border: 2px solid var(--warning); }

.leaderboard-row__rank   { font-weight: 700; font-size: 14px; min-width: 25px; color: var(--gray-500); line-height: 1.4; }
.leaderboard-row__name   { flex: 1; font-weight: 500; font-size: 13px; color: var(--gray-800); margin-left: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.4; }
.leaderboard-row__points { font-weight: 700; font-size: 12px; color: var(--success); margin-left: 10px; min-width: 60px; text-align: right; line-height: 1.4; }
.leaderboard-row__trend  { font-size: 16px; margin-left: 8px; min-width: 20px; text-align: center; }

/* ============================================
   COURSE CARDS
   ============================================ */

.course-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  overflow: hidden;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  display: flex;
  flex-direction: column;
}

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

.course-card__header {
  padding: 20px;
  text-align: center;
  background: var(--primary-50);
  position: relative;
  overflow: visible;
}

.course-card__body  { padding: 20px; flex: 1; overflow: visible; }

.course-card__title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-800);
  line-height: 1.4;
  margin-bottom: 10px;
}

.course-card__description {
  font-size: 14px;
  color: var(--gray-600);
  line-height: 1.6;
  margin-bottom: 15px;
  min-height: 40px;
}

.course-card__meta { font-size: 13px; color: var(--gray-500); margin-bottom: 8px; line-height: 1.5; }

.course-card__tags       { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 15px; }
.course-card__tag        { background: var(--gray-100); padding: 4px 10px; border-radius: var(--radius-full); font-size: 11px; color: var(--gray-600); line-height: 1.4; }

.course-card__level-badge {
  position: absolute;
  top: 10px; right: 10px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  color: white;
  line-height: 1.4;
}
.course-card__level-badge--beginner     { background: var(--success); }
.course-card__level-badge--intermediate { background: var(--warning); }
.course-card__level-badge--advanced     { background: var(--danger); }

/* ============================================
   FORMS
   ============================================ */

.form-row    { display: flex; gap: 1rem; margin-bottom: 1rem; }
.form-row > * { flex: 1; }
.form-group  { margin-bottom: 1rem; }
.form-label  { display: block; font-size: .875rem; font-weight: 500; color: var(--gray-700); margin-bottom: .5rem; line-height: 1.4; }

/* ============================================
   MODAL
   ============================================ */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 2000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 20px 20px;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0;
  color: var(--gray-900);
  line-height: 1.4;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--gray-600);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  line-height: 1;
}
.modal-close:hover { background: var(--gray-100); color: var(--gray-900); }

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  overflow: visible;
}

.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,.55);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 60px;
  overflow-y: auto;
}

.modal-box {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 640px;
  margin: 0 auto 60px;
  overflow: visible;
}

/* ============================================
   COMMUNITY PAGE
   ============================================ */

.tag {
  display: inline-block;
  background: var(--primary-50);
  color: var(--primary-700);
  border: 1px solid var(--primary-200);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: .75rem;
  font-weight: 500;
  line-height: 1.5;
  margin-right: 4px;
  margin-bottom: 4px;
}

.forums-grid   { display: flex; flex-direction: column; gap: .75rem; }
.forum-container { }
.forum-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: all .2s;
  line-height: 1.5;
  overflow: visible;
}
.forum-card:hover { border-color: var(--primary-400); box-shadow: var(--shadow-md); background: #fff; text-decoration: none; }

.posts-list    { display: flex; flex-direction: column; gap: .5rem; }
.post-container { }
.post-card {
  display: block;
  padding: 1rem 1.25rem;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: all .2s;
  line-height: 1.5;
  overflow: visible;
}
.post-card:hover { border-color: var(--primary-400); box-shadow: var(--shadow-sm); text-decoration: none; }

.mentors-grid  { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.25rem; }
.mentor-container { }
.mentor-card {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
  transition: all .2s;
  overflow: visible;
}
.mentor-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary-400); }

.events-list   { display: flex; flex-direction: column; gap: 1rem; }
.event-container { }
.event-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  transition: all .2s;
  overflow: visible;
}
.event-card:hover { box-shadow: var(--shadow-sm); border-color: var(--primary-400); }

.collaboration-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  transition: all .2s;
  overflow: visible;
}
.collaboration-card:hover { box-shadow: var(--shadow-sm); border-color: var(--primary-400); }

.section-title    { font-size: 1.1rem; font-weight: 600; color: var(--gray-800); margin: 0 0 .25rem; line-height: 1.4; }
.section-subtitle { font-size: .875rem; color: var(--gray-600); margin: 0; line-height: 1.5; }

/* ============================================
   FOOTER
   ============================================ */

.app-footer {
  margin-left: 280px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-light);
  padding: 2rem;
  text-align: center;
}

.app-footer__text  { color: var(--gray-400); font-size: 14px; line-height: 1.5; }
.app-footer__links { margin-top: 10px; }
.app-footer__link  {
  color: var(--primary-400);
  text-decoration: none;
  margin-right: 15px;
  line-height: 1.5;
  transition: color var(--transition-fast);
}
.app-footer__link:hover { color: var(--primary-600); text-decoration: none; }

/* ============================================
   UTILITIES
   ============================================ */

.text-center  { text-align: center; }
.text-left    { text-align: left; }
.text-right   { text-align: right; }

.mt-1 { margin-top: .5rem; }   .mb-1 { margin-bottom: .5rem; }
.mt-2 { margin-top: 1rem; }    .mb-2 { margin-bottom: 1rem; }
.mt-3 { margin-top: 1.5rem; }  .mb-3 { margin-bottom: 1.5rem; }
.mt-4 { margin-top: 2rem; }    .mb-4 { margin-bottom: 2rem; }

.flex          { display: flex; }
.flex-col      { flex-direction: column; }
.items-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

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

/* ============================================
   ACCESSIBILITY
   ============================================ */

:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}

/* ============================================
   ERROR PAGES
   ============================================ */

.error-container {
  text-align: center;
  padding: 4rem 2rem;
}

.error-title   { font-size: 2rem; font-weight: 700; color: var(--gray-800); line-height: 1.3; margin-bottom: 1rem; }
.error-message { font-size: 1rem; color: var(--gray-500); line-height: 1.6; margin-bottom: 2rem; }

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
  .main-content { margin-left: 0; padding: 1.5rem; }
  .app-footer   { margin-left: 0; }
  .sidebar      { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .stats-grid   { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .main-header  { padding: 1.5rem; }
  .app-title    { font-size: 1.5rem; }
  .stats-grid   { grid-template-columns: 1fr; }
  .card         { padding: 1rem; }
  .btn          { padding: .625rem 1.25rem; font-size: .875rem; }
}

/* ============================================
   DARK MODE
   ============================================ */

@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary:   #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary:  #334155;
    --gray-900: #f1f5f9;
    --gray-800: #e2e8f0;
    --gray-700: #cbd5e1;
    --gray-600: #94a3b8;
    --border-light: #475569;
  }

  .card         { background: var(--bg-secondary); border-color: var(--border-light); }
  .stat-value   { -webkit-text-fill-color: white !important; }
  .stat-label   { -webkit-text-fill-color: rgba(255,255,255,.9) !important; }
}
