/* ============================================================
   ACADEMIA MAGNA — Panel Administrativo
   css/admin.css  v1.0 — Julio 2026
   Design system: hereda DM Serif Display + Source Sans 3
   Paleta: #2d6a4f (verde) · #c17a50 (terracota) · #1e3a2f (verde oscuro)
   ============================================================ */

/* ── Google Fonts ──────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=Source+Sans+3:wght@300;400;500;600;700&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  /* Colores primarios */
  --verde:          #2d6a4f;
  --verde-oscuro:   #1e3a2f;
  --verde-claro:    #d8f3dc;
  --verde-medio:    #52b788;
  --terracota:      #c17a50;
  --terracota-claro: #f9ece3;
  --terracota-hover: #a5633e;

  /* Colores de interfaz */
  --bg-body:        #f4f6f4;
  --bg-sidebar:     #1e3a2f;
  --bg-card:        #ffffff;
  --bg-header:      #ffffff;

  /* Texto */
  --text-primary:   #1a2e24;
  --text-secondary: #4a6358;
  --text-muted:     #8a9e95;
  --text-on-dark:   #e8f5ee;

  /* Bordes */
  --border:         #dde8e2;
  --border-focus:   #2d6a4f;

  /* Estados */
  --verde-badge:    #2d6a4f;
  --azul:           #0369a1;
  --azul-claro:     #e0f2fe;
  --rojo:           #dc2626;
  --rojo-claro:     #fee2e2;
  --amarillo:       #d97706;
  --amarillo-claro: #fef3c7;

  /* Tipografía */
  --font-serif:     'DM Serif Display', Georgia, serif;
  --font-sans:      'Source Sans 3', system-ui, sans-serif;

  /* Layout */
  --sidebar-w:      260px;
  --header-h:       64px;
  --radius:         10px;
  --radius-sm:      6px;
  --shadow-card:    0 1px 4px rgba(0,0,0,.07), 0 4px 16px rgba(0,0,0,.04);
  --shadow-modal:   0 8px 40px rgba(0,0,0,.18);
  --transition:     .18s ease;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  font-size: .9375rem;        /* 15px */
  font-weight: 400;
  color: var(--text-primary);
  background: var(--bg-body);
  line-height: 1.55;
  min-height: 100vh;
}

a { color: var(--verde); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ── Tipografía ─────────────────────────────────────────────── */
h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 400; line-height: 1.25; }
h1 { font-size: 2rem;    color: var(--text-primary); }
h2 { font-size: 1.5rem;  color: var(--text-primary); }
h3 { font-size: 1.2rem;  color: var(--text-primary); }
h4 { font-size: 1rem;    color: var(--text-secondary); font-family: var(--font-sans); font-weight: 600; }
p  { color: var(--text-secondary); }

/* ── Layout principal ──────────────────────────────────────── */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  min-height: 100vh;
  position: fixed;
  left: 0; top: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-decoration: none;
}

.sidebar-logo img { width: 32px; height: 32px; object-fit: contain; }

.sidebar-logo-text {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--text-on-dark);
  line-height: 1.1;
}

.sidebar-logo-text small {
  display: block;
  font-family: var(--font-sans);
  font-size: .7rem;
  font-weight: 500;
  color: var(--verde-medio);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
}

.sidebar-section-label {
  font-family: var(--font-sans);
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--verde-medio);
  padding: 1.25rem 1.5rem .4rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 1.5rem;
  font-size: .875rem;
  font-weight: 500;
  color: rgba(232,245,238,.7);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.sidebar-link:hover { background: rgba(255,255,255,.06); color: var(--text-on-dark); text-decoration: none; }
.sidebar-link.active { background: rgba(82,183,136,.12); color: #fff; border-left-color: var(--verde-medio); }

.sidebar-link svg { flex-shrink: 0; opacity: .7; }
.sidebar-link.active svg, .sidebar-link:hover svg { opacity: 1; }

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: .8rem;
  color: rgba(232,245,238,.4);
}

