/* ============================================================
   SAAP Design System — Colegio Peniel
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  --ink:        #0D1F35;
  --ink-light:  #1E3A5F;
  --cobalt:     #1560BD;
  --cobalt-dark:#0D47A1;
  --cobalt-glow:rgba(21,96,189,0.18);
  --sky:        #3B9EEB;
  --chalk:      #F0F4F8;
  --chalk-dark: #E4EAF2;
  --white:      #FFFFFF;
  --gold:       #D97706;
  --gold-bg:    #FEF3C7;
  --mint:       #059669;
  --mint-bg:    #D1FAE5;
  --rose:       #DC2626;
  --rose-bg:    #FEE2E2;
  --amethyst:   #7C3AED;
  --amethyst-bg:#EDE9FE;
  --muted:      #64748B;
  --border:     rgba(0,0,0,0.07);
  --border-strong: rgba(0,0,0,0.12);

  --sidebar-w:  260px;

  --sh-card: 0 2px 4px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.04);
  --sh-raised: 0 8px 20px rgba(0,0,0,0.1), 0 0 0 1px rgba(0,0,0,0.05);
  --sh-blue: 0 8px 24px rgba(21,96,189,0.22);

  --r-sm: 6px;
  --r:    10px;
  --r-lg: 16px;
  --r-xl: 24px;

  --ease: cubic-bezier(.4,0,.2,1);
  --t:    0.18s;
}

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

html { font-size: 16px; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--chalk);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--cobalt); text-decoration: none; }
input, select, textarea, button { font-family: inherit; }
::placeholder { color: #94A3B8; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 99px; }

/* ── Layout ── */
.saap-layout { display: flex; min-height: 100vh; }
.saap-main   { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.saap-content { flex: 1; overflow-y: auto; padding: 28px 32px; }
.saap-inner  { max-width: 1120px; margin: 0 auto; }

/* ── Sidebar ── */
.saap-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(160deg, #0A1929 0%, #0D2140 55%, #0A1929 100%);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
}
.saap-sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
}

.sb-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sb-logo {
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--cobalt) 0%, var(--sky) 100%);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; color: #fff; font-size: 16px;
  box-shadow: 0 4px 12px rgba(21,96,189,0.4);
  flex-shrink: 0;
  letter-spacing: -0.5px;
}
.sb-title { color: #fff; font-size: 14px; font-weight: 700; line-height: 1.2; }
.sb-sub   { color: rgba(255,255,255,0.4); font-size: 11px; margin-top: 1px; }

.sb-section {
  color: rgba(255,255,255,0.28);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 20px 20px 6px;
}
.sb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  margin: 1px 10px;
  border-radius: var(--r-sm);
  color: rgba(255,255,255,0.55);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--t) var(--ease);
  text-decoration: none;
  position: relative;
}
.sb-item:hover:not(.sb-disabled) {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.9);
}
.sb-item.sb-active {
  background: linear-gradient(90deg, rgba(21,96,189,0.9) 0%, rgba(21,96,189,0.7) 100%);
  color: #fff;
  box-shadow: 0 2px 12px rgba(21,96,189,0.35);
}
.sb-item.sb-active::before {
  content: '';
  position: absolute;
  left: -10px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  background: var(--sky);
  border-radius: 0 3px 3px 0;
}
.sb-item.sb-disabled { opacity: 0.35; cursor: default; pointer-events: none; }
.sb-icon { font-size: 15px; width: 22px; text-align: center; flex-shrink: 0; }
.sb-badge {
  margin-left: auto;
  font-size: 9.5px;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.5);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}
.sb-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.25);
  font-size: 11px;
}

/* ── Topbar ── */
.saap-topbar {
  height: 60px;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--chalk-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  flex-shrink: 0;
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
  position: sticky;
  top: 0;
  z-index: 50;
}
.tb-left  { display: flex; align-items: center; gap: 12px; }
.tb-right { display: flex; align-items: center; gap: 14px; }
.tb-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.tb-crumb { color: #94A3B8; font-size: 13px; }
.tb-sep   { width: 1px; height: 24px; background: var(--chalk-dark); }
.tb-notif {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  border: 1px solid var(--chalk-dark);
  background: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  cursor: pointer;
  transition: var(--t) var(--ease);
  color: var(--muted);
}
.tb-notif:hover { background: var(--chalk); color: var(--ink); }
.tb-user  { display: flex; align-items: center; gap: 10px; }
.tb-avatar {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--cobalt) 0%, var(--sky) 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px;
  box-shadow: 0 2px 8px var(--cobalt-glow);
}
.tb-uname { font-size: 13px; font-weight: 700; color: var(--ink); line-height: 1.2; }
.tb-urole { font-size: 11px; color: var(--muted); }

/* ── Cards ── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-card);
  transition: box-shadow var(--t) var(--ease), transform var(--t) var(--ease);
}
.card:hover { box-shadow: var(--sh-raised); }
.card-body  { padding: 22px 24px; }

/* ── Stat Cards ── */
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  border-left: 4px solid var(--cobalt);
  padding: 20px 22px;
  box-shadow: var(--sh-card);
  transition: box-shadow var(--t) var(--ease), transform var(--t) var(--ease);
}
.stat-card:hover { box-shadow: var(--sh-raised); transform: translateY(-2px); }
.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: 14px;
}
.stat-val {
  font-size: 34px;
  font-weight: 900;
  color: var(--ink);
  line-height: 1;
  letter-spacing: -1px;
}
.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 6px;
}
.stat-sub {
  font-size: 12px;
  color: #94A3B8;
  margin-top: 4px;
}

