/* ════════════════════════════════════════════════════════════
   AcadaextraPRO — Tema (sobre Bootstrap 5.3)
   Marca: Masters College Valdivia · Rojo institucional #C8181A
   ════════════════════════════════════════════════════════════ */

:root {
  --mc-primary:        #C8181A;
  --mc-primary-dark:   #7A0F10;
  --mc-primary-soft:   #fef2f2;
  --mc-primary-rgb:    200, 24, 26;

  --mc-sidebar-w:      260px;
  --mc-sidebar-bg:     #0f172a;
  --mc-sidebar-fg:     #e2e8f0;
  --mc-sidebar-muted:  #94a3b8;
  --mc-sidebar-active: rgba(255,255,255,.08);
  --mc-sidebar-hover:  rgba(255,255,255,.05);

  --mc-content-bg:     #f5f7fb;
  --mc-card-shadow:    0 1px 2px rgba(15,23,42,.04), 0 4px 16px rgba(15,23,42,.04);

  --bs-primary:        var(--mc-primary);
  --bs-primary-rgb:    var(--mc-primary-rgb);
}

/* Sobrescribir colores Bootstrap */
.btn-primary,
.bg-primary {
  background-color: var(--mc-primary) !important;
  border-color: var(--mc-primary) !important;
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  background-color: var(--mc-primary-dark) !important;
  border-color: var(--mc-primary-dark) !important;
}
.btn-outline-primary {
  color: var(--mc-primary);
  border-color: var(--mc-primary);
}
.btn-outline-primary:hover {
  background-color: var(--mc-primary);
  border-color: var(--mc-primary);
}
.text-primary       { color: var(--mc-primary) !important; }
a                   { color: var(--mc-primary); text-decoration: none; }
a:hover             { color: var(--mc-primary-dark); text-decoration: underline; }
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: rgba(var(--mc-primary-rgb), .5);
  box-shadow: 0 0 0 0.2rem rgba(var(--mc-primary-rgb), .15);
}
.form-check-input:checked {
  background-color: var(--mc-primary);
  border-color: var(--mc-primary);
}
.page-link            { color: var(--mc-primary); }
.page-item.active .page-link {
  background-color: var(--mc-primary);
  border-color: var(--mc-primary);
}

/* ── BASE ─────────────────────────────────────────────── */
html, body { height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--mc-content-bg);
  color: #1e293b;
  -webkit-font-smoothing: antialiased;
}

/* ── APP SHELL ────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ──────────────────────────────────────────── */
.app-sidebar {
  width: var(--mc-sidebar-w);
  background: var(--mc-sidebar-bg);
  color: var(--mc-sidebar-fg);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 1030;
  flex-shrink: 0;
  border-right: 1px solid rgba(255,255,255,.05);
}
.app-sidebar__brand {
  padding: 22px 20px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.app-sidebar__brand img {
  width: 42px; height: 42px;
  background: white;
  border-radius: 10px;
  padding: 4px;
  object-fit: contain;
}
.brand-title    { font-weight: 700; letter-spacing: .3px; }
.brand-subtitle { font-size: 11.5px; color: var(--mc-sidebar-muted); }

.app-nav {
  padding: 12px 10px;
  flex: 1;
  overflow-y: auto;
  margin: 0;
}
.app-nav .nav-section {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--mc-sidebar-muted);
  padding: 18px 14px 6px;
  list-style: none;
}
.app-nav .nav-link {
  color: var(--mc-sidebar-fg);
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 2px;
  font-size: 14px;
  transition: background .15s, color .15s;
}
.app-nav .nav-link i {
  font-size: 17px;
  width: 20px;
  text-align: center;
  color: var(--mc-sidebar-muted);
}
.app-nav .nav-link:hover {
  background: var(--mc-sidebar-hover);
  color: white;
  text-decoration: none;
}
.app-nav .nav-link.active {
  background: var(--mc-sidebar-active);
  color: white;
  position: relative;
}
.app-nav .nav-link.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--mc-primary);
}
.app-nav .nav-link.active i { color: var(--mc-primary); }