/* ── Contenido principal ────────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ── Top header ─────────────────────────────────────────────── */
.top-header {
  height: var(--header-h);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.top-header-title {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
}

.top-header-right { display: flex; align-items: center; gap: 1rem; }

.user-chip {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .875rem;
  color: var(--text-secondary);
}

.user-avatar {
  width: 32px; height: 32px;
  background: var(--verde-claro);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  color: var(--verde);
}

.btn-logout {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  padding: .3rem .7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), color var(--transition);
}
.btn-logout:hover { border-color: var(--rojo); color: var(--rojo); text-decoration: none; }

/* ── Contenido de página ────────────────────────────────────── */
.page-content {
  padding: 2rem;
  flex: 1;
}

.page-header {
  margin-bottom: 1.75rem;
}

.page-header .eyebrow {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--verde);
  display: block;
  margin-bottom: .3rem;
}

.page-header h1 { font-size: 1.7rem; margin-bottom: .3rem; }
.page-header p  { font-size: .9rem; }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 { font-size: 1rem; font-family: var(--font-sans); font-weight: 600; }
.card-body { padding: 1.5rem; }
.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg-body);
  font-size: .85rem;
}

/* Cards de módulos (página principal) */
.module-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.module-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  cursor: pointer;
}

.module-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(0,0,0,.1);
  text-decoration: none;
}

.module-card.verde { border-top: 4px solid var(--verde); }
.module-card.verde:hover { border-color: var(--verde); }
.module-card.terracota { border-top: 4px solid var(--terracota); }
.module-card.azul { border-top: 4px solid var(--azul); }

.module-card-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin: 1.75rem 1.75rem 0;
  flex-shrink: 0;
}

.module-card.verde    .module-card-icon { background: var(--verde-claro); }
.module-card.terracota .module-card-icon { background: var(--terracota-claro); }
.module-card.azul     .module-card-icon { background: var(--azul-claro); }

.module-card-body {
  padding: 1.25rem 1.75rem 1.75rem;
  flex: 1;
}

.module-card-body h2 {
  font-size: 1.35rem;
  margin-bottom: .5rem;
  font-family: var(--font-serif);
}

.module-card-body p {
  font-size: .875rem;
  margin-bottom: 1rem;
  line-height: 1.55;
}

.module-card-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.module-card-links li {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-muted);
}

