/* ============================================================
   SIRCOnet — Instituto CODADO  |  Design System v2.0
   Colors: #30348F (primary) → #ADC5EF (light)
   ============================================================ */

:root {
  --primary: #30348F;
  --primary-dark: #23266a;
  --primary-light: #4a4fb0;
  --accent: #ADC5EF;
  --accent-light: #d4e2f7;
  --accent-dark: #7ba4db;
  --bg: #f0f2f8;
  --bg-card: #ffffff;
  --text: #1e1e2f;
  --text-muted: #6c757d;
  --text-light: #ffffff;
  --border: #d5daf0;
  --shadow: 0 2px 12px rgba(48, 52, 143, .10);
  --shadow-lg: 0 8px 30px rgba(48, 52, 143, .15);
  --radius: .5rem;
  --radius-lg: .75rem;
  --gradient: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 50%, var(--accent) 100%);
  --gradient-nav: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  --gradient-btn: linear-gradient(135deg, var(--primary) 0%, var(--accent-dark) 100%);
  --transition: all .25s ease;
}

/* ── Global ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', 'Poppins', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: .9rem;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-dark); }

/* ── Navbar ───────────────────────────────────────────────── */
.navbar-custom {
  background: var(--gradient-nav);
  border: none;
  box-shadow: 0 2px 20px rgba(48, 52, 143, .25);
  padding: .55rem 0;
}
.navbar-custom .navbar-brand {
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: .5px;
  color: var(--text-light) !important;
}
.navbar-custom .navbar-brand:hover { opacity: .9; }
.navbar-custom .nav-link {
  color: rgba(255,255,255,.82) !important;
  font-weight: 500;
  padding: .4rem .9rem !important;
  border-radius: var(--radius);
  transition: var(--transition);
  font-size: .88rem;
}
.navbar-custom .nav-link:hover,
.navbar-custom .nav-link.active {
  color: #fff !important;
  background: rgba(255,255,255,.12);
}
.navbar-custom .navbar-toggler {
  border-color: rgba(255,255,255,.3);
  padding: .25rem .5rem;
}
.navbar-custom .navbar-toggler-icon {
  filter: brightness(0) invert(1);
}
.navbar-custom .dropdown-menu {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: .35rem;
  margin-top: .25rem;
}
.navbar-custom .dropdown-item {
  border-radius: var(--radius);
  padding: .4rem .8rem;
  font-size: .85rem;
  color: var(--text);
  transition: var(--transition);
}
.navbar-custom .dropdown-item:hover {
  background: var(--accent-light);
  color: var(--primary-dark);
}
.navbar-custom .dropdown-item i {
  width: 1.2rem;
  text-align: center;
  margin-right: .3rem;
}
.navbar-subtitle {
  background: rgba(0,0,0,.15);
  padding: .25rem .8rem;
  border-radius: var(--radius);
  margin-top: .2rem;
  display: inline-block;
  font-size: .78rem;
}

