/**
 * 3XA Learn - CSS
 * Reutiliza variables de 3XA Inc. (importadas en el HTML)
 * Estilos específicos para la plataforma Learn
 */

/* ==================== HEADER & NAVIGATION ==================== */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  padding: 0;
  transition: all 0.3s ease;
}

.header.scrolled {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.header .container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 2rem;
}

.logo {
  height: 36px;
  width: auto;
  display: block;
  transition: transform 0.2s ease;
}

.logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-link:hover .logo {
  transform: scale(1.05);
}

/* Navigation */
.header-nav {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-link {
  position: relative;
  padding: 0.625rem 1rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #4b5563;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-link:hover {
  color: #1f2937;
  background: rgba(0, 0, 0, 0.04);
}

.nav-link.active,
.nav-link[style*="color: var(--color-primary)"] {
  color: var(--color-primary) !important;
  background: rgba(255, 33, 78, 0.08);
  font-weight: 600;
}

/* Admin badge in nav */
.nav-link.admin-link {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: white !important;
  font-weight: 600;
}

.nav-link.admin-link:hover {
  background: linear-gradient(135deg, #16213e 0%, #1a1a2e 100%);
  transform: translateY(-1px);
}

/* Header actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

/* User dropdown */
.user-dropdown {
  position: relative;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem 0.5rem 0.5rem;
  background: #f9fafb;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.header-user:hover {
  background: #f3f4f6;
  border-color: #e5e7eb;
}

.header-user.active {
  background: #f3f4f6;
  border-color: var(--color-primary);
}

.header-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.header-user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1f2937;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

.header-user-role {
  font-size: 0.75rem;
  color: #6b7280;
  text-transform: capitalize;
}

.header-user-chevron {
  margin-left: 0.25rem;
  transition: transform 0.2s ease;
  color: #9ca3af;
}

.header-user.active .header-user-chevron {
  transform: rotate(180deg);
}

/* Dropdown menu */
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  border: 1px solid #e5e7eb;
  padding: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1000;
}

.dropdown-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.15s ease;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover {
  background: #f3f4f6;
  color: #1f2937;
}

.dropdown-item svg {
  width: 18px;
  height: 18px;
  color: #6b7280;
}

.dropdown-item:hover svg {
  color: #374151;
}

.dropdown-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 0.5rem 0;
}

.dropdown-item.danger {
  color: #dc2626;
}

.dropdown-item.danger:hover {
  background: #fef2f2;
  color: #dc2626;
}

.dropdown-item.danger svg {
  color: #dc2626;
}

/* Legacy logout button - hide when dropdown exists */
.btn-logout {
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #6b7280;
  background: transparent;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: none;
}

.btn-logout:hover {
  color: #ef4444;
  border-color: #fecaca;
  background: #fef2f2;
}

/* ==================== SKELETON LOADERS ==================== */

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 8px;
}

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

.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
  border-radius: 4px;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-text.medium {
  width: 80%;
}