.module-card-links li::before {
  content: '';
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.module-card.verde    .module-card-links li { color: var(--verde); }
.module-card.terracota .module-card-links li { color: var(--terracota); }
.module-card.azul     .module-card-links li { color: var(--azul); }

.module-card-footer {
  padding: .9rem 1.75rem;
  border-top: 1px solid var(--border);
  background: var(--bg-body);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.module-card.verde    .module-card-footer { color: var(--verde); }
.module-card.terracota .module-card-footer { color: var(--terracota); }
.module-card.azul     .module-card-footer { color: var(--azul); }

/* ── Stats row ──────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
}

.stat-label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: .4rem;
}

.stat-value {
  font-family: var(--font-serif);
  font-size: 2rem;
  line-height: 1;
  color: var(--text-primary);
  margin-bottom: .2rem;
}

.stat-sub { font-size: .75rem; color: var(--text-muted); }

/* ── Tablas ─────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

thead { background: var(--bg-body); }

thead th {
  text-align: left;
  padding: .75rem 1rem;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:last-child { border-bottom: 0; }
tbody tr:hover { background: #f8fbf9; }

tbody td { padding: .875rem 1rem; color: var(--text-primary); vertical-align: middle; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-green   { background: var(--verde-claro);    color: var(--verde); }
.badge-terra   { background: var(--terracota-claro); color: var(--terracota); }
.badge-blue    { background: var(--azul-claro);     color: var(--azul); }
.badge-red     { background: var(--rojo-claro);     color: var(--rojo); }
.badge-yellow  { background: var(--amarillo-claro); color: var(--amarillo); }
.badge-gray    { background: #f1f5f2;               color: var(--text-muted); }

/* ── Botones ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--verde);
  color: #fff;
  border-color: var(--verde);
}
.btn-primary:hover { background: var(--verde-oscuro); border-color: var(--verde-oscuro); color: #fff; }

.btn-terra {
  background: var(--terracota);
  color: #fff;
  border-color: var(--terracota);
}
.btn-terra:hover { background: var(--terracota-hover); color: #fff; }

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-primary);
}
.btn-outline:hover { border-color: var(--verde); color: var(--verde); }

.btn-sm  { padding: .35rem .75rem; font-size: .8rem; }
.btn-lg  { padding: .75rem 1.5rem; font-size: 1rem; }
.btn-danger { background: var(--rojo); color: #fff; border-color: var(--rojo); }
.btn-danger:hover { background: #b91c1c; }

/* ── Formularios ─────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }

.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: .35rem;
}

.form-required::after {
  content: ' *';
  color: var(--rojo);
}

.form-control {
  width: 100%;
  padding: .6rem .9rem;
  font-family: var(--font-sans);
  font-size: .9rem;
  color: var(--text-primary);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(45,106,79,.12);
}

.form-hint { font-size: .78rem; color: var(--text-muted); margin-top: .3rem; }
.form-error { font-size: .78rem; color: var(--rojo); margin-top: .3rem; }

.form-control.error { border-color: var(--rojo); }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

/* Upload de archivos */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.upload-area:hover, .upload-area.dragover {
  border-color: var(--verde);
  background: var(--verde-claro);
}

.upload-area input[type="file"] { display: none; }
.upload-icon { margin: 0 auto .75rem; color: var(--text-muted); }
.upload-label { font-weight: 600; color: var(--text-primary); font-size: .9rem; }
.upload-hint  { font-size: .8rem; color: var(--text-muted); margin-top: .25rem; }

/* ── Alertas ─────────────────────────────────────────────────── */
.alert {
  padding: .85rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  border: 1px solid transparent;
}

.alert-success { background: var(--verde-claro);    border-color: #9de5b9; color: var(--verde-oscuro); }
.alert-error   { background: var(--rojo-claro);     border-color: #f8aaa8; color: #7f1d1d; }
.alert-warning { background: var(--amarillo-claro); border-color: #fbbf24; color: #78350f; }
.alert-info    { background: var(--azul-claro);     border-color: #93c5fd; color: #1e3a5f; }

/* ── Breadcrumb ──────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.breadcrumb a { color: var(--verde); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { opacity: .4; }

/* ── Página de login ─────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-body);
  padding: 1.5rem;
}

.login-box {
  width: 100%;
  max-width: 420px;
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
  text-decoration: none;
  display: block;
}

.login-logo img { margin: 0 auto; }

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-modal);
  border: 1px solid var(--border);
  padding: 2.25rem;
}

.login-card h1 {
  font-size: 1.6rem;
  margin-bottom: .3rem;
}

.login-card .login-sub {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

.login-card .btn { width: 100%; justify-content: center; padding: .75rem; font-size: 1rem; }

.login-back {
  text-align: center;
  margin-top: 1.25rem;
  font-size: .82rem;
  color: var(--text-muted);
}

.login-back a { color: var(--verde); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
  }

  .sidebar.open { transform: translateX(0); }

  .main-wrapper { margin-left: 0; }

  .page-content { padding: 1rem; }

  .module-cards { grid-template-columns: 1fr; }

  .stats-row { grid-template-columns: repeat(2, 1fr); }

  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }

  .top-header { padding: 0 1rem; }

  .hamburger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-primary);
  }
}

@media (min-width: 769px) {
  .hamburger-btn { display: none; }
}

/* ── Overlay sidebar mobile ──────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
}

.sidebar-overlay.open { display: block; }

/* ── Semáforo pagos ──────────────────────────────────────────── */
.semaforo-verde    { color: var(--verde); }
.semaforo-amarillo { color: var(--amarillo); }
.semaforo-rojo     { color: var(--rojo); }

/* ── Misc ────────────────────────────────────────────────────── */
.text-muted    { color: var(--text-muted); }
.text-right    { text-align: right; }
.text-center   { text-align: center; }
.gap-2         { gap: .5rem; }
.flex          { display: flex; }
.flex-center   { display: flex; align-items: center; }
.flex-between  { display: flex; align-items: center; justify-content: space-between; }
.mt-1          { margin-top: .5rem; }
.mt-2          { margin-top: 1rem; }
.mt-3          { margin-top: 1.5rem; }
.mb-1          { margin-bottom: .5rem; }
.mb-2          { margin-bottom: 1rem; }
.w-full        { width: 100%; }
.truncate      { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cursor-pointer{ cursor: pointer; }
