/* --- Texto de error --- */

.error-text {
  color: var(--color-danger);
  min-height: 1.2em;
}

/* --- Inputs / formularios --- */

input, select, textarea, button {
  font-family: inherit;
  font-size: 14px;
}

input[type="text"], input[type="email"], input[type="password"],
input[type="datetime-local"], input[type="time"], select, textarea {
  width: 100%;
  padding: 8px 10px;
  margin-bottom: var(--spacing);
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-elevated-2);
  color: var(--color-text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

textarea { min-height: 70px; resize: vertical; }

label { display: block; margin-bottom: 4px; color: var(--color-text-muted); font-size: 13px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0 12px;
  align-items: start;
}

.btn {
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary { background: var(--color-primary); color: white; border: none; }
.btn-secondary { background: transparent; color: var(--color-text); border: 1px solid var(--color-border); }
.btn-danger { background: transparent; color: var(--color-danger); border: 1px solid var(--color-danger); }
.btn-small { padding: 4px 10px; font-size: 12px; }

/* --- Filtros --- */

.filtros-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: var(--spacing);
  flex-wrap: wrap;
}
.filtros-row select { width: auto; margin-bottom: 0; }

/* --- Badges de estado / prioridad --- */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  margin-right: 6px;
}
.badges-row { display: flex; gap: 8px; flex-wrap: wrap; }

.badge-pendiente { background: rgba(154,160,171,0.15); color: var(--color-text-muted); }
.badge-en_progreso { background: rgba(79,140,255,0.15); color: var(--color-primary); }
.badge-completada { background: rgba(52,199,123,0.15); color: var(--color-success); }
.badge-atrasada { background: rgba(239,68,68,0.15); color: var(--color-danger); }
.badge-cancelada { background: rgba(154,160,171,0.15); color: var(--color-text-muted); text-decoration: line-through; }

.badge-baja { background: rgba(154,160,171,0.15); color: var(--color-text-muted); }
.badge-media { background: rgba(242,177,52,0.15); color: var(--color-warning); }
.badge-alta { background: rgba(239,68,68,0.15); color: var(--color-danger); }

/* --- Items de listas (materias / actividades) --- */

.item-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
}
.item-row:last-child { border-bottom: none; }

.item-titulo { font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.item-meta { color: var(--color-text-muted); font-size: 13px; margin-top: 2px; }
.item-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

.color-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }

.subtareas-lista { margin-top: 8px; padding-left: 4px; }
.subtareas-lista li { list-style: none; display: flex; align-items: center; gap: 6px; padding: 3px 0; }
.subtareas-lista li.completada span { text-decoration: line-through; color: var(--color-text-muted); }

.progreso-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--color-border);
  overflow: hidden;
  margin-top: 6px;
  width: 160px;
}
.progreso-bar-fill { height: 100%; background: var(--color-success); }

/* --- Checkbox (ej. "Recordarme en este equipo") --- */

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--spacing);
  font-size: 14px;
  color: var(--color-text-muted);
}
.check-row input[type="checkbox"] { width: auto; margin: 0; accent-color: var(--color-primary); }

/* --- Logo / avatar --- */

.logo-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--gradient-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.app-nombre { font-weight: 700; font-size: 16px; }

.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-bg-elevated-2);
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}

.usuario-chip { display: flex; align-items: center; gap: 8px; }

/* --- Botón de ícono (campanita, etc.) --- */

.btn-icon {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.btn-icon svg { width: 18px; height: 18px; }

/* --- Notificaciones --- */

.notif-wrap { position: relative; }

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--color-danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 300px;
  max-width: 90vw;
  max-height: 360px;
  overflow-y: auto;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  z-index: 30;
  padding: 8px;
}

.notif-item {
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.notif-item:hover { background: var(--color-bg-elevated-2); }
.notif-item .notif-titulo { font-weight: 600; }
.notif-item .notif-meta { color: var(--color-text-muted); font-size: 12px; }

/* --- Stat cards del dashboard --- */

.stat-card {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-card);
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.stat-card .stat-valor { font-size: 28px; font-weight: 700; margin-top: 2px; }
.stat-card .stat-nota { font-size: 12px; margin-top: 4px; color: var(--color-text-muted); }

/* --- Panel "Horario de hoy" --- */

.horario-hoy-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
}
.horario-hoy-item:last-child { border-bottom: none; }
.horario-hoy-item .barra-color { width: 4px; align-self: stretch; border-radius: 2px; flex-shrink: 0; }
.horario-hoy-item .horario-hoy-hora { font-size: 12px; color: var(--color-text-muted); width: 92px; flex-shrink: 0; }
.horario-hoy-item .horario-hoy-titulo { font-weight: 600; font-size: 14px; }
.horario-hoy-item .horario-hoy-meta { font-size: 12px; color: var(--color-text-muted); }

