/* ═══════════════════════════════════════════════════════
   SENA INGLÉS — Sistema de Gestión de Actividades
   Tema: Institucional con acento verde SENA
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --verde: #39A900;
  --verde-oscuro: #2d8500;
  --verde-claro: #e8f7e0;
  --azul: #003D6B;
  --azul-claro: #e0ebf4;
  --gris: #f4f6f9;
  --gris-borde: #d8dee7;
  --texto: #1a2233;
  --texto-suave: #5a6780;
  --blanco: #ffffff;
  --rojo: #e53935;
  --amarillo: #f59e0b;
  --radio: 10px;
  --sombra: 0 2px 12px rgba(0,0,0,0.08);
  --sombra-hover: 0 6px 24px rgba(57,169,0,0.15);
  --font: 'Sora', sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

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

body {
  font-family: var(--font);
  background: var(--gris);
  color: var(--texto);
  min-height: 100vh;
  line-height: 1.6;
}

/* ── LAYOUT ─────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: 64px 1fr;
  min-height: 100vh;
}

/* ── TOPBAR ─────────────────────────────────────────── */
.topbar {
  grid-column: 1 / -1;
  background: var(--azul);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 100;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--blanco);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.topbar-logo span { color: var(--verde); }

.topbar-spacer { flex: 1; }

.topbar-user {
  color: rgba(255,255,255,0.75);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-rol {
  background: var(--verde);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── SIDEBAR ─────────────────────────────────────────── */
.sidebar {
  background: var(--blanco);
  border-right: 1px solid var(--gris-borde);
  padding: 24px 0;
  overflow-y: auto;
}

.sidebar-section {
  padding: 0 16px;
  margin-bottom: 8px;
}

.sidebar-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--texto-suave);
  padding: 12px 8px 6px;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radio);
  color: var(--texto-suave);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.18s;
}

.sidebar a:hover { background: var(--verde-claro); color: var(--verde-oscuro); }
.sidebar a.active { background: var(--verde-claro); color: var(--verde-oscuro); font-weight: 600; }
.sidebar a .icon { font-size: 1rem; width: 20px; text-align: center; }

.sidebar-logout {
  margin: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--gris-borde);
}

/* ── MAIN CONTENT ────────────────────────────────────── */
.main {
  padding: 28px 32px;
  overflow-y: auto;
}

.page-header {
  margin-bottom: 24px;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--azul);
  letter-spacing: -0.02em;
}

.page-subtitle {
  color: var(--texto-suave);
  font-size: 0.9rem;
  margin-top: 4px;
}

/* ── CARDS ───────────────────────────────────────────── */
.card {
  background: var(--blanco);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 24px;
  border: 1px solid var(--gris-borde);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--azul);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--verde-claro);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--blanco);
  border-radius: var(--radio);
  padding: 20px;
  border: 1px solid var(--gris-borde);
  box-shadow: var(--sombra);
  text-align: center;
}

.stat-num {
  font-size: 2rem;
  font-weight: 700;
  color: var(--verde);
  font-family: var(--mono);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--texto-suave);
  margin-top: 4px;
}

