/* ═══════════════════════════════════════════════════════════════
   UNIQA — Sistema de diseño oficial
   ═══════════════════════════════════════════════════════════════ */

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

/* ── Tokens ──────────────────────────────────────────────────── */
:root {
/* ── Colores Principales ──────────────────────────────────────────────────── */
  --primary:          #C17C45;  /* Grullo — color principal */
  --primary-soft:     #BAB58D;  /* Sage — variante suave */
  --primary-fixed:    #f0ebe3;  /* Tono muy claro para fondos activos */
  --secondary:        #8a7a6a;  /* Grullo oscurecido para secundario */
  --sec-container:    #ede5d8;  /* Contenedor secundario cálido */
  --on-sec-container: #4a3f33;  /* Texto sobre contenedor secundario */

/* ── Fondos y superficies ──────────────────────────────────────────────────── */
  --bg:               #f4e9d3;  /* Old Lace — fondo principal */
  --surface:          #f4e9d3;  /* Old Lace — superficies */
  --surface-1:        #FAF1E0;  /* Tono ligeramente más oscuro */
  --surface-2:        #ede0c8;  /* Superficie 2 */
  --surface-3:        #e4d5b8;  /* Superficie 3 */

/* ── Texto ──────────────────────────────────────────────────── */
  --on-surface:       #583722;  /* Texto principal sobre fondo */
  --on-variant:       #6b5c4a;  /* Texto secundario / variante */

/* ── Bordes ──────────────────────────────────────────────────── */
  --outline:          #BAB58D;  /* Sage — bordes */
  --outline-soft:     #d9d3b8;  /* Borde suave */
  --accent:           #9b8573;  /* Cooper — acento/énfasis */
  --accent-soft:      #e8c9a0;  /* Cooper suave */
  
/* ── Estados ──────────────────────────────────────────────────── */
  --success:          #4a7c59;  /* Verde oscuro para éxito */
  --danger:           #b94040;  /* Rojo oscuro para errores */
  --warning:          #c97a30;  /* Naranja oscuro para advertencias */
  --info:             #4a6b8a;  /* Azul oscuro para información */
  --on-primary:       #ffffff;  /* Texto sobre color primario */
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-weight: 300;
  background: var(--bg);
  color: var(--on-surface);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Tipografía ──────────────────────────────────────────────── */
.font-display   { font-family: 'Caveat', cursive; font-weight: 500; }
.font-display-i { font-family: 'Caveat', cursive; font-weight: 500; }
.font-mono      { font-family: 'JetBrains Mono', monospace; }

/* ── Material Symbols ────────────────────────────────────────── */
.ms {
  font-family: 'Material Symbols Outlined';
  font-size: 24px;
  line-height: 1;
  font-variation-settings: 'opsz' 24, 'wght' 300, 'FILL' 0, 'GRAD' 0;
  display: inline-block;
  vertical-align: middle;
  user-select: none;
}
.ms-sm { font-size: 20px; }
.ms-xs { font-size: 16px; }

/* ── Cards ───────────────────────────────────────────────────── */
.ucard {
  background: var(--surface);
  border-radius: 16px;
  padding: 1.5rem;
  border: 1px solid var(--outline-soft);
}

/* ── Botones ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 9999px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn:hover { opacity: 0.88; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-ghost {
  background: transparent;
  color: var(--on-surface);
  border: 1px solid var(--outline-soft);
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-icon { padding: 8px; border-radius: 50%; border: 1px solid var(--outline-soft); }
.btn-full { width: 100%; justify-content: center; }

/* ── Nav items ───────────────────────────────────────────────── */
.navitem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--on-variant);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.navitem:hover { background: var(--surface-2); color: var(--on-surface); }
.navitem.active { background: var(--primary-fixed); color: var(--primary); }

/* ── Inputs ──────────────────────────────────────────────────── */
.ulabel {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--on-variant);
  margin-bottom: 6px;
}
.uinput {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--outline-soft);
  background: var(--surface-1);
  color: var(--on-surface);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.uinput:focus { border-color: var(--primary); }
