/* ============================================================================
   MateAventura · Admin · Design System
   Inspirado en el lenguaje visual de iOS / iPadOS:
   - Tipografía SF Pro (con fallback al stack del sistema).
   - Color neutro base + un único acento (MateAventura turquesa).
   - Sombras suaves, bordes 16px+, glassmorphism en tarjetas.
   - Micro-interacciones discretas (transform + shadow).
   ========================================================================== */

:root {
  /* Tipografía */
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI",
                  Roboto, Inter, system-ui, sans-serif;
  --font-text:    -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
                  Roboto, Inter, system-ui, sans-serif;
  --font-mono:    "SF Mono", "JetBrains Mono", ui-monospace, Consolas, monospace;

  /* Paleta neutra (iOS Light) */
  --bg:            #F2F2F7;
  --bg-elevated:   #FFFFFF;
  --bg-card:       rgba(255, 255, 255, 0.78);
  --bg-overlay:    rgba(255, 255, 255, 0.86);
  --bg-tinted:     rgba(0, 0, 0, 0.03);
  --bg-hover:      rgba(0, 0, 0, 0.05);
  --separator:     rgba(60, 60, 67, 0.10);
  --separator-strong: rgba(60, 60, 67, 0.22);

  /* Texto */
  --text:          #1C1C1E;
  --text-secondary:#3C3C43;
  --text-muted:    rgba(60, 60, 67, 0.55);
  --text-faint:    rgba(60, 60, 67, 0.32);

  /* Acentos MateAventura */
  --accent:        #22B8CF;
  --accent-strong: #0CA4B5;
  --accent-soft:   #E1F8FB;
  --accent-text:   #FFFFFF;

  --orange:        #FF8A3D;
  --orange-soft:   #FFE6D1;
  --mint:          #34C759;
  --mint-soft:     #DCF7E9;
  --yellow:        #FFCC00;
  --yellow-soft:   #FFF5CC;
  --red:           #FF3B30;
  --red-soft:      #FFE1E1;
  --purple:        #AF52DE;
  --purple-soft:   #F3E5FA;
  --blue:          #007AFF;

  /* Sombras (capa elevada) */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.05);
  --shadow:    0 8px 24px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.10), 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-pop:0 24px 64px rgba(34, 184, 207, 0.18), 0 4px 12px rgba(0, 0, 0, 0.06);

  /* Radios */
  --r-xs: 8px;
  --r-sm: 10px;
  --r:    14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  /* Espaciado */
  --gap-1: 4px; --gap-2: 8px; --gap-3: 12px; --gap-4: 16px;
  --gap-5: 20px; --gap-6: 24px; --gap-7: 32px; --gap-8: 48px;
}

/* ── Reset ligero ──────────────────────────────────────────── */
html { box-sizing: border-box; -webkit-font-smoothing: antialiased; }
*, *::before, *::after { box-sizing: inherit; }

body {
  font-family: var(--font-text);
  background: var(--bg);
  color: var(--text);
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 { font-family: var(--font-display); letter-spacing: -0.02em; color: var(--text); font-weight: 700; }
h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; }
h2 { font-size: 24px; font-weight: 700; }
h3 { font-size: 18px; font-weight: 700; }

a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: none; }

code, pre {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--bg-tinted);
  padding: 1px 6px;
  border-radius: 6px;
}

hr { border: none; border-top: 1px solid var(--separator); margin: 24px 0; }

/* ── Cards ─────────────────────────────────────────────────── */
.ma-card {
  background: var(--bg-elevated);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--separator);
  padding: 24px;
}
.ma-card.glass {
  background: var(--bg-card);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.ma-card.tight { padding: 16px; }
.ma-card.flush { padding: 0; overflow: hidden; }

.ma-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--separator);
}
.ma-card-header h2 { margin: 0; font-size: 17px; }
.ma-card-header .subtitle { color: var(--text-muted); font-size: 13px; }

/* ── Botones ───────────────────────────────────────────────── */
.ma-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--font-display);
  font-weight: 600;
  padding: 10px 18px;
  font-size: 14.5px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease, border-color .15s ease;
  text-decoration: none;
  line-height: 1;
}
.ma-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); text-decoration: none; }
.ma-btn:active { transform: translateY(0); box-shadow: none; }
.ma-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ma-btn:disabled { opacity: .5; cursor: not-allowed; }

.ma-btn.primary {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 6px 18px rgba(34,184,207,0.30);
}
.ma-btn.primary:hover { background: var(--accent-strong); box-shadow: 0 10px 24px rgba(34,184,207,0.36); }

.ma-btn.ghost {
  background: transparent;
  border-color: var(--separator);
}
.ma-btn.ghost:hover { background: var(--bg-hover); }

