/* ============================================ */
/* 1. FUENTES E IMPORTACIONES                  */
/* ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@400;600;700;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200');

/* ============================================ */
/* 2. VARIABLES Y TOKENS DE DISEÑO             */
/* ============================================ */
:root {
  /* Paleta principal */
  --color-primary:     #008542;
  --color-primary-700: #006b35;
  --color-accent:      #990000;
  --color-accent-400:  #f87171;

  /* Superficies (modo oscuro por defecto) */
  --bg:          #1b1d1f;
  --surface:     #242628;
  --surface-2:   #2e3032;
  --border:      rgba(0, 133, 66, 0.25);
  --border-strong:rgba(0, 133, 66, 0.5);

  /* Texto */
  --text:        #f0f2f5;
  --muted:       #94a3b8;
  --muted-light: #cbd5e1;

  /* Sombras y radios */
  --radius-md:  0.75rem;
  --radius-lg:  1rem;
  --radius-xl:  1.5rem;
  --shadow-card: 0 20px 50px -12px rgba(0, 0, 0, 0.4);
  --shadow-btn:  0 10px 15px -3px rgba(0, 133, 66, 0.3);

  /* Transición */
  --t: 0.2s ease;
}

/* Modo claro */
.light {
  --bg:        #f0f2f5;
  --surface:   #ffffff;
  --surface-2: #f1f5f9;
  --border:    rgba(0, 133, 66, 0.2);
  --border-strong: rgba(0, 133, 66, 0.4);
  --text:      #0a192f;
  --muted:     #475569;
  --muted-light:#64748b;
}

/* ============================================ */
/* 3. RESET Y BASE                             */
/* ============================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: 'Lexend', system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color var(--t), color var(--t);
}

img { display: block; max-width: 100%; }
a { color: inherit; }

.container {
  width: min(1100px, 92%);
  margin-inline: auto;
}

/* ============================================ */
/* 4. HEADER / NAVEGACIÓN                      */
/* ============================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(27, 29, 31, 0.9);
  backdrop-filter: saturate(150%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.light .site-header {
  background: rgba(240, 242, 245, 0.92);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 0;
  gap: 1rem;
}

/* Brand / logo */
.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  color: var(--text);
  padding: 0.2rem 0;
}
.brand-logo {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  object-fit: contain;
  border-radius: 50%;
  background: #fff;
  padding: 4px;
  border: 2px solid var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 133, 66, 0.15);
}
.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}
.brand-name {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--color-primary);
  line-height: 1.2;
}
.brand-sub {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.02em;
  line-height: 1;
}

/* Nav links */
.site-nav ul {
  display: flex;
  gap: 0.3rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  display: inline-block;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background var(--t), color var(--t);
}
.nav-link:hover { background: rgba(0, 133, 66, 0.1); color: var(--color-primary); }
.nav-link.active { background: var(--color-primary); color: #fff; }

/* Botón toggle móvil */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius-md);
}
.nav-toggle:hover { background: rgba(0, 133, 66, 0.1); }
.nav-toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  margin: 4px 0;
  background: var(--text);
  border-radius: 2px;
  transition: var(--t);
}

/* Botón de tema */
.theme-switch-button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.3rem;
  padding: 0.45rem;
  border-radius: var(--radius-md);
  color: var(--text);
  transition: background var(--t);
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-switch-button:hover { background: rgba(0, 133, 66, 0.1); }

/* ============================================ */
/* 5. HERO                                     */
/* ============================================ */
.hero { padding: 3.5rem 0 2.5rem; }
.hero-inner {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 2.5rem;
}

.hero-copy h1 {
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin: 0 0 0.6rem;
  color: var(--color-primary);
}
.hero-copy p {
  color: var(--muted);
  margin: 0 0 1.4rem;
  font-size: 1.05rem;
}

.hero-cta { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.hero-media img {
  width: 100%;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  object-fit: cover;
  max-height: 340px;
  border: 1px solid var(--border);
}

/* ============================================ */
/* 6. BOTONES                                  */
/* ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius-lg);
  text-decoration: none;
  font-family: 'Lexend', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: transform var(--t), background-color var(--t), border-color var(--t);
  cursor: pointer;
}
.btn:hover { transform: translateY(-2px); }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: var(--shadow-btn);
}
.btn-primary:hover { background: var(--color-primary-700); }

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

.btn-accent {
  background: var(--color-accent);
  color: #fff;
  box-shadow: 0 10px 15px -3px rgba(153, 0, 0, 0.3);
}
.btn-accent:hover { background: #7a0000; }

/* ============================================ */
/* 7. TARJETAS (CARDS)                         */
/* ============================================ */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: transform var(--t), box-shadow var(--t);
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 28px 60px -14px rgba(0, 0, 0, 0.45);
}

