/* =========================================================================
   Colegio Cristiano Gracia y Amor — Evaluación Institucional 2026
   Hoja de estilos propia (sin CDN). Fuente Inter servida localmente.
   ========================================================================= */

@font-face {
  font-family: "Inter";
  src: url("../assets/fonts/Inter-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../assets/fonts/Inter-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../assets/fonts/Inter-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../assets/fonts/Inter-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --brand-900: #003a66;
  --brand-800: #00426f;
  --brand-700: #005b9f;   /* azul institucional */
  --brand-600: #0670bd;
  --brand-500: #1b85d6;
  --brand-100: #e3f0fb;
  --brand-50:  #f2f8fd;

  --gray-900: #101828;
  --gray-700: #344054;
  --gray-600: #475467;
  --gray-500: #667085;
  --gray-300: #d0d5dd;
  --gray-200: #e4e7ec;
  --gray-100: #f2f4f7;
  --gray-50:  #f9fafb;

  --success-600: #17803d;
  --success-100: #e6f6ec;
  --error-600: #c81e3a;
  --error-100: #fbe7ea;
  --warning-600: #b7791f;
  --warning-100: #fdf3e0;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 14px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 12px 32px rgba(0, 58, 102, 0.14);
  --transition: 180ms ease;
}

/* ---------- Reset ---------- */
* , *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--gray-900);
  background: var(--gray-50);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

.container {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 0 20px;
}
.container-wide {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Topbar / Header institucional ---------- */
.topbar {
  background: linear-gradient(135deg, var(--brand-900), var(--brand-700) 60%, var(--brand-600));
  color: #fff;
  box-shadow: var(--shadow-md);
}
.topbar__inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 20px;
}
.topbar__logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: #fff;
  padding: 6px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  object-fit: contain;
}
.topbar__titles h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.topbar__titles p {
  font-size: 0.85rem;
  color: var(--brand-100);
  margin-top: 2px;
}
.topbar__badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- Hero / intro ---------- */
.hero {
  padding: 36px 0 8px;
  text-align: center;
}
.hero h2 {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--brand-900);
}
.hero p {
  margin-top: 10px;
  color: var(--gray-600);
  font-size: 0.98rem;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- Progreso ---------- */
.progress-wrap {
  max-width: 920px;
  margin: 22px auto 0;
  padding: 0 20px;
}
.progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--gray-200);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--brand-600), var(--brand-500));
  border-radius: 999px;
  transition: width 260ms ease;
}
.progress-label {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--gray-500);
  font-weight: 500;
}

/* ---------- Cards / secciones del formulario ---------- */
.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 26px 24px;
  margin: 22px 0;
}
.card__header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.card__index {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--brand-100);
  color: var(--brand-700);
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.card__header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--brand-900);
}
.card__header p {
  font-size: 0.82rem;
  color: var(--gray-500);
  margin-top: 2px;
}

/* ---------- Campos de formulario ---------- */
.field { margin-bottom: 20px; }
.field:last-child { margin-bottom: 0; }
.field__label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 8px;
}
.field__label .required {
  color: var(--error-600);
  margin-left: 3px;
}
.field__hint {
  font-size: 0.78rem;
  color: var(--gray-500);
  margin-top: 6px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
select,
textarea {
  width: 100%;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 0.94rem;
  font-family: inherit;
  color: var(--gray-900);
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand-600);
  box-shadow: 0 0 0 4px var(--brand-100);
}
.field.field--error input,
.field.field--error select,
.field.field--error textarea {
  border-color: var(--error-600);
  box-shadow: 0 0 0 4px var(--error-100);
}
.field__error {
  display: none;
  align-items: center;
  gap: 6px;
  color: var(--error-600);
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 7px;
}
.field.field--error .field__error { display: flex; }

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23475467' stroke-width='2.2'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 38px;
}