.uinput::placeholder { color: var(--outline); }

/* ── Pills ───────────────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.pill-clay  { background: var(--primary-fixed);  color: var(--primary); }
.pill-soft  { background: var(--surface-2);       color: var(--on-variant); }
.pill-warn  { background: #fef3e2;                color: var(--warning); }
.pill-err   { background: #fde8e8;                color: var(--danger); }
.pill-info  { background: #e8f0fe;                color: var(--info); }
.pill-ok    { background: #e6f4ea;                color: var(--success); }

/* ── Eyebrow ─────────────────────────────────────────────────── */
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ── Photo placeholder ───────────────────────────────────────── */
.photo-ph {
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.photo-ph img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}
.ph-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--outline);
  opacity: 0.7;
  text-align: center;
  padding: 8px;
}

/* ── Animaciones ─────────────────────────────────────────────── */
@keyframes fadeup {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.anim-fadeup { animation: fadeup 0.25s ease both; }

@keyframes spin {
  to { transform: rotate(360deg); }
}
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--outline-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Toast ───────────────────────────────────────────────────── */
.uniqa-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: #1b1c19;
  color: #f5f1e8;
  padding: 12px 22px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.22);
  animation: fadeup 0.2s ease both;
  white-space: nowrap;
}

/* ── Modal ───────────────────────────────────────────────────── */
.uniqa-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(20,15,10,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.uniqa-modal {
  background: var(--bg);
  border-radius: 20px;
  padding: 2rem;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.uniqa-modal-sm { max-width: 480px; }
.uniqa-modal-md { max-width: 640px; }
.uniqa-modal-lg { max-width: 860px; }

/* ── Layout helpers ──────────────────────────────────────────── */
.max-content { max-width: 1400px; margin: 0 auto; padding: 0 40px; }
@media (max-width: 768px) { .max-content { padding: 0 20px; } }

/* ── Admin dark mode ─────────────────────────────────────────── */
body.admin-dark {
  --bg:           #1a1814;
  --surface:      #1f1c17;
  --surface-1:    #26221b;
  --surface-2:    #2d2820;
  --surface-3:    #342f26;
  --on-surface:   #f0ece4;
  --on-variant:   #b8a98e;
  --outline-soft: #3d3828;
}

/* ── Sidebar layout ──────────────────────────────────────────── */
.with-sidebar { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--surface-1);
  border-right: 1px solid var(--outline-soft);
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow-y: auto;
}

.sidebar-content { flex: 1; }

.main-content { flex: 1; min-width: 0; padding: 40px; }

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { padding: 20px; }
}

/* ── Topbar mobile ───────────────────────────────────────────── */
.topbar-mobile {
  display: none;
  position: sticky;
  top: 0;
  z-index: 40;
  height: 64px;
  padding: 0 20px;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  border-bottom: 1px solid var(--outline-soft);
}
@media (max-width: 768px) { .topbar-mobile { display: flex; } }

/* ── Mobile nav overlay ──────────────────────────────────────── */
.mobile-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  top: 64px;
  z-index: 30;
  background: var(--bg);
  padding: 20px;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}
.mobile-nav-overlay.open { display: flex; }

/* ── Tabla ───────────────────────────────────────────────────── */
.utable { width: 100%; border-collapse: collapse; font-size: 14px; }
.utable th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--on-variant);
  border-bottom: 1px solid var(--outline-soft);
}
.utable td { padding: 12px 14px; border-bottom: 1px solid var(--outline-soft); }
.utable tr:last-child td { border-bottom: none; }
.utable tr:hover td { background: var(--surface-1); }

/* ── Stat card ───────────────────────────────────────────────── */
.stat-card .stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--on-variant);
}
.stat-card .stat-value {
  font-family: 'Caveat', cursive;
  font-size: 2.5rem;
  color: var(--on-surface);
  line-height: 1.1;
}
.stat-card .stat-delta { font-size: 12px; font-weight: 500; }
.stat-delta-ok  { color: var(--success); }
.stat-delta-err { color: var(--danger); }

