/* ═══════════════════════════════════════════════
   El Camino - Sistema Educativo
   assets/css/app.css — Mobile-first
═══════════════════════════════════════════════ */

/* ── Google Fonts ───────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Lato:wght@300;400;700&display=swap');

/* ── Variables ──────────────────────────────── */
:root {
  --bg:      #070b14;
  --panel:   #0d1424;
  --card:    #111827;
  --border:  rgba(196,160,60,0.2);
  --gold:    #c4a03c;
  --gold-l:  #e8c96a;
  --gold-d:  #8a6e20;
  --text:    #e8e0cc;
  --muted:   #7a7060;
  --blue:    #4a9eff;
  --teal:    #2dd4bf;
  --rose:    #fb7185;
  --green:   #4ade80;
  --radius:  14px;
  --nav-h:   64px;   /* bottom nav height mobile */
  --top-h:   56px;   /* topbar height */
}

/* ── Reset ──────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  background-color: #070b14;
  /* Extiende el fondo al área del notch */
  background-attachment: fixed;
}
body { font-family: 'Lato', system-ui, sans-serif; color: var(--text); min-height: 100vh; overflow-x: hidden; }
img, svg { display: block; }
button, input, select, textarea { font-family: inherit; }
input, select, textarea { font-size: 16px !important; } /* evita zoom en iOS */
a { color: inherit; text-decoration: none; }

/* ── Scrollbar ──────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gold-d); border-radius: 2px; }

/* ════════════════════════════════════════════
   LAYOUT
════════════════════════════════════════════ */
#app { display: flex; min-height: 100vh; }

/* Sidebar desktop */
.sidebar {
  width: 220px;
  background: linear-gradient(180deg, var(--panel) 0%, #090f1c 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  overflow-y: auto;
  transition: transform 0.28s ease;
}
.main-content {
  flex: 1;
  margin-left: 220px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.28s ease;
}

/* Topbar */
.topbar {
  height: var(--top-h);
  background: rgba(13,20,36,0.95);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}
.topbar-title {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1rem;
  color: var(--text);
  letter-spacing: 0.05em;
  flex: 1;
}

/* Page content */
.page-content {
  padding: 1.25rem;
  flex: 1;
  animation: fadeUp 0.22s ease;
}

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

/* ════════════════════════════════════════════
   SIDEBAR COMPONENTS
════════════════════════════════════════════ */
.sidebar-logo {
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border-bottom: 1px solid var(--border);
  min-height: 64px;
}
.logo-icon {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--gold), var(--gold-d));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(196,160,60,0.3);
}
.logo-text p:first-child { color: var(--gold-l); font-family: 'Cinzel', serif; font-size: 0.88rem; font-weight: 700; letter-spacing: 0.08em; }
.logo-text p:last-child  { color: var(--muted); font-size: 0.6rem; letter-spacing: 0.15em; text-transform: uppercase; margin-top: 1px; }

.nav-menu { padding: 0.5rem 0; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 0.65rem;
  width: 100%; padding: 11px 14px;
  background: transparent; border: none;
  border-left: 3px solid transparent;
  color: var(--muted);
  cursor: pointer; text-align: left;
  font-size: 0.85rem; font-weight: 400;
  transition: all 0.18s;
  white-space: nowrap;
}
.nav-item:hover { color: var(--text); background: rgba(196,160,60,0.06); }
.nav-item.active {
  color: var(--gold-l);
  background: rgba(196,160,60,0.12);
  border-left-color: var(--gold);
  font-weight: 700;
}
.nav-item svg { flex-shrink: 0; }