/* ---------- Escala Likert ---------- */
.likert {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
@media (max-width: 560px) {
  .likert { grid-template-columns: repeat(2, 1fr); }
}
.likert__option {
  position: relative;
}
.likert__option input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
  margin: 0;
}
.likert__option span {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 54px;
  padding: 8px 6px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--gray-600);
  transition: all var(--transition);
}
.likert__option input:checked + span {
  border-color: var(--brand-700);
  background: var(--brand-100);
  color: var(--brand-800);
}
.likert__option input:focus-visible + span {
  box-shadow: 0 0 0 3px var(--brand-100);
}
.likert__option:nth-child(1) input:checked + span { border-color: var(--success-600); background: var(--success-100); color: var(--success-600); }
.likert__option:nth-child(4) input:checked + span { border-color: var(--error-600); background: var(--error-100); color: var(--error-600); }

.field--error .likert__option span { border-color: var(--error-600); }

/* Variante de 5 opciones (incluye "No aplica"), usada en la evaluación de directivos */
.likert--5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 680px) { .likert--5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 420px) { .likert--5 { grid-template-columns: repeat(2, 1fr); } }

.likert__option--na span { color: var(--gray-500); }
.likert__option--na input:checked + span {
  border-color: var(--gray-500);
  background: var(--gray-100);
  color: var(--gray-700);
}

/* ---------- Tarjetas de directivos (Rector, Coordinadora, Orientador) ---------- */
.leader-card {
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-lg);
  background: var(--gray-50);
  padding: 20px;
  margin-bottom: 18px;
}
.leader-card:last-child { margin-bottom: 0; }
.leader-card__header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--gray-300);
}
.leader-card__avatar {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: var(--brand-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.leader-card__name {
  font-weight: 700;
  color: var(--brand-900);
  font-size: 0.98rem;
}
.leader-card__role {
  font-size: 0.76rem;
  color: var(--brand-600);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-top: 2px;
}

/* ---------- Selector de docentes + tarjetas dinámicas ---------- */
.teacher-picker-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.teacher-picker-row select {
  flex: 1 1 240px;
}
.btn-add-teacher {
  flex: 0 0 auto;
  white-space: nowrap;
  background: var(--brand-700);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-add-teacher:hover {
  background: var(--brand-800);
  box-shadow: var(--shadow-md);
}

#teacherCardsContainer {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 18px;
}

.teacher-card {
  background: #fff;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  animation: toast-in 200ms ease;
}
.teacher-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--gray-200);
}
.teacher-card__name {
  font-weight: 700;
  color: var(--brand-800);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.teacher-card__remove {
  flex-shrink: 0;
  background: var(--error-100);
  color: var(--error-600);
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  transition: background var(--transition);
}
.teacher-card__remove:hover {
  background: #f8d3da;
}

.teacher-empty-hint {
  text-align: center;
  color: var(--gray-500);
  font-size: 0.85rem;
  font-style: italic;
  border: 1.5px dashed var(--gray-300);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-top: 18px;
}

#teacherSectionError {
  display: none;
  align-items: center;
  gap: 6px;
  color: var(--error-600);
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 12px;
}
#teacherSection.teacher-section--error {
  border: 1.5px solid var(--error-600);
  background: var(--error-100);
  border-radius: var(--radius-md);
  padding: 14px;
}
#teacherSection.teacher-section--error #teacherSectionError {
  display: flex;
}
#teacherSection.teacher-section--error .teacher-empty-hint {
  border-color: var(--error-600);
  background: #fff;
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 26px;
  font-size: 0.95rem;
  font-weight: 700;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}
.btn-primary {
  background: linear-gradient(135deg, var(--brand-700), var(--brand-600));
  color: #fff;
  box-shadow: var(--shadow-md);
  width: 100%;
}
.btn-primary:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.65; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-secondary {
  background: #fff;
  color: var(--brand-700);
  border: 1.5px solid var(--brand-200, var(--gray-300));
}
.btn-secondary:hover { background: var(--brand-50); }

.submit-bar { margin: 30px 0 60px; }
.submit-note {
  text-align: center;
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-top: 12px;
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 26px 20px 40px;
  color: var(--gray-500);
  font-size: 0.8rem;
}

