/* ============================================================
   IBBQ LMS — CSS principal
   Identidad: #2B4798 (azul) · #0E1D4D (navy) · #997A2B (dorado)
   Tipografía: Raleway (títulos) + Inter (cuerpo)
   ============================================================ */

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

/* ── Variables ────────────────────────────────────────────── */
:root {
  --azul:         #2B4798;
  --azul-oscuro:  #0E1D4D;
  --azul-claro:   #577BE5;
  --dorado:       #997A2B;
  --dorado-light: #C9A84C;
  --bg:           #F4F6FB;
  --card:         #ffffff;
  --text:         #1a1f36;
  --muted:        #6b7280;
  --border:       #e5e9f2;
  --sidebar-w:    224px;
  --radius:       10px;
  --radius-lg:    14px;
  --shadow:       0 1px 4px rgba(14,29,77,0.08);
  --shadow-md:    0 4px 16px rgba(14,29,77,0.12);
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--azul-claro); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ── Layout ───────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }
.main    { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.content { padding: 28px 32px; flex: 1; }

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--azul-oscuro);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand-logo { display: flex; align-items: center; gap: 10px; }
.brand-icon { width: 38px; height: 38px; flex-shrink: 0; }
.brand-text {
  font-family: 'Raleway', sans-serif;
  font-weight: 800;
  font-size: 12.5px;
  color: #fff;
  line-height: 1.25;
}
.brand-text span {
  display: block;
  font-weight: 400;
  font-size: 10px;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-user {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--azul-claro);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Raleway', sans-serif; font-weight: 700; font-size: 12px; color: #fff;
  flex-shrink: 0;
}
.user-name  { font-family: 'Raleway', sans-serif; font-weight: 600; font-size: 12px; color: #fff; }
.user-rol   { font-size: 10px; color: rgba(255,255,255,0.45); margin-top: 1px; text-transform: capitalize; }

.sidebar-nav  { padding: 14px 0; flex: 1; }
.nav-label    { font-size: 9px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255,255,255,0.3); padding: 10px 20px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 20px;
  font-size: 12.5px; color: rgba(255,255,255,0.62);
  cursor: pointer; border-left: 3px solid transparent;
  transition: all .15s; text-decoration: none; margin-bottom: 1px;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(87,123,229,0.2); color: #fff; border-left-color: var(--azul-claro); }
.nav-item svg { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.7; }
.nav-item.active svg { opacity: 1; }
.nav-badge {
  margin-left: auto; background: var(--dorado); color: #fff;
  font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 10px;
}

.sidebar-bottom {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-bottom a {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: rgba(255,255,255,0.4);
  cursor: pointer; text-decoration: none;
}
.sidebar-bottom a:hover { color: rgba(255,255,255,0.8); }

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
  position: sticky; top: 0; z-index: 10;
}
.topbar-title {
  font-family: 'Raleway', sans-serif; font-weight: 700;
  font-size: 16px; color: var(--azul-oscuro);
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-pill {
  background: rgba(43,71,152,0.08); color: var(--azul);
  font-family: 'Raleway', sans-serif; font-weight: 600; font-size: 11px;
  padding: 5px 12px; border-radius: 20px; border: 1px solid rgba(43,71,152,0.15);
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--card); border-radius: var(--radius-lg);
  border: 1px solid var(--border); padding: 22px;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.card-title {
  font-family: 'Raleway', sans-serif; font-weight: 700;
  font-size: 13px; color: var(--azul-oscuro);
}
.card-link { font-size: 11px; color: var(--azul-claro); font-weight: 500; cursor: pointer; }

/* ── Stats ────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--card); border-radius: var(--radius-lg);
  border: 1px solid var(--border); padding: 18px 20px;
  display: flex; align-items: center; gap: 14px;
}
.stat-icon {
  width: 42px; height: 42px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon.azul   { background: rgba(43,71,152,0.1); }
.stat-icon.dorado { background: rgba(153,122,43,0.1); }
.stat-icon.verde  { background: rgba(34,197,94,0.1); }
.stat-icon.rojo   { background: rgba(239,68,68,0.1); }
.stat-num {
  font-family: 'Raleway', sans-serif; font-weight: 800;
  font-size: 26px; color: var(--azul-oscuro); line-height: 1;
}
.stat-label { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ── Grillas ──────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.mb-20  { margin-bottom: 20px; }
.mb-28  { margin-bottom: 28px; }

/* ── Tablas ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: var(--azul-oscuro); color: #fff;
  padding: 11px 14px; text-align: left;
  font-family: 'Raleway', sans-serif; font-weight: 700; font-size: 11px;
  letter-spacing: 0.04em; white-space: nowrap;
}
thead th:first-child { border-radius: var(--radius) 0 0 0; }
thead th:last-child  { border-radius: 0 var(--radius) 0 0; }
tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f8faff; }

/* ── Botones ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius);
  font-family: 'Raleway', sans-serif; font-weight: 700; font-size: 12px;
  border: none; cursor: pointer; transition: all .15s;
  text-decoration: none; white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; }
.btn-primary   { background: var(--azul); color: #fff; }
.btn-primary:hover { background: var(--azul-oscuro); text-decoration: none; color: #fff; }
.btn-secondary { background: rgba(43,71,152,0.08); color: var(--azul); border: 1px solid rgba(43,71,152,0.2); }
.btn-secondary:hover { background: rgba(43,71,152,0.15); text-decoration: none; }
.btn-danger    { background: rgba(239,68,68,0.08); color: #dc2626; border: 1px solid rgba(239,68,68,0.2); }
.btn-danger:hover { background: rgba(239,68,68,0.15); text-decoration: none; }
.btn-dorado    { background: var(--dorado); color: #fff; }
.btn-sm        { padding: 5px 12px; font-size: 11px; }
.btn-icon      { padding: 7px; border-radius: 8px; }

/* ── Formularios ──────────────────────────────────────────── */
.form-group   { margin-bottom: 18px; }
.form-label {
  display: block; margin-bottom: 6px;
  font-family: 'Raleway', sans-serif; font-weight: 700;
  font-size: 11px; color: var(--azul-oscuro);
  letter-spacing: 0.03em; text-transform: uppercase;
}
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 13px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 13px; color: var(--text); font-family: 'Inter', sans-serif;
  background: #fff; outline: none; transition: border .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--azul-claro);
  box-shadow: 0 0 0 3px rgba(87,123,229,0.1);
}
.form-input::placeholder, .form-textarea::placeholder { color: #b0b8cc; }
.form-textarea { min-height: 100px; resize: vertical; }
.form-hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
.form-row  { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-block; font-size: 10px; font-weight: 700;
  padding: 3px 9px; border-radius: 20px; letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge-activo     { background: #dcfce7; color: #15803d; }
.badge-pendiente  { background: #fef3c7; color: #92400e; }
.badge-inactivo   { background: #f1f5f9; color: #64748b; }
.badge-graduado   { background: #ede9fe; color: #6d28d9; }
.badge-reprobado  { background: #fee2e2; color: #b91c1c; }
.badge-aprobado   { background: #dcfce7; color: #15803d; }
.badge-azul       { background: rgba(43,71,152,0.1); color: var(--azul); }
.badge-dorado     { background: rgba(153,122,43,0.1); color: var(--dorado); }

/* ── Alerts / Flash ───────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 13px; margin-bottom: 18px;
  display: flex; align-items: flex-start; gap: 10px; border: 1px solid;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: #f0fdf4; border-color: #86efac; color: #15803d; }
.alert-error   { background: #fef2f2; border-color: #fca5a5; color: #b91c1c; }
.alert-warning { background: #fffbeb; border-color: #fcd34d; color: #92400e; }
.alert-info    { background: #eff6ff; border-color: #93c5fd; color: #1e40af; }

/* ── Page header ──────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; padding-bottom: 18px;
  border-bottom: 2px solid var(--border);
}
.page-header-left h1 {
  font-family: 'Raleway', sans-serif; font-weight: 800;
  font-size: 22px; color: var(--azul-oscuro); margin-bottom: 2px;
}
.page-header-left p { font-size: 12px; color: var(--muted); }

/* ── Banner bienvenida ────────────────────────────────────── */
.welcome-banner {
  background: linear-gradient(135deg, var(--azul-oscuro) 0%, var(--azul) 60%, var(--azul-claro) 100%);
  border-radius: var(--radius-lg); padding: 24px 28px;
  margin-bottom: 24px; display: flex; align-items: center;
  justify-content: space-between; position: relative; overflow: hidden;
}
.welcome-banner::after {
  content: ''; position: absolute; right: -20px; top: -30px;
  width: 180px; height: 180px; border-radius: 50%;
  background: rgba(255,255,255,0.05); pointer-events: none;
}
.welcome-text h2 {
  font-family: 'Raleway', sans-serif; font-weight: 800;
  font-size: 19px; color: #fff; margin-bottom: 4px;
}
.welcome-text p { font-size: 12px; color: rgba(255,255,255,0.65); line-height: 1.5; }
.welcome-stats  { display: flex; gap: 20px; position: relative; z-index: 1; }
.wstat          { text-align: center; }
.wstat-num      { font-family: 'Raleway', sans-serif; font-weight: 900; font-size: 26px; color: #fff; }
.wstat-sep      { width: 1px; background: rgba(255,255,255,0.15); margin: 4px 0; }
.wstat-label    { font-size: 10px; color: rgba(255,255,255,0.5); margin-top: 3px; line-height: 1.3; }

/* ── Auth layout ──────────────────────────────────────────── */
.auth-layout    { display: flex; min-height: 100vh; background: var(--bg); }
.auth-left {
  width: 46%; background: var(--azul-oscuro);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 48px 52px; position: relative; overflow: hidden;
}
.auth-left::before {
  content: ''; position: absolute; top: -80px; right: -80px;
  width: 320px; height: 320px; border-radius: 50%;
  border: 60px solid rgba(43,71,152,0.3); pointer-events: none;
}
.auth-left::after {
  content: ''; position: absolute; bottom: -100px; left: -60px;
  width: 260px; height: 260px; border-radius: 50%;
  border: 50px solid rgba(87,123,229,0.15); pointer-events: none;
}
.auth-right {
  flex: 1; display: flex; align-items: center;
  justify-content: center; padding: 40px 32px;
}
.auth-card { width: 100%; max-width: 400px; }
.auth-headline {
  font-family: 'Raleway', sans-serif; font-weight: 900;
  font-size: 34px; color: #fff; line-height: 1.15;
  letter-spacing: -0.02em; margin-bottom: 18px;
}
.auth-headline em { font-style: normal; color: var(--dorado-light, #C9A84C); }
.auth-desc { font-size: 13px; color: rgba(255,255,255,0.6); line-height: 1.7; margin-bottom: 36px; }
.auth-gold-bar {
  height: 3px;
  background: linear-gradient(90deg, var(--dorado), var(--dorado-light, #C9A84C), transparent);
  border-radius: 2px; margin-bottom: 28px; width: 80px;
}
.auth-stats { display: flex; gap: 0; }
.auth-stat  { flex: 1; padding: 0 18px 0 0; border-right: 1px solid rgba(255,255,255,0.1); margin-right: 18px; }
.auth-stat:last-child { border-right: none; margin-right: 0; }
.auth-stat-n { font-family: 'Raleway', sans-serif; font-weight: 900; font-size: 26px; color: #fff; line-height: 1; }
.auth-stat-l { font-size: 10px; color: rgba(255,255,255,0.45); margin-top: 4px; line-height: 1.3; }

/* ── Tabs ─────────────────────────────────────────────────── */
.tabs { display: flex; background: #E8EDF7; border-radius: var(--radius); padding: 4px; margin-bottom: 24px; gap: 2px; }
.tab  { flex: 1; text-align: center; padding: 8px 0; border-radius: 7px; font-family: 'Raleway', sans-serif; font-weight: 700; font-size: 12px; cursor: pointer; transition: all .2s; color: var(--muted); }
.tab.active { background: #fff; color: var(--azul); box-shadow: 0 1px 4px rgba(43,71,152,0.12); }

/* ── Checkbox custom ──────────────────────────────────────── */
.check-group { display: flex; flex-wrap: wrap; gap: 8px; }
.check-item  {
  display: flex; align-items: center; gap: 6px; padding: 6px 12px;
  border: 1.5px solid var(--border); border-radius: 8px; cursor: pointer;
  font-size: 12px; transition: all .15s;
}
.check-item input[type="checkbox"] { accent-color: var(--azul); }
.check-item:has(input:checked) { border-color: var(--azul); background: rgba(43,71,152,0.06); }

/* ── Progress bars ────────────────────────────────────────── */
.progress-wrap { background: #e5e9f2; border-radius: 99px; height: 8px; overflow: hidden; }
.progress-bar  { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--azul), var(--azul-claro)); }

/* ── Utilidades ───────────────────────────────────────────── */
.text-muted   { color: var(--muted); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.font-raleway { font-family: 'Raleway', sans-serif; }
.font-bold    { font-weight: 700; }
.d-flex       { display: flex; }
.align-center { align-items: center; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }
.mt-4         { margin-top: 4px; }
.mt-8         { margin-top: 8px; }
.mt-16        { margin-top: 16px; }
.mt-24        { margin-top: 24px; }

/* ── Responsive básico ────────────────────────────────────── */
@media (max-width: 900px) {
  .auth-left    { display: none; }
  .stats-grid   { grid-template-columns: 1fr 1fr; }
  .grid-2       { grid-template-columns: 1fr; }
  .form-row     { grid-template-columns: 1fr; }
  .form-row-3   { grid-template-columns: 1fr 1fr; }
  .sidebar      { width: 200px; }
  .content      { padding: 20px; }
}

@media (max-width: 640px) {
  .sidebar      { display: none; }
  .stats-grid   { grid-template-columns: 1fr; }
  .welcome-stats { display: none; }
}

/* ── Badge de nav (contador en sidebar) ─────────────────────── */
.nav-badge {
  margin-left: auto;
  background: #2B4798;
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
  padding: .1rem .4rem;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
  line-height: 1.4;
}