.sidebar-user {
  padding: 0.85rem;
  border-top: 1px solid var(--border);
}
.sidebar-user-info { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.7rem; }
.user-name { font-size: 0.78rem; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-rol  { font-size: 0.65rem; color: var(--gold); margin-top: 1px; }

/* ════════════════════════════════════════════
   BOTTOM NAV (móvil)
════════════════════════════════════════════ */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(13,20,36,0.97);
  border-top: 1px solid var(--border);
  z-index: 300;
  backdrop-filter: blur(14px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottom-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 100%;
}
.bnav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: transparent; border: none; cursor: pointer;
  color: var(--muted); flex: 1; padding: 6px 4px;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.bnav-btn.active { color: var(--gold); }
.bnav-btn .bnav-icon {
  width: 42px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: transparent;
  transition: background 0.18s;
}
.bnav-btn.active .bnav-icon { background: rgba(196,160,60,0.16); }
.bnav-btn:active { opacity: 0.65; transform: scale(0.93); }
.bnav-label { font-size: 0.6rem; font-weight: 400; line-height: 1; }
.bnav-btn.active .bnav-label { font-weight: 700; }

/* Slide-over (menú hamburguesa móvil) */
.slideover-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(4,8,18,0.75);
  z-index: 400;
  backdrop-filter: blur(4px);
}
.slideover-overlay.open { display: block; }
.slideover {
  position: absolute; right: 0; top: 0;
  width: 260px; height: 100%;
  background: linear-gradient(180deg, var(--panel) 0%, #090f1c 100%);
  border-left: 1px solid var(--border);
  padding: 1.25rem;
  display: flex; flex-direction: column;
  overflow-y: auto;
  animation: slideIn 0.22s ease;
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.slideover-user { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }

/* ════════════════════════════════════════════
   COMPONENTES UI
════════════════════════════════════════════ */

/* Avatar */
.avatar {
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0.05em;
}

/* Badge */
.badge {
  display: inline-flex; align-items: center;
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.72rem; font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.04em;
}

/* Botones */
.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-d));
  border: none; color: #05100a;
  padding: 11px 20px; border-radius: 10px;
  cursor: pointer; font-weight: 700; font-size: 0.88rem;
  font-family: 'Cinzel', serif; letter-spacing: 0.05em;
  display: inline-flex; align-items: center; gap: 6px;
  justify-content: center;
  transition: opacity 0.18s, transform 0.12s;
  white-space: nowrap;
}
.btn-gold:hover  { opacity: 0.9; }
.btn-gold:active { transform: scale(0.96); }

.btn-teal {
  background: linear-gradient(135deg, var(--teal), #0d9488);
  border: none; color: #05100a;
  padding: 10px 18px; border-radius: 10px;
  cursor: pointer; font-weight: 700; font-size: 0.85rem;
  display: inline-flex; align-items: center; gap: 6px;
  justify-content: center;
  transition: opacity 0.18s;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted); padding: 11px 18px;
  border-radius: 10px; cursor: pointer;
  font-size: 0.88rem;
  transition: all 0.18s;
}
.btn-ghost:hover { border-color: var(--gold); color: var(--text); }

.btn-icon {
  border: none; border-radius: 8px;
  padding: 8px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; min-height: 36px;
  transition: opacity 0.15s;
}
.btn-icon:active { opacity: 0.65; transform: scale(0.93); }
.btn-icon.edit  { background: rgba(196,160,60,0.14); color: var(--gold); }
.btn-icon.del   { background: rgba(251,113,133,0.14); color: var(--rose); }
.btn-icon.menu-btn { background: rgba(196,160,60,0.1); border: 1px solid var(--border); color: var(--gold); }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

/* Stat card */
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex; align-items: center; gap: 0.85rem;
  position: relative; overflow: hidden;
}
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-val { font-family: 'Cinzel', serif; font-size: 1.8rem; font-weight: 700; line-height: 1; }
.stat-lbl { font-size: 0.73rem; color: var(--muted); margin-top: 3px; }

/* Progress bar */
.progress-bar { height: 5px; border-radius: 3px; overflow: hidden; }
.progress-bar-bg { height: 100%; background: rgba(74,222,128,0.14); }
.progress-bar-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }

/* ════════════════════════════════════════════
   FORMULARIOS
════════════════════════════════════════════ */
.field { margin-bottom: 1rem; }
.field label { display: block; color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 16px !important;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold); }
.field select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a7060' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 0.75rem; }
.form-actions { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 0.5rem; }
.form-actions .btn-ghost, .form-actions .btn-gold { flex: 1; }