/* ── Grid helpers ────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ── Formulario helpers ──────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* ── Skeleton loading ────────────────────────────────────────── */
@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position:  200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 8px;
}

/* ── Public nav ──────────────────────────────────────────────── */
.pub-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--outline-soft);
  height: 64px;
  display: flex;
  align-items: center;
}
.pub-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.pub-nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.pub-nav-link {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--on-variant);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}
.pub-nav-link:hover { color: var(--on-surface); background: var(--surface-2); }
@media (max-width: 768px) {
  .pub-nav-links { display: none; }
}

/* ── Hero ────────────────────────────────────────────────────── */
.hero {
  padding: 80px 0;
  text-align: center;
}
.hero-title {
  font-family: 'Caveat', cursive;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  line-height: 1.1;
  color: var(--on-surface);
  margin-bottom: 20px;
}
.hero-sub {
  font-size: 18px;
  color: var(--on-variant);
  max-width: 520px;
  margin: 0 auto 32px;
}

/* ── Section ─────────────────────────────────────────────────── */
.section { padding: 64px 0; }
.section-title {
  font-family: 'Caveat', cursive;
  font-size: 2rem;
  margin-bottom: 8px;
}
.section-sub { color: var(--on-variant); margin-bottom: 32px; font-size: 15px; }

/* ── Class card (public) ─────────────────────────────────────── */
.clase-card {
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--outline-soft);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s;
}
.clase-card:hover { box-shadow: 0 4px 24px rgba(175,150,128,0.18); }
.clase-card-body { padding: 1.25rem; flex: 1; }
.clase-card-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--outline-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Catalog card ────────────────────────────────────────────── */
.cat-card {
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--outline-soft);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
}
.cat-card:hover { box-shadow: 0 4px 24px rgba(175,150,128,0.18); transform: translateY(-2px); }
.cat-card-img {
  width: 100%;
  aspect-ratio: 1;
}
.cat-card-body { padding: 1rem; }

/* ── Event card ──────────────────────────────────────────────── */
.ev-card {
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--outline-soft);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ev-card-img { width: 100%; height: 200px; }
.ev-card-body { padding: 1.25rem; flex: 1; }

/* ── Footer ──────────────────────────────────────────────────── */
.pub-footer {
  background: var(--surface-3);
  border-top: 1px solid var(--outline-soft);
  padding: 48px 0;
  margin-top: 0;
}

/* ── Loading overlay ─────────────────────────────────────────── */
.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px;
  gap: 12px;
  color: var(--on-variant);
}

/* ── Error message ───────────────────────────────────────────── */
.page-error {
  background: #fde8e8;
  border: 1px solid #f5c6c6;
  border-radius: 12px;
  padding: 16px 20px;
  color: var(--danger);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Login page ──────────────────────────────────────────────── */
.login-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 768px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-right  { display: none; }
}
.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.login-form-box { width: 100%; max-width: 380px; }
.login-right {
  background: var(--surface-3);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}
.login-quote {
  position: relative;
  z-index: 1;
  padding: 40px;
  color: var(--on-surface);
}
.login-tab-bar {
  display: flex;
  gap: 0;
  border: 1px solid var(--outline-soft);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 24px;
}
.login-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: var(--surface-1);
  color: var(--on-variant);
  transition: background 0.15s, color 0.15s;
}
.login-tab.active { background: var(--primary); color: #fff; }

/* ── Attendance bar ──────────────────────────────────────────── */
.att-bar { display: flex; gap: 3px; flex-wrap: wrap; margin: 16px 0; }
.att-cell {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: var(--surface-2);
  title: attr(title);
  cursor: default;
}
.att-cell.presente  { background: var(--success); }
.att-cell.ausente   { background: var(--danger); opacity: 0.7; }
.att-cell.recupero  { background: var(--accent); }
.att-cell.pendiente { background: var(--surface-3); }

/* ── Next class card ─────────────────────────────────────────── */
.next-class-card {
  background: var(--primary);
  color: var(--on-primary);
  border-radius: 16px;
  padding: 1.5rem;
}
.next-class-card .eyebrow { color: var(--primary-fixed); opacity: 0.8; }