/* ── Brand badge ──────────────────────────────────────────── */
.navbar-custom .brand-badge {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: .65rem;
  background: var(--gradient);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: #fff;
  box-shadow: 0 3px 10px rgba(0,0,0,.25);
  flex-shrink: 0;
}
.navbar-custom .brand-text { line-height: 1.1; }
.navbar-custom .brand-name {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.navbar-custom .brand-sub {
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: 1.2px;
  color: var(--accent) !important;
  text-transform: uppercase;
  opacity: .9;
}

/* ── User chip / avatar ───────────────────────────────────── */
.navbar-custom .user-chip {
  color: #fff !important;
  border-radius: 2rem;
  padding: .25rem .6rem .25rem .3rem !important;
  border: 1px solid rgba(255,255,255,.25);
}
.navbar-custom .user-chip:hover,
.navbar-custom .user-chip.show {
  background: rgba(255,255,255,.14) !important;
  border-color: rgba(255,255,255,.4);
}
.navbar-custom .avatar {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: var(--gradient);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .95rem;
  color: #fff;
  box-shadow: 0 0 0 2px rgba(255,255,255,.3);
  flex-shrink: 0;
}
.navbar-custom .user-name {
  font-size: .82rem;
  font-weight: 600;
  line-height: 1.15;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.navbar-custom .user-email {
  font-size: .68rem;
  color: rgba(255,255,255,.65) !important;
  font-weight: 400;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.navbar-custom .user-caret { font-size: .6rem; color: rgba(255,255,255,.7); }
.navbar-custom .dropdown-header {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
}

/* Badge de sede en el navbar */
.sede-badge {
  background: rgba(255,255,255,.14);
  color: #fff;
  border: 1px solid rgba(255,255,255,.35);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: .35rem .7rem;
  border-radius: 2rem;
  box-shadow: 0 0 0 3px rgba(255,255,255,.06);
}
.sede-badge i { color: var(--accent); }

/* ── Header strip (bajo el navbar) ────────────────────────── */
.header-strip {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 60%, var(--accent-dark) 100%);
  color: rgba(255,255,255,.92);
  padding: .45rem 0;
  font-size: .8rem;
  letter-spacing: .3px;
  border-bottom: 3px solid var(--accent);
}
.header-strip .header-strip-icon {
  color: var(--accent);
  font-size: .85rem;
}

/* ── Page hero / header strip ─────────────────────────────── */
.page-hero {
  background: var(--gradient);
  color: var(--text-light);
  padding: 1.2rem 0;
  margin-bottom: 1.25rem;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: 0 4px 20px rgba(48, 52, 143, .15);
}
.page-hero h2, .page-hero h3 { margin: 0; font-weight: 700; font-size: 1.2rem; }
.page-hero p { margin: .2rem 0 0; opacity: .85; font-size: .85rem; }
.page-hero .btn { margin-top: .5rem; }

/* ── Section header (above tables) ───────────────────────── */
.section-header {
  background: var(--gradient);
  color: var(--text-light);
  padding: .8rem 1.2rem;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
}
.section-header h4, .section-header h5 {
  margin: 0;
  font-weight: 700;
  font-size: 1rem;
}
.section-header .btn {
  font-size: .82rem;
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  background: var(--bg-card);
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-lg); }
.card-header {
  background: var(--gradient);
  color: var(--text-light);
  border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
  font-weight: 600;
  padding: .75rem 1.1rem;
  font-size: .9rem;
}
.card-header.bg-primary { background: var(--gradient) !important; }
.card-body { padding: 1.1rem; }

/* ── Sidebar cards (LMS) ──────────────────────────────────── */
.sidebar-card {
  border: none;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
  display: block;
  color: inherit;
}
.sidebar-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  color: inherit;
}
.sidebar-card .card-body {
  padding: 1rem;
  text-align: center;
}
.sidebar-card i.fa-3x {
  margin-bottom: .5rem;
  opacity: .9;
}
.sidebar-card h6 {
  font-weight: 700;
  margin: 0;
  font-size: .88rem;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.sidebar-card small {
  opacity: .8;
  font-size: .78rem;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  font-weight: 600;
  border-radius: var(--radius);
  transition: var(--transition);
  font-size: .85rem;
}
.btn-primary {
  background: var(--gradient-btn);
  border: none;
  color: #fff;
  box-shadow: 0 2px 8px rgba(48, 52, 143, .2);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  box-shadow: 0 4px 16px rgba(48, 52, 143, .3);
  transform: translateY(-1px);
  color: #fff;
}
.btn-secondary, .btn-outline-secondary {
  border-color: var(--accent-dark);
  color: var(--primary);
}
.btn-secondary:hover, .btn-outline-secondary:hover {
  background: var(--accent);
  border-color: var(--accent-dark);
  color: var(--primary-dark);
}
.btn-success {
  background: linear-gradient(135deg, #28a745, #5cb85c);
  border: none;
  color: #fff;
}
.btn-success:hover { background: linear-gradient(135deg, #218838, #4cae4c); color: #fff; }
.btn-danger {
  background: linear-gradient(135deg, #dc3545, #e74c3c);
  border: none;
  color: #fff;
}
.btn-danger:hover { background: linear-gradient(135deg, #c82333, #d32f2f); color: #fff; }
.btn-warning {
  background: linear-gradient(135deg, #f0ad4e, #e89c2e);
  border: none;
  color: #fff;
}
.btn-warning:hover { background: linear-gradient(135deg, #e09e2e, #d4951a); color: #fff; }
.btn-info {
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  border: none;
  color: var(--primary-dark);
}
.btn-info:hover { background: linear-gradient(135deg, var(--primary), var(--accent-dark)); color: #fff; }
.btn-dark {
  background: linear-gradient(135deg, #2d3436, #636e72);
  border: none;
  color: #fff;
}
.btn-sm {
  padding: .28rem .7rem;
  font-size: .78rem;
  border-radius: var(--radius);
}
.btn-sm i { font-size: .82rem; }

/* ── Action button groups ─────────────────────────────────── */
.action-btns {
  display: inline-flex;
  gap: .25rem;
  align-items: center;
  flex-wrap: nowrap;
}
.action-btns .btn { white-space: nowrap; }

/* ── Forms ────────────────────────────────────────────────── */
.form-control, .form-select {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .45rem .75rem;
  transition: var(--transition);
  font-size: .88rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent-dark);
  box-shadow: 0 0 0 .2rem rgba(173, 197, 239, .35);
}
.form-label {
  font-weight: 600;
  color: var(--primary);
  font-size: .82rem;
  margin-bottom: .25rem;
}
.mb-3 { margin-bottom: .85rem !important; }

/* ── Tables ───────────────────────────────────────────────── */
.table {
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 0;
}
.table thead th,
.table thead td {
  background: var(--primary);
  color: var(--text-light);
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: .6rem .7rem;
  border: none;
  vertical-align: middle;
  white-space: nowrap;
}
.table thead th.text-center,
.table thead td.text-center { text-align: center; }
.table tbody td,
.table tbody th {
  padding: .5rem .7rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
}
.table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: rgba(173, 197, 239, .05);
}
.table-hover > tbody > tr:hover > * {
  background-color: rgba(48, 52, 143, .04);
}
.table .nota-final {
  background: var(--primary-dark) !important;
  color: #fff !important;
  font-weight: 700;
}

/* Table responsive wrapper */
.table-responsive {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

/* ── Badges ───────────────────────────────────────────────── */
.badge { font-weight: 600; letter-spacing: .3px; padding: .3em .6em; font-size: .75rem; }
.badge.bg-success { background: linear-gradient(135deg, #28a745, #5cb85c) !important; }
.badge.bg-danger  { background: linear-gradient(135deg, #dc3545, #e74c3c) !important; }
.badge.bg-warning { background: linear-gradient(135deg, #f0ad4e, #e89c2e) !important; color: #fff; }
.badge.bg-info    { background: linear-gradient(135deg, var(--accent-dark), var(--accent)) !important; color: var(--primary-dark); }
.badge.bg-dark    { background: linear-gradient(135deg, #2d3436, #636e72) !important; }

/* ── Modals ───────────────────────────────────────────────── */
.modal-content {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-header {
  background: var(--gradient);
  color: var(--text-light);
  border-bottom: none;
  padding: .75rem 1.15rem;
}
.modal-header .modal-title {
  font-weight: 700;
  font-size: 1rem;
}
.modal-header .btn-close {
  filter: brightness(0) invert(1);
  opacity: .7;
  padding: .5rem;
  margin: -.25rem -.25rem -.25rem auto;
}
.modal-header .btn-close:hover { opacity: 1; }
.modal-body { padding: 1.15rem; }
.modal-body .form-label { font-size: .82rem; }
.modal-footer {
  border-top: 1px solid var(--border);
  padding: .75rem 1.15rem;
  background: rgba(240, 242, 248, .5);
}
.modal-footer .btn { font-size: .85rem; }
.modal-lg { max-width: 800px; }

/* ── Alerts ───────────────────────────────────────────────── */
.alert { border: none; border-radius: var(--radius-lg); font-weight: 500; font-size: .88rem; }
.alert-success { background: linear-gradient(135deg, #d4edda, #c3e6cb); color: #155724; }
.alert-danger  { background: linear-gradient(135deg, #f8d7da, #f5c6cb); color: #721c24; }
.alert-warning { background: linear-gradient(135deg, #fff3cd, #ffeeba); color: #856404; }
.alert-info    { background: linear-gradient(135deg, var(--accent-light), var(--accent)); color: var(--primary-dark); }

/* ── Dropdowns ────────────────────────────────────────────── */
.dropdown-menu {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: .35rem;
}
.dropdown-item {
  border-radius: var(--radius);
  padding: .4rem .8rem;
  font-size: .85rem;
  transition: var(--transition);
}
.dropdown-item:hover {
  background: var(--accent-light);
  color: var(--primary-dark);
}
.dropdown-item i {
  width: 1.1rem;
  text-align: center;
  margin-right: .25rem;
}

/* ── Tabs / Pagination ────────────────────────────────────── */
.page-link {
  color: var(--primary);
  border: 1px solid var(--border);
  border-radius: var(--radius) !important;
  margin: 0 2px;
  font-weight: 500;
  font-size: .85rem;
}
.page-link:hover { background: var(--accent-light); color: var(--primary-dark); }
.page-item.active .page-link {
  background: var(--gradient-btn);
  border-color: var(--primary);
}
.nav-tabs .nav-link {
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  color: var(--primary);
  font-weight: 500;
  font-size: .85rem;
}
.nav-tabs .nav-link.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ── Input groups ─────────────────────────────────────────── */
.input-group .input-group-text {
  background: var(--accent-light);
  border: 1px solid var(--border);
  color: var(--primary);
  border-radius: var(--radius) 0 0 var(--radius);
  font-size: .85rem;
}
.input-group .form-control {
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ── Utilities ────────────────────────────────────────────── */
.text-primary-custom { color: var(--primary) !important; }
.bg-gradient-primary { background: var(--gradient) !important; }
.border-primary { border-color: var(--accent) !important; }
.shadow-custom { box-shadow: var(--shadow); }
.shadow-custom-lg { box-shadow: var(--shadow-lg); }

/* ── Pantalla de espera / overlay ─────────────────────────── */
.wait-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(35, 38, 106, .65);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
.wait-overlay.show {
  display: flex;
}
.wait-box {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.75rem 2.25rem;
  text-align: center;
  min-width: 260px;
}
.wait-spinner {
  width: 52px;
  height: 52px;
  margin: 0 auto .9rem;
  border: 5px solid var(--accent-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: wait-spin .8s linear infinite;
}
@keyframes wait-spin {
  to { transform: rotate(360deg); }
}
.wait-box h5 {
  color: var(--primary);
  font-weight: 700;
  margin: 0 0 .2rem;
}
.wait-box p {
  color: var(--text-muted);
  font-size: .82rem;
  margin: 0;
}

/* ── SweetAlert2 theme fix ────────────────────────────────── */
.swal2-popup { border-radius: var(--radius-lg) !important; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 991px) {
  .page-hero { padding: .8rem 0; }
  .page-hero h2 { font-size: 1.1rem; }
  .section-header { flex-direction: column; align-items: flex-start; }
  .table { font-size: .82rem; }
}

/* ── Print ────────────────────────────────────────────────── */
@media print {
  .navbar, .btn, .no-print, .sidebar-card { display: none !important; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  .table { box-shadow: none; }
}