.app-sidebar__footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.07);
}
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255,255,255,.04);
  color: var(--mc-sidebar-fg);
}
.user-card:hover { background: rgba(255,255,255,.07); color: white; text-decoration: none; }
.user-card__avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--mc-primary), var(--mc-primary-dark));
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}
.user-card__info  { flex: 1; min-width: 0; }
.user-card__name  { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card__role  { font-size: 11.5px; color: var(--mc-sidebar-muted); }

/* ── MAIN ─────────────────────────────────────────────── */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.app-topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 24px;
  background: white;
  border-bottom: 1px solid #e5e7eb;
  position: sticky; top: 0; z-index: 1020;
}
.app-topbar__title {
  font-size: 18px; font-weight: 600; margin: 0; flex: 1;
  color: #1e293b;
}
.app-topbar__right { display: flex; align-items: center; gap: 8px; }

.app-content {
  padding: 24px;
  flex: 1;
}
.app-footer {
  padding: 16px 24px;
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
  border-top: 1px solid #eef2f7;
}

/* ── SIDEBAR MOBILE ───────────────────────────────────── */
.app-sidebar-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1029;
  display: none;
}
.app-sidebar-backdrop.show { display: block; }

@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed;
    top: 0; left: 0;
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .app-sidebar.show { transform: translateX(0); }
  .app-content { padding: 16px; }
  .app-topbar  { padding: 12px 16px; }
}

/* ── CARDS ────────────────────────────────────────────── */
.card {
  border: 1px solid #eef2f7;
  border-radius: 14px;
  box-shadow: var(--mc-card-shadow);
}
.card-header {
  background: white;
  border-bottom: 1px solid #eef2f7;
  font-weight: 600;
  padding: 14px 18px;
  border-top-left-radius: 14px !important;
  border-top-right-radius: 14px !important;
}
.card-body { padding: 18px; }

