/* ═══════════════════════════════════════════════════════════
   CUL App — Estilos Globales
   Azul CUL: #0b468a · Naranja CUL: #d98b20 · Montserrat
   ═══════════════════════════════════════════════════════════ */

:root {
  --cul-azul:      #0b468a;
  --cul-azul-dark: #083568;
  --cul-naranja:   #d98b20;
  --cul-naranja-l: #f0a832;
  --bg:            #f0f4f8;
  --surface:       #ffffff;
  --border:        #dde3eb;
  --text:          #1a2535;
  --text-muted:    #64748b;
  --danger:        #dc2626;
  --success:       #16a34a;
  --warning:       #d97706;
  --info:          #0891b2;
  --sidebar-w:     240px;
  --topbar-h:      60px;
  --radius:        10px;
  --shadow:        0 2px 12px rgba(11,70,138,.10);
}

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

body {
  font-family: 'Montserrat', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ── Utilities ──────────────────────────────────────────── */
.hidden        { display: none !important; }
.text-muted    { color: var(--text-muted); }
.text-danger   { color: var(--danger); }
.text-success  { color: var(--success); }
.text-warning  { color: var(--warning); }
.text-center   { text-align: center; }
.fw-600        { font-weight: 600; }
.mt-1          { margin-top: .5rem; }
.mt-2          { margin-top: 1rem; }
.mb-1          { margin-bottom: .5rem; }
.mb-2          { margin-bottom: 1rem; }
.flex          { display: flex; }
.gap-1         { gap: .5rem; }
.gap-2         { gap: 1rem; }
.align-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.wrap          { flex-wrap: wrap; }

/* ── Login ─────────────────────────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--cul-azul) 0%, var(--cul-azul-dark) 100%);
  padding: 1rem;
}

.login-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.logo-icon {
  width: 56px; height: 56px;
  background: var(--cul-azul);
  color: #fff;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.1rem;
  flex-shrink: 0;
}

.login-logo h1 { font-size: 1.5rem; font-weight: 700; color: var(--cul-azul); }
.login-logo p  { font-size: .8rem; color: var(--text-muted); }

.login-error {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fca5a5;
  border-radius: 8px;
  padding: .6rem 1rem;
  margin-top: 1rem;
  font-size: .85rem;
}

.login-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: .75rem;
  margin-top: 1.5rem;
}

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

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--cul-azul);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform .3s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.sidebar-logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: #fff;
}

.sidebar-close {
  background: none; border: none; color: rgba(255,255,255,.7);
  cursor: pointer; font-size: 1rem; display: none;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1.25rem;
  color: rgba(255,255,255,.8);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all .2s;
  font-size: .88rem;
  font-weight: 500;
}

.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active {
  background: rgba(255,255,255,.15);
  color: #fff;
  border-left-color: var(--cul-naranja);
  font-weight: 600;
}

.nav-item .nav-icon { font-size: 1.1rem; width: 22px; text-align: center; }

.nav-section-title {
  padding: .5rem 1.25rem .25rem;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: 1px;
  color: rgba(255,255,255,.4);
  text-transform: uppercase;
}

.sidebar-user {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.12);
  font-size: .8rem;
  color: rgba(255,255,255,.7);
}

.sidebar-user strong { display: block; color: #fff; font-size: .9rem; margin-bottom: .2rem; }

.btn-logout {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.8);
  padding: .6rem 1.25rem;
  cursor: pointer;
  font-family: inherit;
  font-size: .85rem;
  text-align: left;
  transition: background .2s;
  margin: .5rem;
  border-radius: var(--radius);
  font-weight: 500;
}
.btn-logout:hover { background: rgba(220,38,38,.3); color: #fff; }

.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 199;
}

/* Topbar */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  gap: 1rem;
}

.hamburger {
  background: none; border: none; cursor: pointer;
  display: none; flex-direction: column; gap: 5px;
  padding: .25rem;
}
.hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--cul-azul); border-radius: 2px;
}

.topbar-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--cul-azul);
  flex: 1;
}

.topbar-right { display: flex; align-items: center; gap: 1rem; }

.topbar-badge {
  background: var(--cul-naranja);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  padding: .2rem .6rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.topbar-time { font-size: .8rem; color: var(--text-muted); font-weight: 500; }

.page-content { padding: 1.5rem; flex: 1; }

/* ── Components ─────────────────────────────────────────── */

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--cul-azul);
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform .2s;
}
.kpi-card:hover { transform: translateY(-2px); }

.kpi-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--cul-azul);
  line-height: 1;
  margin-bottom: .35rem;
}

.kpi-label { font-size: .78rem; color: var(--text-muted); font-weight: 500; }