/* ---------- Toast / notificaciones (reemplaza alert()) ---------- */
.toast-stack {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
  width: calc(100% - 40px);
}
@media (max-width: 480px) {
  .toast-stack { left: 20px; right: 20px; max-width: none; }
}
.toast {
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--brand-600);
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: toast-in 220ms ease;
}
.toast.toast--success { border-left-color: var(--success-600); }
.toast.toast--error { border-left-color: var(--error-600); }
.toast.toast--warning { border-left-color: var(--warning-600); }
.toast__icon {
  width: 22px; height: 22px; flex-shrink: 0; margin-top: 1px;
}
.toast__title { font-weight: 700; font-size: 0.88rem; color: var(--gray-900); }
.toast__msg { font-size: 0.82rem; color: var(--gray-600); margin-top: 2px; }
.toast__close {
  background: none; border: none; color: var(--gray-500);
  font-size: 1rem; line-height: 1; margin-left: auto; padding: 2px;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Modal (overlay de carga / éxito) ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.55);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  padding: 20px;
}
.modal-overlay.is-open { display: flex; }
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 34px 30px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: modal-in 200ms ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
.modal__icon {
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal__icon--success { background: var(--success-100); color: var(--success-600); }
.modal__icon--error { background: var(--error-100); color: var(--error-600); }
.modal__icon--loading { background: var(--brand-100); color: var(--brand-700); }
.modal h3 { font-size: 1.1rem; font-weight: 700; color: var(--gray-900); margin-bottom: 8px; }
.modal p { font-size: 0.88rem; color: var(--gray-600); }
.modal .btn { margin-top: 22px; }

.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--brand-100);
  border-top-color: var(--brand-700);
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================================
   DASHBOARD
   ========================================================================= */
.dash-header {
  background: linear-gradient(135deg, var(--brand-900), var(--brand-700));
  color: #fff;
  padding: 24px 0;
  box-shadow: var(--shadow-md);
}
.dash-header__inner {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.dash-header__logo {
  width: 48px; height: 48px; border-radius: 12px; background: #fff; padding: 5px; object-fit: contain;
}
.dash-header h1 { font-size: 1.2rem; font-weight: 700; }
.dash-header p { font-size: 0.82rem; color: var(--brand-100); margin-top: 2px; }
.dash-header__actions { margin-left: auto; display: flex; gap: 10px; }

.dash-body { padding: 28px 0 60px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 26px;
}
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .stat-grid { grid-template-columns: 1fr; } }

.stat-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.stat-card__label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.stat-card__value {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--brand-800);
  margin-top: 6px;
}
.stat-card__sub {
  font-size: 0.78rem;
  color: var(--gray-500);
  margin-top: 4px;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
@media (max-width: 980px) { .dash-grid { grid-template-columns: 1fr; } }

.panel {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px;
}
.panel h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--brand-900);
  margin-bottom: 4px;
}
.panel__sub {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-bottom: 16px;
}
.chart-box { position: relative; height: 300px; }
.chart-box.chart-box--tall { height: 420px; }

.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.filter-bar select, .filter-bar input {
  width: auto;
  min-width: 200px;
}

.table-wrap { overflow-x: auto; }
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.data-table th, .data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
.data-table th {
  background: var(--gray-50);
  color: var(--gray-600);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  position: sticky;
  top: 0;
}
.data-table tr:hover td { background: var(--brand-50); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}
.badge--good { background: var(--success-100); color: var(--success-600); }
.badge--mid { background: var(--warning-100); color: var(--warning-600); }
.badge--low { background: var(--error-100); color: var(--error-600); }

.comment-list { max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.comment-item {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.85rem;
  color: var(--gray-700);
}
.comment-item__meta {
  font-size: 0.72rem;
  color: var(--gray-500);
  margin-bottom: 4px;
  font-weight: 600;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-500);
}
.empty-state h3 { color: var(--gray-700); margin-bottom: 8px; }

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 0;
  color: var(--gray-500);
  font-weight: 600;
  font-size: 0.9rem;
}

/* Utility */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