.skeleton-title {
  height: 1.5rem;
  width: 50%;
  margin-bottom: 1rem;
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.skeleton-card {
  background: white;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.skeleton-card .skeleton-image {
  height: 120px;
  border-radius: 12px;
  margin-bottom: 1rem;
}

.skeleton-table-row {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid #f3f4f6;
}

.skeleton-table-row .skeleton-cell {
  height: 1rem;
  flex: 1;
}

.skeleton-table-row .skeleton-cell.small {
  flex: 0.5;
}

.skeleton-table-row .skeleton-cell.large {
  flex: 2;
}

.skeleton-stat {
  text-align: center;
  padding: 1.5rem;
}

.skeleton-stat .skeleton-number {
  height: 2.5rem;
  width: 60%;
  margin: 0 auto 0.5rem;
}

.skeleton-stat .skeleton-label {
  height: 0.875rem;
  width: 80%;
  margin: 0 auto;
}

/* Mobile menu toggle */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #1f2937;
  padding: 0.5rem;
  border-radius: 8px;
  transition: background 0.2s ease;
}

.mobile-menu-toggle:hover {
  background: #f3f4f6;
}

/* Mobile menu */
.mobile-menu {
  display: none;
  position: fixed;
  top: 72px;
  left: 0;
  right: 0;
  bottom: 0;
  background: white;
  padding: 1.5rem;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 999;
  overflow-y: auto;
}

.mobile-menu.active {
  display: flex;
}

.mobile-menu .nav-link {
  padding: 1rem 1.25rem;
  font-size: 1rem;
  border-radius: 12px;
}

.mobile-menu .btn-logout {
  margin-top: 1rem;
  width: 100%;
  padding: 1rem;
  justify-content: center;
}

/* Legacy support */
.header-logo {
  flex-shrink: 0;
  z-index: 10;
}

.header-cta {
  flex-shrink: 0;
  margin-left: auto;
  z-index: 10;
}

.header-cta .btn {
  white-space: nowrap;
}

@media (max-width: 1024px) {
  .header-nav {
    display: none;
  }

  .header-user-name {
    display: none;
  }

  .mobile-menu-toggle {
    display: block;
  }
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  transition: color var(--transition-fast);
}

.nav-link:hover {
  color: var(--color-primary);
}

/* Footer styles */
.footer {
  background-color: var(--bg-secondary);
  padding: var(--space-12) 0 var(--space-8);
  border-top: var(--border-width) solid var(--border-color);
}

.footer-content {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--space-12);
  margin-bottom: var(--space-8);
}

.footer-logo {
  height: 32px;
  width: auto;
  margin-bottom: var(--space-4);
}

.footer-brand {
  max-width: 300px;
}

.footer-description {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-8);
}

.footer-column {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer-title {
  font-weight: var(--font-bold);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.footer-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  transition: color var(--transition-fast);
}

.footer-link:hover {
  color: var(--color-primary);
}

.footer-bottom {
  padding-top: var(--space-6);
  border-top: var(--border-width) solid var(--border-color);
  text-align: center;
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-weight: var(--font-semibold);
  font-size: var(--text-base);
  text-decoration: none;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: 2px solid transparent;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.btn-primary:hover {
  background-color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--bg-secondary);
  border-color: var(--color-primary);
}

/* Container */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

/* Section */
.section {
  padding: var(--space-16) 0;
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-12);
}

.section-badge {
  display: inline-block;
  padding: var(--space-2) var(--space-4);
  background-color: rgba(59, 130, 246, 0.1);
  color: var(--color-primary);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin-bottom: var(--space-4);
}

.section-title {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

.section-subtitle {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* ==================== GLASSMORPHISM BASE ==================== */

.glass {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.glass-dark {
  background: rgba(30, 30, 40, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.glass-subtle {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* ==================== LEARN-SPECIFIC STYLES ==================== */

/* Course Cards - Glassmorphism */
.course-card {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  padding: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.06),
    0 1px 2px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  position: relative;
}

.course-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    rgba(255, 255, 255, 0.8) 20%,
    rgba(255, 255, 255, 0.8) 80%,
    transparent);
}

.course-card:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(255, 33, 78, 0.3);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.12),
    0 8px 20px rgba(255, 33, 78, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transform: translateY(-8px) scale(1.01);
}

.course-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-3);
  padding: var(--space-6) var(--space-6) 0 var(--space-6);
}

.course-card-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  line-height: 1.3;
}

.course-card-level {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  background-color: var(--bg-secondary);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

.course-card-level.principiante {
  background-color: #10b98130;
  color: #059669;
}

.course-card-level.intermedio {
  background-color: #f59e0b30;
  color: #d97706;
}

.course-card-level.avanzado {
  background-color: #ef444430;
  color: #dc2626;
}

.course-card-description {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-4);
  flex-grow: 1;
  padding: 0 var(--space-6);
}