.kpi-card.naranja .kpi-value { color: var(--cul-naranja); }
.kpi-card.success .kpi-value { color: var(--success); }
.kpi-card.danger  .kpi-value { color: var(--danger); }
.kpi-card.warning .kpi-value { color: var(--warning); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.1rem;
  border-radius: 8px;
  border: none;
  font-family: inherit;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary   { background: var(--cul-azul);    color: #fff; }
.btn-primary:hover   { background: var(--cul-azul-dark); }
.btn-naranja   { background: var(--cul-naranja);  color: #fff; }
.btn-naranja:hover   { background: var(--cul-naranja-l); }
.btn-success   { background: var(--success);      color: #fff; }
.btn-success:hover   { background: #15803d; }
.btn-danger    { background: var(--danger);       color: #fff; }
.btn-danger:hover    { background: #b91c1c; }
.btn-outline   { background: transparent; border: 1.5px solid var(--cul-azul); color: var(--cul-azul); }
.btn-outline:hover   { background: var(--cul-azul); color: #fff; }
.btn-ghost     { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover     { background: var(--bg); }
.btn-block     { width: 100%; justify-content: center; padding: .75rem; }
.btn-sm        { padding: .35rem .7rem; font-size: .78rem; }
.btn:disabled  { opacity: .5; cursor: not-allowed; }

/* Forms */
.field-group { margin-bottom: 1rem; }
.field-group label {
  display: block;
  font-weight: 600;
  font-size: .82rem;
  color: var(--text-muted);
  margin-bottom: .35rem;
  text-transform: uppercase;
  letter-spacing: .5px;
}

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="time"], select, textarea {
  width: 100%;
  padding: .6rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: .9rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color .2s;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--cul-azul);
  box-shadow: 0 0 0 3px rgba(11,70,138,.1);
}

textarea { resize: vertical; min-height: 80px; }

/* Tables */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
thead { background: var(--cul-azul); color: #fff; }
th { padding: .75rem 1rem; text-align: left; font-weight: 600; font-size: .78rem; white-space: nowrap; }
td { padding: .65rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .65rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.badge-blue     { background: #dbeafe; color: var(--cul-azul); }
.badge-green    { background: #dcfce7; color: var(--success); }
.badge-orange   { background: #ffedd5; color: var(--cul-naranja); }
.badge-red      { background: #fee2e2; color: var(--danger); }
.badge-gray     { background: #f1f5f9; color: var(--text-muted); }
.badge-purple   { background: #f3e8ff; color: #7c3aed; }

/* Progress bars */
.progress-bar {
  height: 10px;
  background: var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--cul-azul), var(--cul-naranja));
  transition: width .5s ease;
}

/* Toast */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.toast {
  padding: .85rem 1.25rem;
  border-radius: 10px;
  color: #fff;
  font-size: .88rem;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  animation: toastIn .3s ease;
  max-width: 360px;
}
.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }
.toast-info    { background: var(--cul-azul); }
.toast-warning { background: var(--warning); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: none; }
}

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(2px);
}

.modal-box {
  background: var(--surface);
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 1rem; font-weight: 700; color: var(--cul-azul); }
.modal-close { background: none; border: none; font-size: 1.1rem; cursor: pointer; color: var(--text-muted); }
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 1.5rem; overflow-y: auto; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
}

/* Checkin / class cards */
.class-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  margin-bottom: .75rem;
  background: var(--surface);
  transition: box-shadow .2s;
}
.class-card:hover { box-shadow: var(--shadow); }
.class-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .6rem;
}
.class-card-title { font-weight: 700; font-size: .95rem; color: var(--cul-azul); }
.class-card-meta  { font-size: .8rem; color: var(--text-muted); margin-top: .15rem; }
.class-card-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }

.nocturna-badge {
  background: #1e1b4b;
  color: #c7d2fe;
  font-size: .7rem;
  padding: .15rem .5rem;
  border-radius: 20px;
  font-weight: 600;
}

/* Syllabus progress */
.syllabus-unit {
  padding: .75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: .5rem;
}
.syllabus-unit-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: .35rem;
}
.syllabus-unit-name { font-weight: 600; font-size: .88rem; }
.syllabus-pct { font-size: .8rem; color: var(--cul-azul); font-weight: 700; }

/* Alert boxes */
.alert {
  padding: .8rem 1rem;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 500;
  margin-bottom: .75rem;
  display: flex;
  align-items: flex-start;
  gap: .6rem;
}
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alert-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.alert-danger  { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }

/* Loading */
.loading-spinner {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  font-weight: 500;
}
.loading-spinner::before {
  content: '';
  display: block;
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--cul-azul);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Page header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.page-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--cul-azul);
}
.page-header p { font-size: .85rem; color: var(--text-muted); margin-top: .2rem; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: none;
  }
  .sidebar-close { display: block; }
  .hamburger     { display: flex; }
  .main-content  { margin-left: 0; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .page-content { padding: 1rem; }
  .topbar { padding: 0 1rem; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .modal-box { max-height: 100vh; border-radius: 0; }
  .login-card { padding: 1.75rem; }
}