.ma-btn.danger { color: var(--red); border-color: var(--red-soft); background: var(--red-soft); }
.ma-btn.danger:hover { background: var(--red); color: white; }

.ma-btn.sm { padding: 6px 12px; font-size: 13px; }
.ma-btn.lg { padding: 14px 26px; font-size: 16px; }
.ma-btn.block { width: 100%; }

/* ── Inputs ────────────────────────────────────────────────── */
.ma-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.ma-field label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.ma-field .hint { font-size: 12px; color: var(--text-muted); }
.ma-field .error { font-size: 12px; color: var(--red); }

.ma-input, .ma-select, .ma-textarea {
  font-family: var(--font-text);
  font-size: 15px;
  padding: 12px 14px;
  border-radius: var(--r);
  background: var(--bg-elevated);
  border: 1px solid var(--separator-strong);
  color: var(--text);
  width: 100%;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.ma-input:focus, .ma-select:focus, .ma-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(34,184,207,0.16);
}
.ma-input::placeholder { color: var(--text-faint); }

/* ── Chips / Badges ────────────────────────────────────────── */
.ma-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: var(--bg-tinted);
  color: var(--text-secondary);
  font-size: 12px; font-weight: 600;
}
.ma-chip.accent  { background: var(--accent-soft);  color: var(--accent-strong); }
.ma-chip.mint    { background: var(--mint-soft);    color: #1B7A3B; }
.ma-chip.orange  { background: var(--orange-soft);  color: #B45200; }
.ma-chip.yellow  { background: var(--yellow-soft);  color: #8A6500; }
.ma-chip.red     { background: var(--red-soft);     color: #B7271F; }
.ma-chip.purple  { background: var(--purple-soft);  color: #7B2BB0; }

.ma-pill-status { font-size: 11px; padding: 3px 9px; }

/* ── Tablas ────────────────────────────────────────────────── */
.ma-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-elevated);
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--separator);
}
.ma-table thead th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 12px 18px;
  background: var(--bg-tinted);
  border-bottom: 1px solid var(--separator);
  font-weight: 700;
}
.ma-table tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--separator);
  font-size: 14px;
  vertical-align: middle;
}
.ma-table tbody tr:last-child td { border-bottom: none; }
.ma-table tbody tr { transition: background .12s ease; }
.ma-table tbody tr:hover { background: var(--bg-hover); }
.ma-table .num { font-variant-numeric: tabular-nums; text-align: right; }
.ma-table .mono { font-family: var(--font-mono); font-size: 12.5px; }

/* ── Layout: Sidebar + Topbar ──────────────────────────────── */
.ma-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
.ma-sidebar {
  background: var(--bg-elevated);
  border-right: 1px solid var(--separator);
  padding: 20px 14px;
  position: sticky; top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex; flex-direction: column;
  gap: 6px;
}
.ma-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px 18px;
  border-bottom: 1px solid var(--separator);
  margin-bottom: 8px;
}
.ma-brand .logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--orange));
  display: grid; place-items: center;
  font-size: 18px;
  box-shadow: 0 6px 16px rgba(34,184,207,0.35);
}
.ma-brand .name { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.02em; font-size: 17px; }
.ma-brand .role {
  display: block; font-size: 11px; color: var(--text-muted); font-weight: 500; margin-top: 1px;
}

.ma-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.ma-nav .section {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); padding: 14px 12px 6px;
}
.ma-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r);
  color: var(--text-secondary);
  font-size: 14px; font-weight: 500;
  transition: background .12s ease, color .12s ease;
}
.ma-nav a:hover { background: var(--bg-hover); color: var(--text); }
.ma-nav a.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}
.ma-nav a .ico {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  font-size: 14px;
}

.ma-main {
  display: flex; flex-direction: column;
  min-width: 0;
}
.ma-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px;
  background: var(--bg-overlay);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--separator);
  position: sticky; top: 0; z-index: 10;
}
.ma-topbar h1 { margin: 0; font-size: 22px; }
.ma-topbar .user-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 6px;
  border-radius: var(--r-pill);
  background: var(--bg-tinted);
  font-size: 13px; font-weight: 500;
}
.ma-topbar .user-pill .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--orange));
  display: grid; place-items: center; color: white; font-weight: 700; font-size: 12px;
}
.ma-topbar form { display: inline; }
.ma-topbar form button.linklike {
  background: none; border: none; color: var(--red); font-weight: 600;
  font-size: 13px; cursor: pointer; padding: 0 4px;
}

.ma-content { padding: 28px 32px 64px; max-width: 1280px; width: 100%; margin: 0 auto; }
.ma-content h1.section-title { font-size: 28px; margin: 0 0 4px; }
.ma-content p.section-lead { color: var(--text-muted); font-size: 15px; margin: 0 0 28px; }