.course-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  font-size: 0.95rem;
  color: var(--text-secondary);
  padding: 0 var(--space-6);
  font-weight: 500;
}

.course-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  padding: 0 var(--space-6) var(--space-6) var(--space-6);
}

.tag {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  background-color: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

/* Progress Bar */
.progress-bar-container {
  width: 100%;
  height: 8px;
  background-color: var(--bg-secondary);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-2);
}

.progress-bar {
  height: 100%;
  background-color: var(--color-primary);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.progress-text {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-align: right;
}

/* Lessons List */
.lessons-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.lesson-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.lesson-item:hover {
  background-color: var(--bg-secondary);
  border-color: var(--color-primary);
}

.lesson-item.completed {
  background-color: #10b98110;
  border-color: #10b981;
}

.lesson-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background-color: var(--bg-secondary);
  border-radius: var(--radius-full);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  flex-shrink: 0;
}

.lesson-item.completed .lesson-number {
  background-color: #10b981;
  color: white;
}

.lesson-info {
  flex-grow: 1;
}

.lesson-title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.lesson-meta {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.lesson-xp {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  background-color: var(--color-primary);
  color: white;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
}

/* User Profile */
.profile-header {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-8);
  background: var(--color-primary);
  border-radius: var(--radius-lg);
  color: white;
  margin-bottom: var(--space-8);
}

.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-full);
  border: 4px solid white;
  object-fit: cover;
}

.profile-info h1 {
  color: white;
  margin-bottom: var(--space-2);
}

.profile-stats {
  display: flex;
  gap: var(--space-6);
  margin-top: var(--space-4);
}

.profile-stat {
  text-align: center;
}

.profile-stat-value {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  display: block;
}

.profile-stat-label {
  font-size: var(--text-sm);
  opacity: 0.9;
}

/* Badges */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1.25rem;
}

.badge-card {
  text-align: center;
  padding: 1.5rem 1rem;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.04);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.badge-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
}

.badge-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1);
}

.badge-card.earned {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 240, 245, 0.9) 100%);
  border: 1px solid rgba(255, 33, 78, 0.15);
  box-shadow: 0 4px 20px rgba(255, 33, 78, 0.1);
}

.badge-card.earned::after {
  content: '';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #10b981, #059669);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

.badge-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  border-radius: 50%;
  font-size: 1.75rem;
  color: #9ca3af;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.06),
    inset 0 2px 4px rgba(255, 255, 255, 0.8);
}