.stat-card.s-blue   { border-left-color: var(--cobalt); }
.stat-card.s-blue   .stat-icon { background: #EFF6FF; }
.stat-card.s-blue   .stat-val  { color: var(--cobalt); }
.stat-card.s-green  { border-left-color: var(--mint); }
.stat-card.s-green  .stat-icon { background: var(--mint-bg); }
.stat-card.s-green  .stat-val  { color: var(--mint); }
.stat-card.s-gold   { border-left-color: var(--gold); }
.stat-card.s-gold   .stat-icon { background: var(--gold-bg); }
.stat-card.s-gold   .stat-val  { color: var(--gold); }
.stat-card.s-purple { border-left-color: var(--amethyst); }
.stat-card.s-purple .stat-icon { background: var(--amethyst-bg); }
.stat-card.s-purple .stat-val  { color: var(--amethyst); }
.stat-card.s-red    { border-left-color: var(--rose); }
.stat-card.s-red    .stat-icon { background: var(--rose-bg); }
.stat-card.s-red    .stat-val  { color: var(--rose); }

/* ── Module Cards ── */
.mod-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px 20px;
  box-shadow: var(--sh-card);
  text-decoration: none;
  display: block;
  transition: box-shadow var(--t) var(--ease), transform var(--t) var(--ease), border-color var(--t) var(--ease);
  position: relative;
  overflow: hidden;
}
.mod-card.available::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--cobalt), var(--sky));
  border-radius: 3px 0 0 3px;
}
.mod-card.available:hover {
  box-shadow: var(--sh-blue);
  transform: translateY(-3px);
  border-color: rgba(21,96,189,0.2);
}
.mod-card.coming { opacity: 0.5; cursor: default; pointer-events: none; }
.mod-icon {
  width: 48px; height: 48px;
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin-bottom: 14px;
}
.mod-name { font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.mod-desc { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.mod-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
}
.status-ok   { background: var(--mint-bg);    color: var(--mint); }
.status-soon { background: var(--chalk-dark);  color: #94A3B8; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--t) var(--ease);
  text-decoration: none;
}
.btn-primary {
  background: var(--cobalt);
  color: #fff;
  box-shadow: 0 2px 6px var(--cobalt-glow);
}
.btn-primary:hover { background: var(--cobalt-dark); box-shadow: var(--sh-blue); }
.btn-secondary {
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--chalk-dark);
  box-shadow: var(--sh-card);
}
.btn-secondary:hover { background: var(--chalk); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--chalk); color: var(--ink); }

/* ── Form fields ── */
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-light);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--chalk-dark);
  border-radius: var(--r-sm);
  font-size: 13.5px;
  color: var(--ink);
  background: var(--white);
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--cobalt);
  box-shadow: 0 0 0 3px var(--cobalt-glow);
}

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 700;
}
.badge-ef   { background: var(--mint-bg);      color: var(--mint); }
.badge-ret  { background: var(--rose-bg);       color: var(--rose); }
.badge-beca { background: var(--gold-bg);       color: var(--gold); }
.badge-blue { background: #EFF6FF;              color: var(--cobalt); }

/* ── Section headings ── */
.sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.sec-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.sec-sub { font-size: 12px; color: #94A3B8; }

/* ── Tables ── */
.saap-table { width: 100%; border-collapse: collapse; }
.saap-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--chalk);
  border-bottom: 1px solid var(--chalk-dark);
  white-space: nowrap;
}
.saap-table td {
  padding: 11px 14px;
  font-size: 13.5px;
  color: var(--ink);
  border-bottom: 1px solid rgba(0,0,0,0.04);
  vertical-align: middle;
}
.saap-table tr:last-child td { border-bottom: none; }
.saap-table tr:hover td { background: rgba(21,96,189,0.02); }

/* ── Alerts ── */
.alert { border-radius: var(--r-sm); padding: 12px 16px; font-size: 13.5px; font-weight: 500; margin-bottom: 16px; }
.alert-ok  { background: var(--mint-bg); color: #065f46; border: 1px solid #A7F3D0; }
.alert-err { background: var(--rose-bg); color: #991b1b; border: 1px solid #FECACA; }

/* ── Tabs ── */
.tabs-nav {
  display: flex;
  border-bottom: 2px solid var(--chalk-dark);
  padding: 0 6px;
  overflow-x: auto;
  gap: 2px;
}
.tab-btn {
  padding: 13px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  color: var(--muted);
  border-bottom: 2.5px solid transparent;
  margin-bottom: -2px;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  transition: color var(--t) var(--ease), border-color var(--t) var(--ease);
  display: flex;
  align-items: center;
  gap: 7px;
}
.tab-btn:hover { color: var(--cobalt); }
.tab-btn.active { color: var(--cobalt); border-bottom-color: var(--cobalt); }
.tab-pane { display: none; padding: 26px; }
.tab-pane.active { display: block; }

/* ── Grid ── */
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.g3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px 18px; }
.g4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 14px 18px; }
.g12{ display: grid; grid-template-columns: 1fr 2fr; gap: 14px 18px; }
.g21{ display: grid; grid-template-columns: 2fr 1fr; gap: 14px 18px; }
.span2 { grid-column: span 2; }
.span3 { grid-column: span 3; }
.span4 { grid-column: span 4; }

/* ── Animations ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.4s var(--ease) both; }
.delay-1 { animation-delay: 0.05s; }
.delay-2 { animation-delay: 0.10s; }
.delay-3 { animation-delay: 0.15s; }
.delay-4 { animation-delay: 0.20s; }

/* ── Utilities ── */
.mat-code { color: var(--cobalt); font-weight: 800; font-size: 13px; }
.rude-code { font-family: ui-monospace, monospace; font-size: 11.5px; color: var(--muted); }

@media (max-width: 900px) {
  .saap-sidebar { display: none; }
  .g3, .g4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .span2, .span3, .span4 { grid-column: span 1; }
}
