/* ===== Boletines Académicos — Diseño moderno ===== */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg: #f0f4f8;
  --bg-subtle: #e8eef4;
  --card: #ffffff;
  --border: #e2e8f0;
  --border-light: #eef2f6;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-soft: #94a3b8;
  --primary: #0f766e;
  --primary-hover: #0d9488;
  --primary-light: #ccfbf1;
  --primary-bg: #f0fdfa;
  --accent: #7c3aed;
  --accent-light: #ede9fe;
  --success: #059669;
  --success-bg: #d1fae5;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --warning: #d97706;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow: 0 1px 3px rgba(0,0,0,.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.1);
  --transition: 0.2s ease;
  /* Colores por sección (por defecto teal) */
  --section: #0f766e;
  --section-light: #f0fdfa;
}

/* Paleta por sección — cada una distinta pero armónica */
body.page-dashboard   { --section: #0f766e; --section-light: #f0fdfa; }
body.page-estudiantes { --section: #1d4ed8; --section-light: #eff6ff; }
body.page-calificaciones { --section: #6d28d9; --section-light: #f5f3ff; }
body.page-ver_boletin { --section: #b45309; --section-light: #fffbeb; }
body.page-docentes    { --section: #047857; --section-light: #ecfdf5; }
body.page-grupos      { --section: #4338ca; --section-light: #eef2ff; }
body.page-materias    { --section: #a21caf; --section-light: #fdf4ff; }
body.page-configuracion { --section: #334155; --section-light: #f1f5f9; }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.layout { display: flex; min-height: 100vh; }

/* ===== Sidebar ===== */
.sidebar {
  width: 280px;
  background: linear-gradient(180deg, #0f766e 0%, #0d5c55 100%);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: 4px 0 24px rgba(15, 118, 110, .15);
}

.sidebar-header {
  padding: 1.75rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.logo {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.logo-sub {
  font-size: 0.8rem;
  color: rgba(255,255,255,.75);
  font-weight: 500;
  margin-top: 0.15rem;
  display: block;
}

.nav {
  flex: 1;
  padding: 1rem 0.75rem;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  margin: 0 0.5rem;
  margin-bottom: 0.25rem;
  color: rgba(255,255,255,.9);
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
}

.nav-link:hover {
  background: rgba(255,255,255,.12);
  color: #fff;
}

.nav-link.active {
  background: rgba(255,255,255,.2);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
  border-left: 4px solid var(--section);
}

.sidebar-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.08);
}

.user-name {
  margin: 0 0 0.2rem 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
}

.user-rol {
  margin: 0 0 0.75rem 0;
  font-size: 0.8rem;
  color: rgba(255,255,255,.7);
  text-transform: capitalize;
}

.btn-logout {
  display: block;
  width: 100%;
  padding: 0.6rem 1rem;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: var(--radius);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition);
}

.btn-logout:hover {
  background: rgba(255,255,255,.25);
  border-color: rgba(255,255,255,.4);
  color: #fff;
}

.sidebar-footer p:last-child a {
  font-size: 0.85rem;
  color: rgba(255,255,255,.8);
  text-decoration: none;
  margin-top: 0.5rem;
  display: inline-block;
}

.sidebar-footer p:last-child a:hover { color: #fff; text-decoration: underline; }

.link-portal {
  font-size: 0.85rem;
  margin-top: 0.5rem;
  display: inline-block;
  color: rgba(255,255,255,.8);
  text-decoration: none;
}
.link-portal:hover { color: #fff; text-decoration: underline; }

/* ===== Main content ===== */
.main {
  flex: 1;
  padding: 2rem 2.5rem;
  overflow: auto;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  border-left: 4px solid var(--section);
  background: linear-gradient(90deg, var(--section-light) 0%, var(--bg) 200px);
}

.main h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.5rem 0;
  letter-spacing: -0.02em;
  padding-bottom: 0.5rem;
  border-bottom: 3px solid var(--section);
  display: inline-block;
}

.main .page-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  margin: 0 0 1.75rem 0;
  font-weight: 500;
}

/* ===== Stat cards (dashboard) ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), transform var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--section);
  line-height: 1.2;
  margin-bottom: 0.25rem;
}

.stat-card .stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-card.accent .stat-value { color: #6d28d9; }
.stat-card.success .stat-value { color: #047857; }

/* ===== Cards ===== */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
  transition: box-shadow var(--transition);
}

.card:hover { box-shadow: var(--shadow-md); }

.card.card-primary {
  border-left: 4px solid var(--section);
  background: linear-gradient(135deg, var(--section-light) 0%, var(--card) 35%);
}

.card h2 {
  margin: 0 0 0.75rem 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
}

.card p {
  margin: 0 0 1rem 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.card ol, .card ul {
  margin: 0;
  padding-left: 1.35rem;
  line-height: 1.85;
  color: var(--text);
}

.card li { margin-bottom: 0.5rem; }

.card li a {
  color: var(--section);
  font-weight: 500;
  text-decoration: none;
}

.card li a:hover { text-decoration: underline; }

.card-links {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
  font-size: 0.9rem;
}

.card-links a {
  color: var(--section);
  font-weight: 500;
  text-decoration: none;
  margin-right: 1rem;
}

.card-links a:hover { text-decoration: underline; }

/* ===== Period summary cards ===== */
.period-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.period-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.25rem;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition);
}

.period-card:hover { box-shadow: var(--shadow-md); }

.period-card .period-name {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.period-card .period-avg {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--section);
  margin-bottom: 0.25rem;
}

.period-card .period-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.period-card .period-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin-top: 0.75rem;
  overflow: hidden;
}

.period-card .period-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--section), color-mix(in srgb, var(--section) 80%, black));
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* ===== Filters ===== */
.filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  align-items: flex-end;
  padding: 1.25rem;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow);
}

.filters label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
}