/* Barra de acento superior (degradado primario → acento) */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 4px;
  background: linear-gradient(to right, var(--color-primary), var(--color-accent));
}

.card h3 {
  margin: 0.3rem 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-primary);
}
.light .card h3 { color: var(--color-primary); }

.card p { margin: 0.2rem 0; color: var(--muted); font-size: 0.95rem; }

.card-cover {
  width: 100%;
  height: 155px;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
}

/* Card del estudiante */
.card.estudiante .chip { margin-top: 0.5rem; }

/* ============================================ */
/* 8. GRID LAYOUTS                             */
/* ============================================ */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.1rem;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.1rem;
}

/* ============================================ */
/* 9. CHIPS / BADGES                           */
/* ============================================ */
.chip {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,.12);
}
.chip-success {
  background: rgba(0, 133, 66, 0.15);
  color: #4ade80;
  border-color: rgba(0, 133, 66, 0.4);
}
.light .chip-success {
  color: var(--color-primary-700);
  border-color: rgba(0, 133, 66, 0.5);
}

/* Chip de periodo — verde=actual, rojo=anterior */
.chip-periodo {
  font-size: 0.75rem;
}
.chip-periodo--actual {
  background: rgba(0, 133, 66, 0.15);
  color: #4ade80;
  border-color: rgba(0, 133, 66, 0.4);
}
.light .chip-periodo--actual {
  color: var(--color-primary-700);
  border-color: rgba(0, 133, 66, 0.5);
}
.chip-periodo--anterior {
  background: rgba(153, 0, 0, 0.12);
  color: #f87171;
  border-color: rgba(153, 0, 0, 0.35);
}
.light .chip-periodo--anterior {
  color: var(--color-accent);
  border-color: rgba(153, 0, 0, 0.4);
}

/* ============================================ */
/* 10. SECCIÓN DE FEATURES / PUBLICACIONES     */
/* ============================================ */
.features { padding: 1.5rem 0 2.5rem; }
.features h2 {
  margin-top: 0;
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: -0.025em;
  color: var(--color-primary);
}

/* ============================================ */
/* 11. SECTION HEADING                         */
/* ============================================ */
.section-heading {
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: -0.025em;
  color: var(--color-primary);
  margin: 0 0 0.3rem;
}
.section-sub {
  color: var(--muted);
  margin: 0 0 1.2rem;
  font-size: 0.95rem;
}

/* ============================================ */
/* 12. CTA SECTION                             */
/* ============================================ */
.cta { padding: 2rem 0 3rem; }
.cta-inner {
  background: linear-gradient(135deg,
    rgba(0, 133, 66, 0.08) 0%,
    rgba(153, 0, 0, 0.05) 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 2rem 1.5rem;
  text-align: center;
}
.cta-inner h2 {
  margin-top: 0;
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--color-primary);
}
.cta-inner p { color: var(--muted); margin-bottom: 1.2rem; }

/* ============================================ */
/* 13. TOOLBAR / FILTROS                       */
/* ============================================ */
.toolbar {
  display: flex;
  gap: 0.6rem;
  margin: 1rem 0 1.4rem;
  flex-wrap: wrap;
}
.toolbar input[type="search"],
.toolbar select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-md);
  outline: none;
  width: 100%;
  font-family: 'Lexend', sans-serif;
  font-size: 0.9rem;
  transition: border-color var(--t), box-shadow var(--t);
}
.toolbar input[type="search"]:focus,
.toolbar select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 133, 66, 0.2);
}

/* ============================================ */
/* 14. SEPARADOR                               */
/* ============================================ */
.sep {
  border: 0;
  height: 1px;
  background: var(--border);
  margin: 2rem 0;
}

/* ============================================ */
/* 15. PÁGINA INTERNA                          */
/* ============================================ */
.page { padding: 2rem 0; }

/* ============================================ */
/* 16. VIDEOS                                  */
/* ============================================ */
.video-card video {
  width: 100%;
  border-radius: var(--radius-md);
  margin-top: 0.5rem;
  background: #000;
}