/* --- Accesos rápidos --- */

.acceso-rapido {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  width: 100%;
  color: var(--color-text);
}
.acceso-rapido:hover { border-color: var(--color-primary); }
.acceso-rapido .acceso-rapido-icono {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--color-bg-elevated-2);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.acceso-rapido .acceso-rapido-titulo { font-weight: 600; font-size: 14px; }
.acceso-rapido .acceso-rapido-meta { font-size: 12px; color: var(--color-text-muted); }

.login-card {
  max-width: 420px;
  margin: 10vh auto 0;
  text-align: center;
}
.login-card form { text-align: left; }

.login-logo { width: 200px; max-width: 70%; margin: 0 auto 8px; display: block; }

.nav-logo-img { width: 32px; height: auto; display: block; flex-shrink: 0; }

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

/* ================= Dashboard: banner + rendimiento ================= */

.saludo-banner {
  background: var(--gradient-primary);
  background: linear-gradient(135deg, rgba(99,102,241,0.30), rgba(139,92,246,0.12));
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.saludo-banner-info { flex: 2; min-width: 220px; }

.semestre-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--color-text-muted);
  background: var(--color-bg-elevated);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.dot-verde { width: 8px; height: 8px; border-radius: 50%; background: var(--color-success); display: inline-block; flex-shrink: 0; }

.saludo-banner h1 { font-size: 26px; margin-bottom: 6px; }
.saludo-banner p { margin: 0; max-width: 46ch; }

.rendimiento-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 12px 16px;
}

.rendimiento-ring-wrap { position: relative; width: 72px; height: 72px; flex-shrink: 0; }
.rendimiento-ring { width: 72px; height: 72px; transform: rotate(-90deg); }
.ring-fondo { fill: none; stroke: var(--color-border); stroke-width: 8; }
.ring-progreso {
  fill: none;
  stroke: var(--color-success);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s ease;
}
.rendimiento-ring-texto {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
}
.rendimiento-detalle-label { font-size: 12px; color: var(--color-text-muted); }
.rendimiento-detalle-valor { font-weight: 600; font-size: 14px; white-space: nowrap; }

/* ================= Stat cards con ícono ================= */

.stat-card-top { display: flex; justify-content: space-between; align-items: flex-start; }
.stat-icon {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  background: var(--color-bg-elevated-2);
}
.stat-icon-warning { background: rgba(245,158,11,0.15); }
.stat-icon-primary { background: rgba(99,102,241,0.15); }
.stat-icon-success { background: rgba(34,197,94,0.15); }
.stat-icon-danger { background: rgba(239,68,68,0.15); }

/* ================= Encabezados de sección ================= */

.seccion-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.seccion-header h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; }

.link-btn {
  background: none; border: none; color: var(--color-primary);
  font-size: 12px; font-weight: 600; cursor: pointer; padding: 0;
}

/* Alto mínimo para que las secciones no "salten" al pasar de vacío a con
   contenido, pero sin limitar su crecimiento hacia abajo. */
.min-altura-vacio { min-height: 56px; }

/* ================= Tarjetas de actividad (Hoy / Próximamente) ================= */

.proximo-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}
.proximo-item:last-child { border-bottom: none; }

.proximo-icono {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--color-bg-elevated-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}

.proximo-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.badge-materia {
  font-size: 11px; color: var(--color-text-muted);
  background: var(--color-bg-elevated-2);
  padding: 2px 8px; border-radius: 999px;
}
.proximo-titulo { font-weight: 600; font-size: 14px; }
.proximo-meta { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }

.despejado-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}
.despejado-icono { font-size: 26px; }

/* ================= Horario de hoy: timeline ================= */

.timeline-hoy { position: relative; padding-left: 18px; }
.timeline-hoy::before {
  content: "";
  position: absolute; left: 4px; top: 6px; bottom: 6px;
  width: 2px; background: var(--color-border);
}

.timeline-item { position: relative; padding-bottom: 18px; }
.timeline-item:last-child { padding-bottom: 0; }

.timeline-punto {
  position: absolute; left: -18px; top: 2px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--color-text-muted);
  border: 2px solid var(--color-bg-elevated);
}
.timeline-item.completada .timeline-punto { background: var(--color-success); }
.timeline-item.en_curso .timeline-punto {
  background: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.25);
}

.timeline-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.timeline-hora { font-size: 12px; color: var(--color-text-muted); }
.timeline-titulo { font-weight: 600; font-size: 14px; margin-top: 2px; }
.timeline-meta { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }

.horario-hoy-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--color-text-muted);
}

/* ================= CTA solo-mobile ================= */

.btn-cta-mobile { display: none; }