.filters select {
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 180px;
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--card);
  color: var(--text);
  transition: border-color var(--transition);
}

.filters select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* ===== Tables ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--card);
}

.data-table th,
.data-table td {
  padding: 0.9rem 1.25rem;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.data-table th {
  background: var(--bg-subtle);
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tbody tr {
  transition: background var(--transition);
}

.data-table tbody tr:hover {
  background: var(--section-light);
}

/* ===== Buttons ===== */
.btn-primary {
  padding: 0.7rem 1.5rem;
  background: linear-gradient(135deg, var(--section) 0%, color-mix(in srgb, var(--section) 85%, black) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: inherit;
  transition: box-shadow var(--transition), transform var(--transition);
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: inherit;
  text-decoration: underline;
  padding: 0;
}
.btn-link:hover { color: var(--primary-hover); }
.btn-primary:hover {
  box-shadow: 0 4px 14px color-mix(in srgb, var(--section) 40%, transparent);
  transform: translateY(-1px);
}

/* ===== Messages ===== */
.msg {
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  font-weight: 500;
  font-size: 0.95rem;
}

.msg.success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(5, 150, 105, .3);
}

.msg.error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(220, 38, 38, .3);
}

/* ===== Login ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--primary-bg) 0%, var(--bg) 50%);
  padding: 1.5rem;
}

.login-card {
  max-width: 420px;
  width: 100%;
  background: var(--card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  border: 1px solid var(--border-light);
}

.login-title {
  margin: 0 0 0.25rem 0;
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  letter-spacing: -0.02em;
}

.login-subtitle {
  margin: 0 0 1.75rem 0;
  color: var(--text-muted);
  text-align: center;
  font-size: 0.95rem;
}

.login-form label {
  display: block;
  margin-bottom: 1rem;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
}

.login-form input {
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.login-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.login-error {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.login-hint {
  margin: 1.5rem 0 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

/* ===== Forms inside cards ===== */
.card label {
  display: block;
  margin-bottom: 0.75rem;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
}

.card input[type="text"],
.card input[type="email"],
.card input[type="number"] {
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.95rem;
  max-width: 100%;
}

.card input:focus {
  outline: none;
  border-color: var(--section);
  box-shadow: 0 0 0 2px var(--section-light);
}

/* ===== Section titles ===== */
.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 1rem 0;
}

/* ===== Desempeño (Decreto 1290) ===== */
.desempeño { font-weight: 600; padding: 0.2rem 0.5rem; border-radius: 6px; }
.desempeño-bajo { background: var(--danger-bg); color: var(--danger); }
.desempeño-básico { background: #fef3c7; color: #b45309; }
.desempeño-alto { background: #dbeafe; color: #1d4ed8; }
.desempeño-superior { background: var(--success-bg); color: var(--success); }

/* ===== Boletín oficial ===== */
.boletin-oficial .boletin-header { margin-bottom: 1rem; }
.boletin-lema { font-style: italic; color: var(--text-muted); margin: 0.25rem 0; }
.boletin-titulo { font-size: 1.1rem; margin: 1rem 0; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
.boletin-datos p, .boletin-progreso p { margin: 0.35rem 0; }
.boletin-tabla { margin: 1rem 0; }
.lista-descriptores { margin: 0.35rem 0; padding-left: 1.25rem; }
.foto-boletin { width: 100px; height: 120px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
@media print {
  .foto-boletin { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ===== Print ===== */
@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .card, .stat-card, .period-card { box-shadow: none; border: 1px solid #ddd; }
  .boletin-oficial { max-width: 100%; }
  .desempeño-bajo, .desempeño-básico, .desempeño-alto, .desempeño-superior { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; }
  .main { padding: 1.5rem 1.25rem; }
  .stats-grid { grid-template-columns: 1fr; }
  .period-grid { grid-template-columns: 1fr; }
}
