/* --- Estilos generales --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- LOGIN --- */
body:not(.dashboard-body) {
  background: url('assets/galaxy.jpg');
  background-size: cover;
  background-position: center;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  position: relative;
}

body:not(.dashboard-body)::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 0;
}

.login {
  background: rgba(15, 14, 14, 0.9);
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 0 30px rgba(200, 16, 46, 0.3);
  width: 350px;
  text-align: center;
  display: flex;
  flex-direction: column;
  color: white;
  position: relative;
  z-index: 1;
  backdrop-filter: blur(10px);
}

.login h2 {
  color: rgb(16, 142, 200);
  font-weight: 800;
  font-size: 28px;
  margin-bottom: 20px;
}

.login input {
  margin: 10px 0;
  padding: 12px;
  border: 2px solid rgba(200, 16, 46, 0.3);
  border-radius: 8px;
  font-size: 16px;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  width: 100%;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.login input:focus {
  outline: none;
  border-color: rgb(16, 175, 200);
  box-shadow: 0 0 10px rgba(200, 16, 46, 0.5);
}

.login input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.parrafos {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin: 15px 0;
}

.parrafos a {
  color: white;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.3s ease;
}

.parrafos a:hover {
  color: rgb(16, 163, 200);
}

.parrafos a#signup {
  color: rgb(16, 154, 200);
  font-weight: 600;
}

#boton {
  padding: 12px;
  border: none;
  border-radius: 8px;
  background-color: rgb(16, 194, 200);
  color: white;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  width: 100%;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  margin-top: 10px;
}

#boton:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(200, 16, 46, 0.4);
}

#boton:active {
  transform: translateY(0);
}

/* --- DASHBOARD --- */
.dashboard-body {
  background: #f5f5f5;
  min-height: 100vh;
}

.dashboard-body.modo-oscuro {
  background: #1a1a1a;
  color: #e0e0e0;
}