/* ── KPI CARD ─────────────────────────────────────────── */
.kpi {
  display: flex; align-items: center; gap: 14px;
  background: white;
  padding: 18px;
  border-radius: 14px;
  border: 1px solid #eef2f7;
  box-shadow: var(--mc-card-shadow);
  transition: transform .15s, box-shadow .15s;
}
.kpi:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(15,23,42,.08); }
.kpi__icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.kpi__icon--red    { background: var(--mc-primary-soft); color: var(--mc-primary); }
.kpi__icon--blue   { background: #eff6ff; color: #2563eb; }
.kpi__icon--green  { background: #ecfdf5; color: #059669; }
.kpi__icon--amber  { background: #fffbeb; color: #d97706; }
.kpi__icon--violet { background: #f5f3ff; color: #7c3aed; }
.kpi__num   { font-size: 26px; font-weight: 800; line-height: 1; color: #0f172a; }
.kpi__label { font-size: 12.5px; color: #64748b; margin-top: 4px; }

/* ── TABLAS ───────────────────────────────────────────── */
.table {
  --bs-table-hover-bg: var(--mc-primary-soft);
  margin-bottom: 0;
}
.table > :not(caption) > * > * { padding: 12px 14px; vertical-align: middle; }
.table thead th {
  background: #f8fafc;
  border-bottom: 2px solid #e5e7eb;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #475569;
  font-weight: 600;
}
.table-card {
  background: white;
  border-radius: 14px;
  border: 1px solid #eef2f7;
  overflow: hidden;
  box-shadow: var(--mc-card-shadow);
}

/* ── BADGES ROL/ESTADO ────────────────────────────────── */
.badge-rol {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  letter-spacing: .5px;
}
.badge-rol--superadmin { background: #fef2f2; color: #b91c1c; }
.badge-rol--admin      { background: #eff6ff; color: #1d4ed8; }
.badge-rol--secretaria { background: #f0fdf4; color: #15803d; }
.badge-rol--inspector  { background: #fffbeb; color: #b45309; }

.badge-estado--green { background: #ecfdf5; color: #047857; }
.badge-estado--amber { background: #fffbeb; color: #b45309; }
.badge-estado--red   { background: #fef2f2; color: #b91c1c; }

/* ── PERMISSION GRID ──────────────────────────────────── */
.perm-modulo {
  background: white;
  border: 1px solid #eef2f7;
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: var(--mc-card-shadow);
}
.perm-modulo__title {
  background: #f8fafc;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: #475569;
  border-bottom: 1px solid #eef2f7;
  display: flex; align-items: center; gap: 8px;
}
.perm-modulo__title i { color: var(--mc-primary); }
.perm-row {
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #f1f5f9;
}
.perm-row:last-child { border-bottom: none; }
.perm-row:hover { background: #fafbfc; }
.perm-row__info { flex: 1; min-width: 0; }
.perm-row__code { font-family: 'JetBrains Mono', Menlo, monospace; font-size: 11.5px; color: #64748b; }
.perm-row__desc { font-size: 14px; color: #1e293b; margin-top: 2px; }
.perm-row__from-rol {
  font-size: 10.5px;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 8px;
  white-space: nowrap;
}

/* ── TOGGLE SWITCH GRANDE ─────────────────────────────── */
.form-switch.form-switch-lg .form-check-input {
  width: 3em; height: 1.6em;
}

/* ── ATTENDANCE GRID ──────────────────────────────────── */
.asis-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-bottom: 1px solid #f1f5f9; }
.asis-row:hover { background: #fafbfc; }
.asis-row__name { font-weight: 500; }
.asis-controls { display: flex; gap: 6px; }
.asis-btn {
  width: 38px; height: 38px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: #f1f5f9;
  color: #64748b;
  font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all .15s;
}
.asis-btn:hover { background: #e2e8f0; }
.asis-btn[data-active="P"] { background: #ecfdf5; color: #047857; border-color: #10b981; }
.asis-btn[data-active="A"] { background: #fef2f2; color: #b91c1c; border-color: #ef4444; }
.asis-btn[data-active="J"] { background: #eff6ff; color: #1d4ed8; border-color: #3b82f6; }

/* ── EMPTY STATE ──────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 48px 24px;
  color: #64748b;
}
.empty i { font-size: 48px; color: #cbd5e1; margin-bottom: 12px; display: block; }
.empty h5 { color: #475569; margin-bottom: 8px; }

/* ── LOGIN ────────────────────────────────────────────── */
body.is-login {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
body.is-login::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 20% 30%, rgba(200,24,26,.18), transparent 50%),
              radial-gradient(circle at 80% 70%, rgba(122,15,16,.15), transparent 50%);
  pointer-events: none;
}
.login-card {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: white;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.4);
  max-width: 920px;
  width: 100%;
}
.login-card__side {
  background: linear-gradient(135deg, var(--mc-primary), var(--mc-primary-dark));
  color: white;
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}
.login-card__side img {
  background: white; border-radius: 16px;
  padding: 8px; width: 80px; margin-bottom: 18px;
}
.login-card__form { padding: 40px 36px; display: flex; flex-direction: column; justify-content: center; }
@media (max-width: 720px) {
  .login-card { grid-template-columns: 1fr; }
  .login-card__side { padding: 28px 24px; }
}

/* ── PASSWORD STRENGTH BAR ────────────────────────────── */
.pwd-strength {
  height: 4px; background: #e5e7eb; border-radius: 2px; overflow: hidden; margin-top: 6px;
}
.pwd-strength__bar { height: 100%; width: 0; transition: width .25s, background .25s; }

/* ── PRINT ────────────────────────────────────────────── */
@media print {
  .app-sidebar, .app-topbar, .app-footer, .no-print { display: none !important; }
  .app-main, .app-content { padding: 0; }
  .card { box-shadow: none; border: none; }
}
/*