/* ── GRID ────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* ── TABLA ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th {
  background: var(--azul);
  color: var(--blanco);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
}

th:first-child { border-radius: var(--radio) 0 0 0; }
th:last-child { border-radius: 0 var(--radio) 0 0; }

td { padding: 10px 14px; border-bottom: 1px solid var(--gris-borde); vertical-align: middle; }
tr:hover td { background: var(--gris); }
tr:last-child td { border-bottom: none; }

/* ── FORMULARIOS ─────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--texto-suave);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], select, textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gris-borde);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--texto);
  background: var(--blanco);
  transition: border-color 0.18s, box-shadow 0.18s;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--verde);
  box-shadow: 0 0 0 3px rgba(57,169,0,0.12);
}

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

/* ── BOTONES ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 8px;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.85rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s;
  white-space: nowrap;
}

.btn-primary { background: var(--verde); color: white; }
.btn-primary:hover { background: var(--verde-oscuro); box-shadow: var(--sombra-hover); }

.btn-secondary { background: var(--azul); color: white; }
.btn-secondary:hover { background: #002d52; }

.btn-danger { background: var(--rojo); color: white; }
.btn-danger:hover { background: #c62828; }

.btn-outline {
  background: transparent;
  color: var(--verde);
  border: 1.5px solid var(--verde);
}
.btn-outline:hover { background: var(--verde-claro); }

.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-ghost { background: var(--gris); color: var(--texto-suave); }
.btn-ghost:hover { background: var(--gris-borde); }

/* ── BADGES ──────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.badge-success { background: var(--verde-claro); color: var(--verde-oscuro); }
.badge-danger { background: #fdecea; color: var(--rojo); }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: var(--azul-claro); color: var(--azul); }
.badge-gray { background: var(--gris); color: var(--texto-suave); }

/* ── PROGRESS ────────────────────────────────────────── */
.progress-wrap { background: var(--gris-borde); border-radius: 20px; height: 8px; overflow: hidden; }
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--verde), var(--verde-oscuro));
  border-radius: 20px;
  transition: width 0.6s ease;
}

.progress-label {
  font-size: 0.75rem;
  color: var(--texto-suave);
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}

/* ── ALERTS ──────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-success { background: var(--verde-claro); color: var(--verde-oscuro); border-left: 4px solid var(--verde); }
.alert-error { background: #fdecea; color: #b71c1c; border-left: 4px solid var(--rojo); }
.alert-warning { background: #fef3c7; color: #78350f; border-left: 4px solid var(--amarillo); }

/* ── MÓDULO CARD (aprendiz) ──────────────────────────── */
.modulo-card {
  background: var(--blanco);
  border-radius: 12px;
  border: 1.5px solid var(--gris-borde);
  padding: 20px;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.modulo-card:hover:not(.blocked) {
  border-color: var(--verde);
  box-shadow: var(--sombra-hover);
  transform: translateY(-2px);
}

.modulo-card.blocked {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--gris);
}

.modulo-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.modulo-num {
  background: var(--azul);
  color: white;
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700;
}

/* ── ACTIVIDAD CARD ──────────────────────────────────── */
.act-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid var(--gris-borde);
  background: var(--blanco);
  margin-bottom: 8px;
  transition: all 0.18s;
}
.act-item:hover { border-color: var(--verde); }

.act-icon {
  width: 38px; height: 38px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.act-icon.blog { background: var(--azul-claro); }
.act-icon.juego { background: #fef3c7; }
.act-icon.evaluacion { background: #fdecea; }

/* ── SWITCH ──────────────────────────────────────────── */
.switch-wrap { display: flex; align-items: center; gap: 8px; }
.switch {
  position: relative;
  width: 40px; height: 22px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0;
  background: var(--gris-borde);
  border-radius: 22px;
  cursor: pointer;
  transition: 0.2s;
}
.slider::before {
  content: '';
  position: absolute;
  height: 16px; width: 16px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}
input:checked + .slider { background: var(--verde); }
input:checked + .slider::before { transform: translateX(18px); }

/* ── LOGIN PAGE ──────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--azul) 0%, #005a9e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--blanco);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--azul);
}

.login-logo span { color: var(--verde); }
.login-logo p { color: var(--texto-suave); font-size: 0.85rem; margin-top: 4px; }

/* ── RICH TEXT CONTENT ───────────────────────────────── */
.rich-content { line-height: 1.8; }
.rich-content h2, .rich-content h3 { color: var(--azul); margin: 16px 0 8px; }
.rich-content p { margin-bottom: 12px; }
.rich-content img { max-width: 100%; border-radius: 8px; }

/* ── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ── UTILIDADES ──────────────────────────────────────── */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-12 { margin-top: 12px; }
.mt-20 { margin-top: 20px; }
.mb-16 { margin-bottom: 16px; }
.text-muted { color: var(--texto-suave); font-size: 0.85rem; }
.text-right { text-align: right; }
.fw-600 { font-weight: 600; }
.w-100 { width: 100%; }