.badge-card.earned .badge-icon {
  background: linear-gradient(135deg, var(--color-primary) 0%, #ff6b8a 100%);
  color: white;
  box-shadow:
    0 8px 24px rgba(255, 33, 78, 0.35),
    inset 0 2px 4px rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.badge-card.earned:hover .badge-icon {
  transform: scale(1.12) rotate(5deg);
}

.badge-icon svg {
  width: 32px;
  height: 32px;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.badge-card.earned .badge-icon svg {
  stroke: white;
}

.badge-name {
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: #374151;
}

.badge-card.earned .badge-name {
  color: #1f2937;
}

.badge-description {
  font-size: 0.75rem;
  color: #9ca3af;
  line-height: 1.4;
}

.badge-card.earned .badge-description {
  color: #6b7280;
}

/* Leaderboard - Glassmorphism */
.leaderboard-container-glass {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 24px;
  overflow: hidden;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
}

.leaderboard-table thead {
  background: linear-gradient(180deg, rgba(249, 250, 251, 0.9) 0%, rgba(243, 244, 246, 0.7) 100%);
}

.leaderboard-table th {
  padding: 1.25rem 1.5rem;
  text-align: left;
  font-weight: 700;
  font-size: 0.8rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.leaderboard-table tbody tr {
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  transition: all 0.3s ease;
}

.leaderboard-table tbody tr:hover {
  background: rgba(255, 33, 78, 0.04);
}

.leaderboard-table tbody tr:last-child {
  border-bottom: none;
}

.leaderboard-table tbody tr.current-user {
  background: linear-gradient(90deg, rgba(255, 33, 78, 0.08) 0%, rgba(255, 33, 78, 0.02) 100%);
  position: relative;
}

.leaderboard-table tbody tr.current-user::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--color-primary), #ff6b8a);
  border-radius: 0 4px 4px 0;
}

.leaderboard-table td {
  padding: 1.25rem 1.5rem;
  font-size: 0.95rem;
}

/* Rank badges */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 1rem;
}

.rank-badge.gold {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.rank-badge.silver {
  background: linear-gradient(135deg, #e5e7eb 0%, #9ca3af 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(156, 163, 175, 0.4);
}

.rank-badge.bronze {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.4);
}

.rank-badge.normal {
  background: rgba(243, 244, 246, 0.8);
  color: #6b7280;
}

.rank {
  font-weight: var(--font-bold);
  color: var(--text-primary);
  font-size: var(--text-lg);
}

.rank.top-1 {
  color: #FFD700;
}

.rank.top-2 {
  color: #C0C0C0;
}

.rank.top-3 {
  color: #CD7F32;
}

.user-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.user-avatar-small {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  object-fit: cover;
}

.level-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--color-primary);
  color: white;
  border-radius: var(--radius-full);
  font-weight: var(--font-bold);
  font-size: var(--text-sm);
}

/* ==================== LESSON CONTENT ==================== */
.lesson-content {
  max-width: 800px;
  margin: 0 auto;
}

.lesson-content h1 {
  font-size: 2.5rem;
  font-weight: 800;
  color: #1f2937;
  margin-bottom: 2rem;
  line-height: 1.2;
}

.lesson-content h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1f2937;
  margin-top: 3rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #f3f4f6;
}

.lesson-content h3 {
  font-size: 1.375rem;
  font-weight: 600;
  color: #374151;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.lesson-content h4 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #4b5563;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.lesson-content p {
  margin-bottom: 1.25rem;
  line-height: 1.8;
  color: #374151;
}

.lesson-content strong {
  color: #1f2937;
  font-weight: 600;
}

.lesson-content em {
  color: #4b5563;
  font-style: italic;
}

/* Lists */
.lesson-content ul,
.lesson-content ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

.lesson-content ul {
  list-style-type: disc;
}

.lesson-content ol {
  list-style-type: decimal;
}

.lesson-content li {
  margin-bottom: 0.5rem;
  line-height: 1.7;
  color: #374151;
}

.lesson-content li > ul,
.lesson-content li > ol {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

/* Code blocks */
.lesson-content pre {
  background-color: #1f2937;
  color: #e5e7eb;
  padding: 1.5rem;
  border-radius: 12px;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Consolas', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.lesson-content pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
  border-radius: 0;
}

.lesson-content code {
  background-color: #f3f4f6;
  color: #dc2626;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Consolas', monospace;
  font-size: 0.875em;
  font-weight: 500;
}

/* Tables */
.lesson-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.lesson-content thead {
  background-color: #f9fafb;
}

.lesson-content th {
  padding: 1rem 1.25rem;
  text-align: left;
  font-weight: 600;
  color: #1f2937;
  border-bottom: 2px solid #e5e7eb;
  white-space: nowrap;
}

.lesson-content td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f3f4f6;
  color: #374151;
}

.lesson-content tbody tr:last-child td {
  border-bottom: none;
}

.lesson-content tbody tr:hover {
  background-color: #f9fafb;
}

/* Blockquotes */
.lesson-content blockquote {
  border-left: 4px solid var(--color-primary);
  background-color: #fef2f2;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  border-radius: 0 12px 12px 0;
  color: #374151;
}