/* Navbar */
.navbar {
  background: linear-gradient(135deg, #1091c8 0%, #1091c8 100%);
  color: white;
  padding: 15px 30px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.modo-oscuro .navbar {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  border-bottom: 1px solid #333;
}

.nav-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
}

.nav-content h1 {
  font-size: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 15px;
}

.nav-user span {
  font-weight: 600;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  transition: background 0.3s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Dashboard Container */
.dashboard-container {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  gap: 20px;
}

/* Sidebar */
.sidebar {
  width: 250px;
  background: white;
  border-radius: 15px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 20px;
  height: fit-content;
  position: sticky;
  top: 90px;
}

.modo-oscuro .sidebar {
  background: #2d2d2d;
  border: 1px solid #333;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  border: none;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  color: #666;
  text-align: left;
  transition: all 0.3s ease;
}

.modo-oscuro .menu-item {
  color: #ccc;
}

.menu-item:hover {
  background: #f0f0f0;
  color: #45eac9;
}

.modo-oscuro .menu-item:hover {
  background: #3d3d3d;
}

.menu-item.active {
  background: rgba(200, 16, 46, 0.1);
  color: #20e34a;
  font-weight: 600;
}

.modo-oscuro .menu-item.active {
  background: rgba(200, 16, 46, 0.2);
}

.menu-item i {
  width: 20px;
  text-align: center;
}

/* Main Content */
.main-content {
  flex: 1;
  background: white;
  border-radius: 15px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 30px;
  min-height: calc(100vh - 140px);
}

.modo-oscuro .main-content {
  background: #2d2d2d;
  border: 1px solid #333;
}

.content-section {
  display: none;
}

.content-section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 2px solid #f0f0f0;
}

.modo-oscuro .section-header {
  border-bottom-color: #444;
}

.section-header h2 {
  color: #333;
  font-size: 28px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modo-oscuro .section-header h2 {
  color: #e0e0e0;
}

.nivel-badge {
  background: rgba(200, 16, 46, 0.1);
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 14px;
  color: #6689eb;
  font-weight: 600;
}

/* Materias Selector */
.materias-selector {
  margin-bottom: 30px;
}

.materias-selector h3 {
  color: #666;
  margin-bottom: 20px;
  font-size: 18px;
}

.modo-oscuro .materias-selector h3 {
  color: #ccc;
}

.materias-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
}

.materia-card {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.modo-oscuro .materia-card {
  background: linear-gradient(135deg, #3d3d3d 0%, #2d2d2d 100%);
  color: #e0e0e0;
}

.materia-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
  border-color: #5bd0d4;
}

.materia-card i {
  font-size: 32px;
  color: #53c271;
}

/* Ejercicio Container */
.ejercicio-container {
  margin-top: 20px;
}

.ejercicio-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 15px;
}

.puntos-actuales, .streak {
  background: rgba(200, 16, 46, 0.1);
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  color: #86ee7a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pregunta-box {
  background: #f8f9fa;
  border-radius: 15px;
  padding: 30px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.modo-oscuro .pregunta-box {
  background: #3d3d3d;
}

.pregunta-box h3 {
  color: #333;
  margin-bottom: 15px;
  font-size: 20px;
}

.modo-oscuro .pregunta-box h3 {
  color: #e0e0e0;
}

.pregunta-texto {
  font-size: 18px;
  color: #555;
  margin-bottom: 20px;
  line-height: 1.6;
}

.modo-oscuro .pregunta-texto {
  color: #ccc;
}

.input-group {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.input-group input {
  flex: 1;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
}

.modo-oscuro .input-group input {
  background: #2d2d2d;
  border-color: #555;
  color: #e0e0e0;
}

.input-group input:focus {
  outline: none;
  border-color: #C8102E;
}

.btn-primary {
  background: #C8102E;
  color: white;
  border: none;
  padding: 12px 25px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.btn-primary:hover {
  background: #A00D25;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(200, 16, 46, 0.3);
}

.ayuda {
  color: #C8102E;
  font-weight: 600;
  margin-top: 15px;
  padding: 10px;
  background: rgba(200, 16, 46, 0.1);
  border-radius: 8px;
}

.feedback-box {
  margin-top: 15px;
}

.feedback-correcto {
  background: rgba(200, 16, 46, 0.1);
  color: #A00D25;
  padding: 15px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.feedback-incorrecto {
  background: rgba(255, 77, 77, 0.1);
  color: #ff4d4d;
  padding: 15px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Opciones de selección múltiple */
.opciones-container {
  margin: 20px 0;
}

.opciones-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
  margin-bottom: 15px;
}

@media (max-width: 768px) {
  .opciones-list {
    grid-template-columns: 1fr;
  }
}

.opcion-btn {
  padding: 15px 20px;
  background: white;
  border: 2px solid #ddd;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  text-align: left;
  transition: all 0.3s ease;
  color: #333;
  font-weight: 500;
  position: relative;
}

.modo-oscuro .opcion-btn {
  background: #3d3d3d;
  border-color: #555;
  color: #e0e0e0;
}

.opcion-btn:hover {
  border-color: #C8102E;
  background: rgba(200, 16, 46, 0.05);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.modo-oscuro .opcion-btn:hover {
  background: rgba(200, 16, 46, 0.1);
}

.opcion-btn.seleccionada {
  border-color: #C8102E;
  background: rgba(200, 16, 46, 0.15);
  font-weight: 600;
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.2);
}

.modo-oscuro .opcion-btn.seleccionada {
  background: rgba(200, 16, 46, 0.2);
}

.opcion-btn.correcta {
  border-color: #C8102E;
  background: rgba(200, 16, 46, 0.2);
  font-weight: 600;
  animation: pulse-correct 0.5s ease;
}

.modo-oscuro .opcion-btn.correcta {
  background: rgba(200, 16, 46, 0.3);
}

.opcion-btn.incorrecta {
  border-color: #ff4d4d;
  background: rgba(255, 77, 77, 0.1);
  opacity: 0.7;
}

.modo-oscuro .opcion-btn.incorrecta {
  background: rgba(255, 77, 77, 0.2);
}

@keyframes pulse-correct {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.opcion-btn::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border: 2px solid #ddd;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.opcion-btn.seleccionada::before {
  border-color: #C8102E;
  background: #C8102E;
}

.opcion-btn.seleccionada::after {
  content: '✓';
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: white;
  font-weight: bold;
  font-size: 12px;
}

.opcion-btn {
  padding-left: 45px;
}

.hints-section {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.btn-hint, .btn-skip {
  padding: 10px 20px;
  border: 2px solid #C8102E;
  background: transparent;
  color: #C8102E;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.btn-hint:hover, .btn-skip:hover {
  background: #C8102E;
  color: white;
}

/* Estadísticas */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: white;
  border-radius: 15px;
  padding: 25px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 20px;
  transition: transform 0.3s ease;
}

.modo-oscuro .stat-card {
  background: #3d3d3d;
  border: 1px solid #555;
}

.stat-card:hover {
  transform: translateY(-5px);
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
}

.stat-info h3 {
  font-size: 32px;
  margin: 0;
  color: #333;
}

.modo-oscuro .stat-info h3 {
  color: #e0e0e0;
}

.stat-info p {
  color: #666;
  margin: 5px 0 0 0;
  font-size: 14px;
}

.modo-oscuro .stat-info p {
  color: #aaa;
}

.chart-container {
  background: white;
  border-radius: 15px;
  padding: 25px;
  margin-bottom: 30px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.modo-oscuro .chart-container {
  background: #3d3d3d;
  border: 1px solid #555;
}

.chart-container h3 {
  margin-bottom: 20px;
  color: #333;
}

.modo-oscuro .chart-container h3 {
  color: #e0e0e0;
}

.materias-stats {
  background: white;
  border-radius: 15px;
  padding: 25px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.modo-oscuro .materias-stats {
  background: #3d3d3d;
  border: 1px solid #555;
}

.materias-stats h3 {
  margin-bottom: 20px;
  color: #333;
}

.modo-oscuro .materias-stats h3 {
  color: #e0e0e0;
}

.materia-stat-item {
  margin-bottom: 20px;
}

.materia-stat-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-weight: 600;
  color: #333;
}

.modo-oscuro .materia-stat-header {
  color: #e0e0e0;
}

.materia-stat-bar {
  height: 8px;
  background: #f0f0f0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 5px;
}

.modo-oscuro .materia-stat-bar {
  background: #555;
}

.materia-stat-fill {
  height: 100%;
  background: linear-gradient(90deg, #C8102E, #A00D25);
  transition: width 0.5s ease;
}

.materia-stat-details {
  display: flex;
  gap: 15px;
  font-size: 14px;
  color: #666;
}

.modo-oscuro .materia-stat-details {
  color: #aaa;
}

/* Progreso */
.progreso-overview {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.progreso-card {
  background: white;
  border-radius: 15px;
  padding: 25px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.modo-oscuro .progreso-card {
  background: #3d3d3d;
  border: 1px solid #555;
}

.progreso-card h3 {
  margin-bottom: 15px;
  color: #333;
}

.modo-oscuro .progreso-card h3 {
  color: #e0e0e0;
}

.progreso-bar-container {
  display: flex;
  align-items: center;
  gap: 15px;
}

.progreso-bar {
  flex: 1;
  height: 20px;
  background: #f0f0f0;
  border-radius: 10px;
  overflow: hidden;
}

.modo-oscuro .progreso-bar {
  background: #555;
}

.progreso-fill {
  height: 100%;
  background: linear-gradient(90deg, #C8102E, #A00D25);
  transition: width 0.5s ease;
  border-radius: 10px;
}

.progreso-materias {
  background: white;
  border-radius: 15px;
  padding: 25px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.modo-oscuro .progreso-materias {
  background: #3d3d3d;
  border: 1px solid #555;
}

.progreso-materias h3 {
  margin-bottom: 20px;
  color: #333;
}

.modo-oscuro .progreso-materias h3 {
  color: #e0e0e0;
}

.progreso-materia-item {
  margin-bottom: 20px;
}

.progreso-materia-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-weight: 600;
  color: #333;
}

.modo-oscuro .progreso-materia-header {
  color: #e0e0e0;
}

/* Logros */
.logros-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.logro-card {
  background: white;
  border-radius: 15px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 15px;
  transition: transform 0.3s ease;
  position: relative;
  opacity: 0.6;
}

.modo-oscuro .logro-card {
  background: #3d3d3d;
  border: 1px solid #555;
}

.logro-card.desbloqueado {
  opacity: 1;
  border: 2px solid #C8102E;
}

.logro-card:hover {
  transform: translateY(-5px);
}

.logro-icon {
  width: 50px;
  height: 50px;
  background: rgba(200, 16, 46, 0.1);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #C8102E;
}

.logro-info h3 {
  margin: 0 0 5px 0;
  color: #333;
  font-size: 16px;
}

.modo-oscuro .logro-info h3 {
  color: #e0e0e0;
}

.logro-info p {
  margin: 0;
  color: #666;
  font-size: 14px;
}

.modo-oscuro .logro-info p {
  color: #aaa;
}

.logro-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  color: #C8102E;
  font-size: 20px;
}

/* Historial */
.historial-filters {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 15px;
  border: 2px solid #ddd;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  color: #666;
  transition: all 0.3s ease;
}

.modo-oscuro .filter-btn {
  background: #3d3d3d;
  border-color: #555;
  color: #ccc;
}

.filter-btn:hover {
  border-color: #C8102E;
  color: #C8102E;
}

.filter-btn.active {
  background: #C8102E;
  border-color: #C8102E;
  color: white;
}

.historial-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.historial-item {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 15px;
  transition: transform 0.3s ease;
}

.modo-oscuro .historial-item {
  background: #3d3d3d;
  border: 1px solid #555;
}

.historial-item:hover {
  transform: translateX(5px);
}

.historial-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.historial-icon.correcta {
  background: rgba(200, 16, 46, 0.1);
  color: #C8102E;
}

.historial-icon.incorrecta {
  background: rgba(255, 77, 77, 0.1);
  color: #ff4d4d;
}

.historial-info {
  flex: 1;
}

.historial-info h4 {
  margin: 0 0 5px 0;
  color: #333;
  font-size: 16px;
}

.modo-oscuro .historial-info h4 {
  color: #e0e0e0;
}

.historial-info p {
  margin: 0 0 5px 0;
  color: #666;
  font-size: 14px;
}

.modo-oscuro .historial-info p {
  color: #aaa;
}

.historial-fecha {
  font-size: 12px;
  color: #999;
}

.modo-oscuro .historial-fecha {
  color: #777;
}

.puntos-positivos {
  color: #C8102E;
  font-weight: 600;
}

.puntos-negativos {
  color: #ff4d4d;
}

/* Recomendaciones */
.recomendaciones-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.recomendacion-card {
  background: white;
  border-radius: 15px;
  padding: 25px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  gap: 20px;
  align-items: flex-start;
  border-left: 4px solid #C8102E;
}

.modo-oscuro .recomendacion-card {
  background: #3d3d3d;
  border-color: #C8102E;
}

.recomendacion-card.motivacion {
  border-left-color: #ff9900;
}

.recomendacion-card.felicitacion {
  border-left-color: #C8102E;
}

.recomendacion-card.mejora {
  border-left-color: #ff4d4d;
}

.recomendacion-icon {
  width: 50px;
  height: 50px;
  background: rgba(200, 16, 46, 0.1);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #C8102E;
  flex-shrink: 0;
}

.recomendacion-content {
  flex: 1;
}

.recomendacion-content h3 {
  margin: 0 0 10px 0;
  color: #333;
}

.modo-oscuro .recomendacion-content h3 {
  color: #e0e0e0;
}

.recomendacion-content p {
  margin: 0 0 15px 0;
  color: #666;
  line-height: 1.6;
}

.modo-oscuro .recomendacion-content p {
  color: #aaa;
}

.btn-recomendacion {
  background: #C8102E;
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s ease;
}

.btn-recomendacion:hover {
  background: #A00D25;
  transform: translateY(-2px);
}

/* Configuración */
.config-container {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.config-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 12px;
}

.modo-oscuro .config-item {
  background: #3d3d3d;
}

.config-item label {
  font-weight: 600;
  color: #333;
}

.modo-oscuro .config-item label {
  color: #e0e0e0;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #C8102E;
}

input:checked + .slider:before {
  transform: translateX(26px);
}

/* --- Input y Select Mejorado --- */
.config-item select,
.config-item input[type="number"] {
  width: 220px;
  padding: 10px 14px;
  font-size: 15px;
  border: 2px solid #ccc;
  border-radius: 10px;
  background-color: #ffffff;
  color: #333;
  cursor: pointer;
  transition: all 0.25s ease;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,<svg fill='%23333' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
}

/* --- MODO OSCURO --- */
.modo-oscuro .config-item select,
.modo-oscuro .config-item input[type="number"] {
  background: #2d2d2d;
  border-color: #555;
  color: #e0e0e0;

  /* <- ESTA ES LA FLECHA PARA DARK MODE (IMPORTANTE) */
  background-image: url("data:image/svg+xml;charset=UTF-8,<svg fill='%23e0e0e0' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
}


/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
}

.modal-content {
  background-color: white;
  margin: 5% auto;
  padding: 30px;
  border-radius: 15px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
  position: relative;
  animation: slideDown 0.3s ease;
}

.modo-oscuro .modal-content {
  background: #2d2d2d;
  border: 1px solid #555;
}

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

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  position: absolute;
  right: 20px;
  top: 20px;
}

.close:hover {
  color: #333;
}

.modo-oscuro .close:hover {
  color: #e0e0e0;
}

.perfil-info {
  text-align: center;
}

.avatar {
  font-size: 80px;
  color: #10bcc8;
  margin-bottom: 15px;
}

.perfil-info h3 {
  margin: 0 0 10px 0;
  color: #333;
  font-size: 24px;
}

.modo-oscuro .perfil-info h3 {
  color: #e0e0e0;
}

.perfil-stats {
  display: flex;
  justify-content: space-around;
  margin-top: 30px;
  padding-top: 30px;
  border-top: 2px solid #f0f0f0;
}

.modo-oscuro .perfil-stats {
  border-top-color: #555;
}

.perfil-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.perfil-stat strong {
  font-size: 28px;
  color: #10bcc8;
  margin-bottom: 5px;
}

.perfil-stat span {
  color: #666;
  font-size: 14px;
}

.modo-oscuro .perfil-stat span {
  color: #aaa;
}

/* Notificaciones */
.notificacion {
  position: fixed;
  top: 20px;
  right: 20px;
  background: white;
  padding: 15px 20px;
  border-radius: 10px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 3000;
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.3s ease;
  max-width: 400px;
}

.modo-oscuro .notificacion {
  background: #2d2d2d;
  border: 1px solid #555;
}

.notificacion.show {
  opacity: 1;
  transform: translateX(0);
}

.notificacion.success {
  border-left: 4px solid #10bcc8;
}

.notificacion.error {
  border-left: 4px solid #10bcc8;
}

.notificacion.info {
  border-left: 4px solid #4d94ff;
}

.notificacion button {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #999;
  font-size: 18px;
  padding: 0;
  margin-left: auto;
}

.notificacion button:hover {
  color: #333;
}

.modo-oscuro .notificacion button:hover {
  color: #e0e0e0;
}

.sin-datos {
  text-align: center;
  color: #999;
  padding: 40px;
  font-size: 16px;
}

.modo-oscuro .sin-datos {
  color: #777;
}

/* Calendario */
.calendario-container {
  background: white;
  border-radius: 15px;
  padding: 25px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.modo-oscuro .calendario-container {
  background: #3d3d3d;
  border: 1px solid #555;
}

.calendario-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.calendario-header h3 {
  font-size: 24px;
  color: #333;
  margin: 0;
}

.modo-oscuro .calendario-header h3 {
  color: #e0e0e0;
}

.btn-calendario {
  background: #10bcc8;
  border: none;
  color: white;
  padding: 10px 15px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.3s ease;
}

.btn-calendario:hover {
  background: #10bcc8;
  transform: scale(1.1);
}

.calendario-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.calendario-dia-header {
  text-align: center;
  font-weight: 600;
  color: #666;
  padding: 10px;
  font-size: 14px;
}

.modo-oscuro .calendario-dia-header {
  color: #aaa;
}

.calendario-dia {
  aspect-ratio: 1;
  background: #f8f9fa;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.modo-oscuro .calendario-dia {
  background: #2d2d2d;
  border: 1px solid #444;
}

.calendario-dia.vacio {
  background: transparent;
  cursor: default;
}

.modo-oscuro .calendario-dia.vacio {
  background: transparent;
  border: none;
}

.calendario-dia.con-actividad {
  background: rgba(200, 16, 46, 0.2);
  border: 2px solid #a910c8;
}

.calendario-dia.objetivo-alcanzado {
  background: rgba(255, 153, 0, 0.3);
  border: 2px solid #ff9900;
}

.calendario-dia.hoy {
  background: rgba(77, 148, 255, 0.3);
  border: 2px solid #4dffa3;
  font-weight: 600;
}

.dia-numero {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.modo-oscuro .dia-numero {
  color: #e0e0e0;
}

.dia-actividades {
  font-size: 10px;
  color: #c8c510;
  font-weight: 600;
  margin-top: 2px;
}

.calendario-leyenda {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  padding-top: 20px;
  border-top: 2px solid #f0f0f0;
}

.modo-oscuro .calendario-leyenda {
  border-top-color: #555;
}

.leyenda-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #666;
}

.modo-oscuro .leyenda-item {
  color: #aaa;
}

.leyenda-color {
  width: 20px;
  height: 20px;
  border-radius: 4px;
}

/* Chat */
.chat-container {
  background: white;
  border-radius: 15px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  height: 600px;
}

.modo-oscuro .chat-container {
  background: #3d3d3d;
  border: 1px solid #555;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  background: #f8f9fa;
}

.modo-oscuro .chat-messages {
  background: #2d2d2d;
}

.chat-message {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.chat-message.user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #105ac8;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  flex-shrink: 0;
}

.chat-message.user .message-avatar {
  background: #4d94ff;
  color: white;
}

.message-content {
  max-width: 70%;
  background: white;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.modo-oscuro .message-content {
  background: #3d3d3d;
  border: 1px solid #555;
}

.chat-message.user .message-content {
  background: #4d94ff7d;
  color: white;
}

.message-content p {
  margin: 0 0 5px 0;
  color: #333;
  line-height: 1.5;
}

.modo-oscuro .message-content p {
  color: #e0e0e0;
}

.chat-message.user .message-content p {
  color: white;
}

.message-time {
  font-size: 11px;
  color: #999;
}

.chat-message.user .message-time {
  color: rgba(255, 255, 255, 0.7);
}

.chat-input-container {
  display: flex;
  gap: 10px;
  padding: 15px;
  border-top: 2px solid #f0f0f0;
  background: white;
}

.modo-oscuro .chat-input-container {
  background: #3d3d3d;
  border-top-color: #555;
}

.chat-input-container input {
  flex: 1;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
}

.modo-oscuro .chat-input-container input {
  background: #2d2d2d;
  border-color: #555;
  color: #e0e0e0;
}

.chat-input-container input:focus {
  outline: none;
  border-color: #c8102f60;
}

.btn-chat {
  background: #c8102f8e;
  border: none;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.3s ease;
}

.btn-chat:hover {
  background: #A00D25;
  transform: scale(1.05);
}

.chat-suggestions {
  display: flex;
  gap: 10px;
  padding: 15px;
  border-top: 2px solid #f0f0f0;
  background: white;
  flex-wrap: wrap;
}

.modo-oscuro .chat-suggestions {
  background: #3d3d3d;
  border-top-color: #555;
}

.suggestion-btn {
  padding: 8px 15px;
  border: 2px solid #c810bfa2;
  background: transparent;
  color: #c810a381;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.3s ease;
}

.suggestion-btn:hover {
  background: #c810a37a;
  color: white;
}

/* Leaderboard */
.leaderboard-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.leaderboard-filters {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.leaderboard-item {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 15px;
  transition: transform 0.3s ease;
}

.modo-oscuro .leaderboard-item {
  background: #3d3d3d;
  border: 1px solid #555;
}

.leaderboard-item:hover {
  transform: translateX(5px);
}

.leaderboard-item.top-1 {
  background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
  border: 2px solid #ffd700;
}

.leaderboard-item.top-2 {
  background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 100%);
  border: 2px solid #c0c0c0;
}

.leaderboard-item.top-3 {
  background: linear-gradient(135deg, #cd7f32 0%, #e6a857 100%);
  border: 2px solid #cd7f32;
}

.leaderboard-posicion {
  font-size: 24px;
  font-weight: 700;
  width: 40px;
  text-align: center;
  color: #333;
}

.modo-oscuro .leaderboard-posicion {
  color: #e0e0e0;
}

.leaderboard-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(200, 16, 46, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #10c897a3;
}

.leaderboard-info {
  flex: 1;
}

.leaderboard-info h4 {
  margin: 0 0 5px 0;
  color: #333;
  font-size: 18px;
}

.modo-oscuro .leaderboard-info h4 {
  color: #e0e0e0;
}

.leaderboard-info p {
  margin: 0;
  color: #666;
  font-size: 14px;
}

.modo-oscuro .leaderboard-info p {
  color: #aaa;
}

.leaderboard-puntos {
  font-size: 24px;
  font-weight: 700;
  color: #C8102E;
}

.mi-posicion {
  background: white;
  border-radius: 15px;
  padding: 25px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.modo-oscuro .mi-posicion {
  background: #3d3d3d;
  border: 1px solid #555;
}

.mi-posicion h3 {
  margin: 0 0 15px 0;
  color: #333;
}

.modo-oscuro .mi-posicion h3 {
  color: #e0e0e0;
}

.posicion-card {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  background: rgba(200, 16, 46, 0.1);
  border-radius: 10px;
  border: 2px solid #41c810a3;
}

.posicion-numero {
  font-size: 32px;
  font-weight: 700;
  color: #c84110b0;
}

.posicion-info h4 {
  margin: 0 0 5px 0;
  color: #333;
  font-size: 18px;
}

.modo-oscuro .posicion-info h4 {
  color: #e0e0e0;
}

.posicion-info p {
  margin: 0;
  color: #666;
  font-size: 14px;
}

.modo-oscuro .posicion-info p {
  color: #aaa;
}

/* Responsive */
@media (max-width: 768px) {
  .dashboard-container {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    position: static;
  }
  
  .sidebar-menu {
    flex-direction: row;
    overflow-x: auto;
  }
  
  .menu-item {
    white-space: nowrap;
  }
  
  .materias-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .ejercicio-header {
    flex-direction: column;
  }
  
  .input-group {
    flex-direction: column;
  }
}

/* Animaciones adicionales */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.pulse {
  animation: pulse 2s infinite;
}
