/* ============================================================
   CAMPUS · Design System (base.css)
   Tokens, reset, typography, buttons, forms, badges, utilities
   Shared by every page (landing, login y app)
   ============================================================ */

/* ---------- Tokens / Light theme ---------- */
:root {
  /* Brand */
  --brand-1: #6366f1;          /* indigo  */
  --brand-2: #8b5cf6;          /* violet  */
  --brand-3: #4f46e5;          /* indigo deep */
  --brand-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #a855f7 100%);
  --brand-grad-soft: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);

  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-700: #3730a3;
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;

  /* Neutrals */
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f3f9;
  --border: #e7e9f2;
  --border-strong: #d6d9e6;

  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --on-brand: #ffffff;

  /* Semantic */
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --info: #3b82f6;
  --info-bg: #eff6ff;

  /* Event colors (agenda) */
  --ev-evento: #6366f1;
  --ev-cita: #0ea5e9;
  --ev-tarea: #f59e0b;
  --ev-pago: #ef4444;

  /* Effects */
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow-xs: 0 1px 2px rgba(15,23,42,.06);
  --shadow-sm: 0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.04);
  --shadow: 0 6px 18px -6px rgba(15,23,42,.12), 0 4px 8px -4px rgba(15,23,42,.06);
  --shadow-lg: 0 24px 48px -12px rgba(15,23,42,.18);
  --shadow-brand: 0 12px 28px -8px rgba(99,102,241,.45);
  --ring: 0 0 0 4px rgba(99,102,241,.16);

  --header-h: 68px;
  --sidebar-w: 256px;

  --ease: cubic-bezier(.4,0,.2,1);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- Dark theme ---------- */
:root[data-theme="dark"] {
  --bg: #0b1020;
  --surface: #131a2e;
  --surface-2: #182039;
  --surface-3: #1f2942;
  --border: #26304d;
  --border-strong: #313c5e;

  --text: #eef1fb;
  --text-2: #c7cee3;
  --muted: #93a0bd;
  --muted-2: #6c79a0;

  --primary-50: #1b2444;
  --primary-100: #21306a;
  --brand-grad-soft: linear-gradient(135deg, #1a2142 0%, #221a44 100%);

  --success-bg: #08261c;
  --warning-bg: #2a2008;
  --danger-bg: #2a1213;
  --info-bg: #0c1c34;

  --shadow-xs: 0 1px 2px rgba(0,0,0,.4);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.5);
  --shadow: 0 10px 24px -8px rgba(0,0,0,.6);
  --shadow-lg: 0 28px 56px -12px rgba(0,0,0,.7);
  --ring: 0 0 0 4px rgba(129,140,248,.22);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 15px;
}
img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }
h1,h2,h3,h4,h5 { line-height: 1.2; font-weight: 700; letter-spacing: -.02em; }
::selection { background: rgba(99,102,241,.22); }

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted-2); background-clip: content-box; }

/* ---------- Typography helpers ---------- */
.h1 { font-size: clamp(2rem, 4vw, 3.2rem); }
.h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); }
.h3 { font-size: 1.35rem; }
.eyebrow { font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--primary); }
.lead { font-size: 1.12rem; color: var(--muted); line-height: 1.7; }
.text-muted { color: var(--muted); }
.text-sm { font-size: .85rem; }
.text-xs { font-size: .76rem; }
.text-grad {
  background: var(--brand-grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .62rem 1.1rem; border-radius: 11px; font-weight: 600; font-size: .92rem;
  border: 1px solid transparent; white-space: nowrap; transition: all .18s var(--ease);
  line-height: 1;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-brand); }
.btn-primary:hover { background: var(--primary-600); transform: translateY(-1px); }
.btn-grad { background: var(--brand-grad); color: #fff; box-shadow: var(--shadow-brand); }
.btn-grad:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--shadow-xs); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn-soft { background: var(--primary-50); color: var(--primary); }
.btn-soft:hover { background: var(--primary-100); }
.btn-light { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.28); backdrop-filter: blur(6px); }
.btn-light:hover { background: rgba(255,255,255,.26); }
.btn-lg { padding: .85rem 1.5rem; font-size: 1rem; border-radius: 13px; }
.btn-sm { padding: .42rem .8rem; font-size: .82rem; border-radius: 9px; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: 11px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Badges / chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .26rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 600;
  background: var(--surface-3); color: var(--text-2); line-height: 1;
}
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-primary { background: var(--primary-50); color: var(--primary); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-info    { background: var(--info-bg);     color: var(--info); }
.badge-glass   { background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.25); backdrop-filter: blur(8px); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: .4rem; }
.label { font-size: .85rem; font-weight: 600; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; padding: .68rem .85rem; border-radius: 11px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  transition: border-color .15s, box-shadow .15s; font-size: .92rem;
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.textarea { resize: vertical; min-height: 90px; }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted-2); pointer-events: none; }
.input-icon .input { padding-left: 2.4rem; }

.check { display: inline-flex; align-items: center; gap: .55rem; font-size: .88rem; cursor: pointer; user-select: none; }
.check input { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }

/* ---------- Cards & surfaces ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 1.25rem; }
.surface-2 { background: var(--surface-2); }

/* ---------- Avatars ---------- */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: .85rem; color: #fff; flex: none; overflow: hidden;
  background: var(--brand-grad); box-shadow: var(--shadow-xs);
}
.avatar-sm { width: 30px; height: 30px; font-size: .72rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.1rem; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { border: 2px solid var(--surface); margin-left: -10px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ---------- Progress ---------- */
.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: var(--brand-grad); transition: width .6s var(--ease); }
.progress-thin { height: 5px; }

/* ---------- Misc ---------- */
.divider { height: 1px; background: var(--border); border: 0; margin: 1rem 0; }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0 } 100% { background-position: -100% 0 } }

.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

/* ---------- Layout utilities ---------- */
.container { width: min(1200px, 92vw); margin-inline: auto; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; } .gap-3 { gap: 1.5rem; }
.grid { display: grid; }
.hidden { display: none !important; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.fill { flex: 1; }
.relative { position: relative; }
.center { display: grid; place-items: center; }
.nowrap { white-space: nowrap; }
.cursor { cursor: pointer; }

/* ---------- Animations ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { 0% { transform: scale(.96); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.animate-up { animation: fadeUp .5s var(--ease) both; }
.animate-in { animation: fadeIn .4s var(--ease) both; }
[data-delay="1"] { animation-delay: .06s; }
[data-delay="2"] { animation-delay: .12s; }
[data-delay="3"] { animation-delay: .18s; }
[data-delay="4"] { animation-delay: .24s; }
[data-delay="5"] { animation-delay: .30s; }
[data-delay="6"] { animation-delay: .36s; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Toast ---------- */
#toast-wrap { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: .6rem; z-index: 9999; }
.toast {
  display: flex; align-items: center; gap: .65rem; padding: .8rem 1rem; min-width: 250px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); animation: pop .25s var(--ease) both; font-size: .9rem; font-weight: 500;
}
.toast .dot { width: 9px; height: 9px; }
.toast.out { animation: fadeIn .25s reverse both; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10,14,28,.55); backdrop-filter: blur(4px);
  display: grid; place-items: center; z-index: 1000; padding: 1.5rem; animation: fadeIn .2s var(--ease);
}
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: min(520px, 100%); max-height: 90vh; overflow: auto; animation: pop .25s var(--ease);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1.2rem 1.4rem; border-bottom: 1px solid var(--border); }
.modal-body { padding: 1.4rem; }
.modal-foot { padding: 1rem 1.4rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .6rem; }