/* ════════════════════════════════════════════
   MODAL (bottom sheet en móvil)
════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(4,8,18,0.88);
  z-index: 1000;
  display: flex; align-items: flex-end; justify-content: center;
  backdrop-filter: blur(6px);
  animation: fadeIn 0.18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  background: linear-gradient(160deg, #0f1828 0%, #0b1020 100%);
  border: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  padding: 1.5rem;
  width: 100%;
  max-width: 580px;
  max-height: 92vh;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
  box-shadow: 0 -20px 60px rgba(0,0,0,0.7);
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-handle {
  width: 40px; height: 4px;
  background: rgba(196,160,60,0.35);
  border-radius: 2px;
  margin: 0 auto 1.25rem;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-title { font-family: 'Cinzel', serif; font-size: 1.1rem; color: var(--gold-l); }
.modal-close { background: rgba(196,160,60,0.12); border: 1px solid var(--border); color: var(--gold); border-radius: 8px; padding: 8px; cursor: pointer; display: flex; min-width: 36px; min-height: 36px; align-items: center; justify-content: center; }

/* ════════════════════════════════════════════
   PÁGINAS ESPECÍFICAS
════════════════════════════════════════════ */

/* Login */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem; }
.login-bg   { position: fixed; inset: 0; background: radial-gradient(ellipse 100% 50% at 50% 0%, rgba(138,110,32,0.22) 0%, transparent 70%); pointer-events: none; }
.login-circle { position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); border-radius: 50%; border: 1px solid rgba(196,160,60,0.08); pointer-events: none; }
.login-card { background: linear-gradient(160deg, #0f1828, #0b1020); border: 1px solid var(--border); border-radius: 20px; padding: 1.75rem; width: 100%; max-width: 380px; box-shadow: 0 24px 64px rgba(0,0,0,0.6); }
.login-logo { text-align: center; margin-bottom: 2.5rem; }
.login-icon { width: 72px; height: 72px; margin: 0 auto 1rem; background: linear-gradient(135deg, var(--gold), var(--gold-d)); border-radius: 20px; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 40px rgba(196,160,60,0.45); transform: rotate(5deg); }
.login-title { font-family: 'Cinzel', serif; font-size: 2rem; color: var(--gold-l); letter-spacing: 0.1em; }
.login-sub   { font-size: 0.75rem; color: var(--muted); letter-spacing: 0.2em; text-transform: uppercase; margin-top: 0.25rem; }
.login-hint  { margin-top: 1.25rem; padding: 0.9rem; background: rgba(196,160,60,0.07); border-radius: 10px; border: 1px solid rgba(196,160,60,0.15); font-size: 0.72rem; color: var(--muted); line-height: 1.9; text-align: center; }
.login-hint strong { color: var(--gold); }
.error-msg { color: var(--rose); font-size: 0.82rem; text-align: center; margin: -0.5rem 0 0.75rem; }

/* Dashboard grid */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-bottom: 1rem; }
.dash-row   { display: grid; grid-template-columns: 1fr; gap: 1rem; }

/* Alumnos - cards mobile */
.alumno-card { display: flex; flex-direction: column; gap: 0.7rem; }
.alumno-card-header { display: flex; align-items: center; gap: 0.75rem; }
.alumno-card-actions { display: flex; gap: 6px; margin-left: auto; }
.alumno-card-badges  { display: flex; gap: 5px; flex-wrap: wrap; }

/* Alumnos - tabla desktop */
.table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table-head { display: grid; padding: 10px 14px; background: rgba(196,160,60,0.08); border-bottom: 1px solid var(--border); }
.table-head span { color: var(--gold); font-size: 0.67rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.table-row  { display: grid; padding: 10px 14px; align-items: center; border-bottom: 1px solid var(--border); transition: background 0.15s; }
.table-row:last-child { border-bottom: none; }
.table-row:hover { background: rgba(196,160,60,0.05); }
.table-cols-alumnos { grid-template-columns: 2fr 2fr 90px 70px 90px 1.3fr 105px 80px; }

/* Clases */
.clase-card { display: flex; flex-direction: column; gap: 0.6rem; }
.clase-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.clase-card-actions { display: flex; gap: 6px; }

/* Cumpleaños - horizontal scroll pills */
.month-pills { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 0.4rem; margin-bottom: 1rem; scrollbar-width: none; }
.month-pills::-webkit-scrollbar { display: none; }
.month-pill { flex-shrink: 0; padding: 7px 13px; border-radius: 20px; border: 1px solid var(--border); background: rgba(196,160,60,0.08); color: var(--muted); cursor: pointer; font-size: 0.78rem; font-weight: 400; display: flex; align-items: center; gap: 4px; white-space: nowrap; transition: all 0.18s; }
.month-pill.active { background: linear-gradient(135deg, var(--gold), var(--gold-d)); border-color: var(--gold); color: #07100a; font-weight: 700; }
.month-pill .cnt { background: rgba(0,0,0,0.2); border-radius: 10px; padding: 0 5px; font-size: 0.67rem; }
.month-pill:not(.active) .cnt { background: rgba(196,160,60,0.2); }

/* Cumpleaños card */
.cumple-card { display: flex; align-items: center; gap: 0.85rem; }
.cumple-hoy  { background: var(--rose); color: #fff; font-size: 0.62rem; font-weight: 700; padding: 2px 7px; border-radius: 10px; }

/* Asistencia - checkbox */
.check-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 11px 12px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border);
  transition: all 0.15s;
  min-height: 48px;
  background: rgba(255,255,255,0.02);
  -webkit-user-select: none; user-select: none;
}
.check-item.checked { background: rgba(74,222,128,0.08); border-color: rgba(74,222,128,0.4); }
.check-box {
  width: 22px; height: 22px; border-radius: 6px;
  border: 2px solid var(--muted);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.15s;
  background: transparent;
}
.check-item.checked .check-box { background: var(--green); border-color: var(--green); }

/* Ranking */
.rank-bar-wrap { margin-bottom: 1rem; }
.rank-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.rank-left  { display: flex; align-items: center; gap: 0.55rem; flex: 1; min-width: 0; }
.rank-name  { font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Usuarios */
.user-card { display: flex; flex-direction: column; gap: 0.85rem; }
.user-card-top { display: flex; align-items: center; gap: 0.75rem; }
.user-card-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }

/* Search bar */
.search-bar { display: flex; gap: 0.6rem; align-items: center; margin-bottom: 1rem; }
.search-input { flex: 1; background: rgba(255,255,255,0.05); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; color: var(--text); font-size: 16px !important; outline: none; transition: border-color 0.2s; }
.search-input:focus { border-color: var(--gold); }
.search-input::placeholder { color: var(--muted); }

/* Toast */
.toast-wrap { position: fixed; bottom: calc(var(--nav-h) + 12px); left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.toast { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 10px 16px; font-size: 0.84rem; color: var(--text); white-space: nowrap; box-shadow: 0 8px 24px rgba(0,0,0,0.5); animation: toastIn 0.22s ease; }
.toast.ok    { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--rose); }
@keyframes toastIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }

/* Loader */
.loader { display: flex; align-items: center; justify-content: center; padding: 3rem; color: var(--muted); font-size: 0.88rem; gap: 0.6rem; }
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); font-size: 0.88rem; }