/* ── Grid de stats ─────────────────────────────────────────── */
.ma-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.ma-stat {
  background: var(--bg-elevated);
  border-radius: var(--r-lg);
  border: 1px solid var(--separator);
  padding: 20px 22px;
  box-shadow: var(--shadow-xs);
  transition: transform .15s ease, box-shadow .15s ease;
}
.ma-stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.ma-stat .label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.ma-stat .value { font-family: var(--font-display); font-size: 32px; font-weight: 800; letter-spacing: -0.02em; }
.ma-stat .delta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.ma-stat.accent .value { color: var(--accent-strong); }
.ma-stat.orange .value { color: #D9620B; }
.ma-stat.mint .value { color: #1B7A3B; }
.ma-stat.purple .value { color: #7B2BB0; }

/* ── Quick actions grid ────────────────────────────────────── */
.ma-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.ma-action-tile {
  display: block;
  background: var(--bg-elevated);
  border-radius: var(--r-lg);
  border: 1px solid var(--separator);
  padding: 22px;
  color: var(--text);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.ma-action-tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
  text-decoration: none;
}
.ma-action-tile .tile-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 20px; margin-bottom: 12px;
  background: var(--accent-soft); color: var(--accent-strong);
}
.ma-action-tile.orange .tile-icon { background: var(--orange-soft); color: #D9620B; }
.ma-action-tile.mint   .tile-icon { background: var(--mint-soft);   color: #1B7A3B; }
.ma-action-tile.purple .tile-icon { background: var(--purple-soft); color: #7B2BB0; }
.ma-action-tile h3 { margin: 0 0 6px; font-size: 16px; }
.ma-action-tile p { margin: 0; color: var(--text-muted); font-size: 13.5px; line-height: 1.45; }

/* ── Flash messages ────────────────────────────────────────── */
.ma-flash {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r);
  font-size: 14px; font-weight: 500;
  margin-bottom: 20px;
  border: 1px solid;
}
.ma-flash.ok  { background: var(--mint-soft); color: #166534; border-color: rgba(52,199,89,0.3); }
.ma-flash.err { background: var(--red-soft);  color: #9B1C13; border-color: rgba(255,59,48,0.3); }

/* ── Auth screens (login) ─────────────────────────────────── */
.ma-auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg);
}
.ma-auth-hero {
  background: linear-gradient(135deg, #22B8CF 0%, #34C759 60%, #FFCC00 100%);
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  color: white; padding: 60px;
}
.ma-auth-hero::before {
  content: '';
  position: absolute; inset: -100px;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.3), transparent 40%),
              radial-gradient(circle at 80% 80%, rgba(255,255,255,0.2), transparent 50%);
  pointer-events: none;
}
.ma-auth-hero .pitch { position: relative; z-index: 1; max-width: 420px; }
.ma-auth-hero h1 { color: white; font-size: 44px; line-height: 1.1; margin-bottom: 18px; }
.ma-auth-hero p  { color: rgba(255,255,255,0.92); font-size: 17px; line-height: 1.45; }
.ma-auth-hero .badge {
  display: inline-block; padding: 6px 14px;
  background: rgba(255,255,255,0.22);
  border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; margin-bottom: 18px;
  text-transform: uppercase; letter-spacing: 0.06em;
}

.ma-auth-form-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: 60px;
}
.ma-auth-form-wrap .ma-card { width: 100%; max-width: 420px; padding: 36px; border-radius: var(--r-xl); }
.ma-auth-form-wrap h2 { font-size: 26px; margin-bottom: 4px; }
.ma-auth-form-wrap .lede { color: var(--text-muted); margin-bottom: 28px; font-size: 14px; }

@media (max-width: 960px) {
  .ma-auth { grid-template-columns: 1fr; }
  .ma-auth-hero { padding: 40px; min-height: 30vh; }
  .ma-shell { grid-template-columns: 1fr; }
  .ma-sidebar { position: relative; height: auto; }
}

/* ── Empty state ───────────────────────────────────────────── */
.ma-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.ma-empty .emoji { font-size: 48px; margin-bottom: 8px; }
.ma-empty h3 { color: var(--text); margin: 8px 0 4px; }
.ma-empty p { font-size: 14px; max-width: 360px; margin: 0 auto; }

/* ── Validation override ───────────────────────────────────── */
.field-validation-error, .validation-summary-errors li {
  color: var(--red); font-size: 12.5px;
}
.input-validation-error { border-color: var(--red) !important; }

/* ── Heatmap (alumno) ──────────────────────────────────────── */
.heatmap-cell {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border-radius: 10px;
  font-weight: 700; font-size: 13px;
  margin: 2px;
}