/* ============================================ */
/* 17. FOOTER                                  */
/* ============================================ */
.site-footer {
  padding: 1.2rem 0;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.footer-inner p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.footer-inner a { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.footer-inner a:hover { color: var(--color-primary); }
.footer-inner a[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }
.footer-nav { display: flex; gap: 1rem; }

/* ============================================ */
/* 18. HEADER ACTIONS                          */
/* ============================================ */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ============================================ */
/* 19. CARD DE ESTUDIANTE                      */
/* ============================================ */
.card-student-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}
.card-student-header h3 { margin: 0; }

.student-icon {
  color: var(--color-primary);
  font-size: 1.7rem;
}

.student-info {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.2rem 0.75rem;
  margin: 0 0 0.8rem;
  font-size: 0.9rem;
}
.student-info dt {
  color: var(--muted);
  font-weight: 600;
}
.student-info dd {
  margin: 0;
  color: var(--text);
}

.card-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  border-radius: var(--radius-md);
}
.btn-sm .material-symbols-outlined { font-size: 1rem !important; }

/* ============================================ */
/* 20. CONTADOR DE RESULTADOS                  */
/* ============================================ */
.results-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}
#contador-resultados {
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 600;
}

/* ============================================ */
/* 21. ESTADO VACÍO                            */
/* ============================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2.5rem 1rem;
  color: var(--muted);
  text-align: center;
  font-size: 1rem;
}
.empty-state .material-symbols-outlined {
  font-size: 2.5rem;
  color: var(--border-strong);
}

/* ============================================ */
/* 22. MODAL DE VIDEO                          */
/* ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.18s ease;
}
.modal-overlay[hidden] { display: none; }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  width: min(680px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.2s ease;
}
.light .modal-box {
  background: #fff;
}

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

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.25rem 1.5rem 0;
  gap: 1rem;
}
.modal-title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-primary);
}
.modal-subtitle {
  margin: 0.1rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 0.3rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  transition: background var(--t), color var(--t);
  flex-shrink: 0;
}
.modal-close:hover {
  background: rgba(153, 0, 0, 0.12);
  color: var(--color-accent);
}

.modal-body {
  padding: 1rem 1.5rem 1.5rem;
}

/* ============================================ */
/* 23. VIDEO EMBED (YouTube iframe + local)    */
/* ============================================ */
.video-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
}
.video-wrapper iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.video-local {
  width: 100%;
  border-radius: var(--radius-md);
  background: #000;
  display: block;
}

.video-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem;
  background: var(--surface-2);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--muted);
  text-align: center;
}
.video-placeholder .material-symbols-outlined {
  font-size: 2.2rem;
  color: var(--border-strong);
}
.video-placeholder p { margin: 0; font-size: 0.9rem; }

/* ============================================ */
/* 25. ZONA PRIVADA Y LOGIN                    */
/* ============================================ */

/* Encabezado de la zona privada */
.private-zone-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg,
    rgba(0, 133, 66, 0.06) 0%,
    rgba(153, 0, 0, 0.04) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* Card de login */
.login-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.6rem;
  padding: 2.5rem 2rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  max-width: 440px;
  margin: 0 auto;
}

.login-icon {
  font-size: 3rem !important;
  color: var(--color-primary);
  margin-bottom: 0.25rem;
}

.login-card h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.login-form {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.login-input {
  flex: 1;
  min-width: 0;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-md);
  font-family: 'Lexend', sans-serif;
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}
.login-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 133, 66, 0.2);
}

.login-error {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--color-accent);
  font-size: 0.88rem;
  font-weight: 600;
  margin: 0;
  padding: 0.5rem 0.8rem;
  background: rgba(153, 0, 0, 0.08);
  border: 1px solid rgba(153, 0, 0, 0.25);
  border-radius: var(--radius-md);
  width: 100%;
  justify-content: center;
}

/* Animación de error */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-5px); }
  80%       { transform: translateX(5px); }
}
.shake { animation: shake 0.45s ease; }

/* Barra de sesión activa */
.session-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: rgba(0, 133, 66, 0.08);
  border: 1px solid rgba(0, 133, 66, 0.3);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 1.2rem;
}
.light .session-bar {
  background: rgba(0, 133, 66, 0.06);
}

/* ============================================ */
/* 26. RESPONSIVO                              */
/* ============================================ */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .nav-toggle { display: block; }

  .site-nav {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    padding: 0.6rem;
    border-radius: var(--radius-lg);
    margin: 0.5rem;
    display: none;
    min-width: 200px;
    box-shadow: var(--shadow-card);
  }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; gap: 0.2rem; }

  .hero-cta { flex-direction: column; }
  .btn { width: 100%; justify-content: center; }

  .footer-inner { flex-direction: column; text-align: center; }
}