/* ════════════════════════════════════════════
   RESPONSIVE - MÓVIL
════════════════════════════════════════════ */
@media (max-width: 767px) {
  .sidebar       { transform: translateX(-100%); }
  .main-content  { margin-left: 0; padding-bottom: var(--nav-h); }
  .page-content  { padding: 0.9rem; }
  .topbar        { padding: 0 0.9rem; }
  .bottom-nav    { display: block; }
  .hide-mobile   { display: none !important; }
  .stats-grid    { grid-template-columns: 1fr 1fr; }
  .dash-row      { grid-template-columns: 1fr; }
  .form-row      { grid-template-columns: 1fr 1fr; }
  .toast-wrap    { bottom: calc(var(--nav-h) + 10px); }
}

@media (min-width: 768px) {
  .show-mobile  { display: none !important; }
  .dash-row     { grid-template-columns: 3fr 2fr; }
  .stats-grid   { grid-template-columns: repeat(4, 1fr); }
  .modal-overlay { align-items: center; }
  .modal-box    { border-radius: 20px; max-width: 560px; }
  .modal-handle { display: none; }
  .asist-grid   { grid-template-columns: 1fr 1fr; }
  .asist-layout { grid-template-columns: 2fr 1fr; }
}

@media (min-width: 1024px) {
  .page-content { padding: 1.5rem; }
}

/* Topbar — padding superior para el notch */
.topbar {
  padding-top: max(env(safe-area-inset-top), 0px);
  height: calc(var(--top-h) + env(safe-area-inset-top));
}

/* Bottom nav — padding inferior para el home indicator */
.bottom-nav {
  padding-bottom: env(safe-area-inset-bottom, 0px);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
}

/* El contenido no quede tapado por el bottom nav */
.main-content {
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
}