.lesson-content blockquote p {
  margin: 0;
}

.lesson-content blockquote p:last-child {
  margin-bottom: 0;
}

/* Info/Tip boxes */
.lesson-content blockquote:has(strong:first-child) {
  background-color: #eff6ff;
  border-left-color: #3b82f6;
}

/* Links */
.lesson-content a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid transparent;
  transition: all 0.2s ease;
}

.lesson-content a:hover {
  border-bottom-color: var(--color-primary);
}

/* Horizontal rule */
.lesson-content hr {
  border: none;
  height: 2px;
  background: linear-gradient(to right, transparent, #e5e7eb, transparent);
  margin: 3rem 0;
}

/* Images */
.lesson-content img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin: 1.5rem 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Keyboard shortcuts */
.lesson-content kbd {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8em;
  color: #374151;
  background-color: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Lesson Progress Indicator */
.lesson-progress-indicator {
  position: fixed;
  top: 80px;
  left: 0;
  right: 0;
  height: 4px;
  background: #e5e7eb;
  z-index: 100;
}

.lesson-progress-indicator .progress {
  height: 100%;
  background: var(--color-primary);
  transition: width 0.1s ease;
}

/* Completion Section - Hidden by default */
.completion-section {
  background-color: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 16px;
  padding: 3rem;
  text-align: center;
  margin-top: 4rem;
  opacity: 0.6;
  transition: all 0.3s ease;
}

.completion-section.ready {
  background-color: #f0fdf4;
  border-color: var(--color-primary);
  opacity: 1;
}

.completion-section.completed {
  background-color: #f0fdf4;
  border-color: #10b981;
  opacity: 1;
}

/* Lesson Navigation */
.lesson-navigation {
  display: flex;
  justify-content: space-between;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 2px solid #f3f4f6;
}

/* Admin Panel */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}

.admin-stat-card {
  padding: var(--space-6);
  background-color: var(--bg-primary);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-lg);
  text-align: center;
}

.admin-stat-value {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  color: var(--color-primary);
  margin-bottom: var(--space-2);
}

.admin-stat-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

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

/* Stat Cards - Glass Effect */
.stat-card-glass {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  padding: 1.75rem;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.stat-card-glass::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    rgba(255, 255, 255, 0.9) 30%,
    rgba(255, 255, 255, 0.9) 70%,
    transparent);
}

.stat-card-glass:hover {
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-4px);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.1),
    0 4px 12px rgba(255, 33, 78, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 1);
}

.stat-card-glass .stat-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--color-primary) 0%, #ff6b8a 100%);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  box-shadow: 0 8px 20px rgba(255, 33, 78, 0.25);
}

.stat-card-glass .stat-value {
  font-size: 2.25rem;
  font-weight: 800;
  color: #1f2937;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-card-glass .stat-label {
  font-size: 0.875rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* Challenge Cards - Glass Effect */
.challenge-card-glass {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 20px;
  padding: 1.75rem;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.challenge-card-glass::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100px;
  height: 100px;
  background: radial-gradient(circle, rgba(255, 33, 78, 0.1) 0%, transparent 70%);
  pointer-events: none;
}

.challenge-card-glass:hover {
  background: rgba(255, 255, 255, 0.85);
  transform: translateY(-4px);
  border-color: rgba(255, 33, 78, 0.2);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.1),
    0 4px 12px rgba(255, 33, 78, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.challenge-card-glass .challenge-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.625rem;
}

.challenge-card-glass .challenge-description {
  font-size: 0.95rem;
  color: #6b7280;
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.challenge-card-glass .challenge-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
}

.challenge-card-glass .challenge-deadline {
  color: #9ca3af;
}

.challenge-card-glass .challenge-xp {
  color: var(--color-primary);
  font-weight: 700;
  background: rgba(255, 33, 78, 0.1);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
}

/* Feature Cards - Glass Effect (Landing Page) */
.feature-card-glass {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 24px;
  padding: 2.5rem;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.feature-card-glass::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
}

.feature-card-glass:hover {
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-8px);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.12),
    0 8px 20px rgba(255, 33, 78, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 1);
}

.feature-icon-glass {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--color-primary) 0%, #ff6b8a 100%);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  color: white;
  box-shadow: 0 8px 20px rgba(255, 33, 78, 0.3);
  transition: all 0.3s ease;
}

.feature-card-glass:hover .feature-icon-glass {
  transform: scale(1.1) rotate(3deg);
  box-shadow: 0 12px 28px rgba(255, 33, 78, 0.4);
}

.feature-title-glass {
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: #1f2937;
}

.feature-text-glass {
  color: #6b7280;
  line-height: 1.7;
  font-size: 1rem;
}

/* Lesson Items - Glass Effect */
.lesson-item-glass {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  margin-bottom: 0.75rem;
  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.lesson-item-glass:hover {
  background: rgba(255, 255, 255, 0.85);
  transform: translateX(8px);
  border-color: rgba(255, 33, 78, 0.2);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.lesson-item-glass.completed {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
}

.lesson-item-glass .lesson-number {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #4b5563;
  font-size: 1rem;
  flex-shrink: 0;
}

.lesson-item-glass.completed .lesson-number {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Welcome Banner - Glass Effect */
.welcome-banner-glass {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 24px;
  padding: 2.5rem;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.welcome-banner-glass::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 60%);
  pointer-events: none;
}

/* XP Progress - Glass Effect */
.xp-progress-glass {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.xp-progress-glass .xp-bar {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  overflow: hidden;
}

.xp-progress-glass .xp-fill {
  height: 100%;
  background: linear-gradient(90deg, #fff 0%, rgba(255, 255, 255, 0.8) 100%);
  border-radius: 999px;
  transition: width 0.5s ease;
}

/* ==================== WELCOME AVATAR ==================== */

.welcome-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.welcome-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: white;
  font-size: 1.5rem;
  font-weight: 700;
}

/* ==================== CHALLENGES CAROUSEL ==================== */

.challenges-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.challenges-header h2 {
  font-size: 2rem;
  font-weight: 800;
  color: #1f2937;
  margin: 0;
}

.challenges-toggle-btn {
  background: none;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 0.5rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #4b5563;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.challenges-toggle-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: rgba(255, 33, 78, 0.04);
}

.challenges-carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  gap: 1.5rem;
  padding-bottom: 1rem;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.challenges-carousel::-webkit-scrollbar {
  display: none;
}

.challenges-carousel .challenge-card-glass {
  flex-shrink: 0;
  min-width: 320px;
  max-width: 380px;
  scroll-snap-align: start;
}

.challenges-expanded {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.challenges-expanded .challenge-card-glass {
  min-width: 0;
}

/* ==================== VERIFIED BADGE (COURSE CARDS) ==================== */

.course-card-org {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  color: #6b7280;
  font-weight: 500;
  padding: 0 var(--space-6);
  margin-bottom: var(--space-2);
}

.verified-badge {
  flex-shrink: 0;
}

/* Responsive */
@media (max-width: 768px) {
  .profile-header {
    flex-direction: column;
    text-align: center;
  }

  .profile-stats {
    justify-content: center;
  }

  .leaderboard-table {
    font-size: var(--text-sm);
  }

  .leaderboard-table th,
  .leaderboard-table td {
    padding: var(--space-2);
  }

  .stat-card-glass,
  .challenge-card-glass {
    padding: 1.25rem;
  }

  .stat-card-glass .stat-value {
    font-size: 1.75rem;
  }

  .welcome-avatar {
    width: 56px;
    height: 56px;
  }

  .welcome-avatar-fallback {
    font-size: 1.2rem;
  }

  .challenges-carousel .challenge-card-glass {
    min-width: 280px;
  }
}
