/* ============================================================
   PANEL ADMINISTRATIVO — Sistema de Matrículas
   ============================================================ */

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

:root {
    --sidebar-w: 240px;
    --primary:      #2b6cb0;
    --primary-light:#ebf4ff;
    --primary-mid:  rgba(43,108,176,.12);
    --success:      #38a169;
    --success-light:#f0fff4;
    --warning:      #d69e2e;
    --warning-light:#fffaf0;
    --danger:       #e53e3e;
    --danger-light: #fff5f5;
    --gray-50:   #f7fafc;
    --gray-100:  #edf2f7;
    --gray-200:  #e2e8f0;
    --gray-400:  #a0aec0;
    --gray-500:  #718096;
    --gray-600:  #718096;
    --gray-700:  #4a5568;
    --gray-800:  #2d3748;
    --gray-900:  #1a202c;
    --sidebar-bg:#2b6cb0;
    --radius-sm: 5px;
    --radius:    8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
    --shadow:    0 4px 16px rgba(0,0,0,.12);
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; color: var(--gray-800); background: var(--gray-50); }

/* Layout */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--sidebar-bg); color: #a0aec0; flex-shrink: 0; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; z-index: 100; }
.admin-main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* Sidebar */
.sidebar-brand { padding: 14px 16px; color: white; border-bottom: 1px solid rgba(255,255,255,.18); display: flex; align-items: flex-start; gap: 10px; }
.sidebar-logo-img   { height: 43px; width: auto; max-width: 58px; object-fit: contain; border-radius: 5px; flex-shrink: 0; margin-top: 1px; }
.sidebar-brand-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 700; line-height: 1.35; word-break: break-word; color: white; }
/* ── Sidebar nav ──────────────────────────────────────────────── */
.sidebar-nav { padding: 10px 0; flex: 1; overflow-x: hidden; overflow-y: auto; }

/* Standalone link */
.nav-solo {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 14px; margin: 1px 8px; border-radius: 7px;
    color: #ffffff; text-decoration: none; font-size: 13px; font-weight: 500;
    transition: background .15s;
}
.nav-solo:hover  { background: rgba(255,255,255,.15); }
.nav-solo.active { background: rgba(255,255,255,.22); font-weight: 700;
                   border-left: 3px solid #fff; padding-left: 11px; }

/* Icon wrapper */
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.nav-icon svg { width: 16px; height: 16px; }
.nav-solo .nav-icon, .nav-group-toggle .nav-icon { opacity: .8; transition: opacity .15s; }
.nav-solo:hover .nav-icon, .nav-solo.active .nav-icon,
.nav-group.open > .nav-group-toggle .nav-icon,
.nav-group-toggle:hover .nav-icon { opacity: 1; }

/* Collapsible group */
.nav-group { margin: 1px 0; }
.nav-group-toggle {
    display: flex; align-items: center; gap: 10px;
    width: calc(100% - 16px); margin: 0 8px; padding: 9px 14px;
    background: none; border: none; border-radius: 7px; cursor: pointer;
    color: #ffffff; font-size: 13px; font-weight: 500;
    text-align: left; transition: background .15s;
}
.nav-group-toggle:hover { background: rgba(255,255,255,.15); }
.nav-group.open > .nav-group-toggle { background: rgba(255,255,255,.18); font-weight: 700; }

.nav-label { flex: 1; line-height: 1; }

/* Chevron */
.nav-chevron { width: 12px; height: 12px; flex-shrink: 0; color: rgba(255,255,255,.6); transition: transform .2s ease, color .15s; }
.nav-group-toggle:hover .nav-chevron, .nav-group.open .nav-chevron { color: #fff; }
.nav-group.open .nav-chevron { transform: rotate(90deg); }

/* Group children container */
.nav-group-body { overflow: hidden; max-height: 0; transition: max-height .25s ease; padding: 0 8px; }
.nav-group.open .nav-group-body { max-height: 360px; }

/* Child link */
.nav-child {
    display: flex; align-items: center;
    padding: 7px 12px 7px 38px; margin: 1px 0; border-radius: 6px;
    color: rgba(255,255,255,.85); text-decoration: none; font-size: 12.5px; font-weight: 400;
    transition: background .13s, color .13s; position: relative;
}
.nav-child::before {
    content: ''; position: absolute; left: 22px;
    width: 4px; height: 4px; border-radius: 50%;
    background: rgba(255,255,255,.5); transition: background .13s;
}
.nav-child:hover { background: rgba(255,255,255,.13); color: #fff; }
.nav-child:hover::before { background: #fff; }
.nav-child.active { background: rgba(255,255,255,.22); color: #fff; font-weight: 600;
                    border-left: 3px solid #fff; padding-left: 35px; }
.nav-child.active::before { display: none; }

/* Divider & section label */
.nav-divider { height: 1px; background: rgba(255,255,255,.2); margin: 8px 16px; }
.nav-section { padding: 10px 22px 4px; font-size: 10px; text-transform: uppercase;
               letter-spacing: 1.2px; color: rgba(255,255,255,.6); font-weight: 700; }

/* ── Sidebar footer ────────────────────────────────────────────── */
.sidebar-footer { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.2); display: flex; align-items: center; gap: 10px; }
.sidebar-footer-info { flex: 1; min-width: 0; }
.footer-user-name { display: block; font-size: 12.5px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.footer-user-rol  { display: block; font-size: 10.5px; color: rgba(255,255,255,.65); margin-top: 2px; text-transform: uppercase; letter-spacing: .5px; }
.sidebar-logout {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; flex-shrink: 0; border-radius: 7px;
    border: 1px solid rgba(255,255,255,.35); color: rgba(255,255,255,.8); text-decoration: none;
    transition: background .15s, color .15s, border-color .15s;
}
.sidebar-logout:hover { background: rgba(255,255,255,.18); color: #fff; border-color: #fff; }

/* Sidebar icon fallback (no logo) */
.sidebar-brand-icon {
    width: 34px; height: 34px; flex-shrink: 0; border-radius: 8px;
    background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center;
    color: white; margin-top: 1px;
}

/* Topbar */
.admin-topbar { background: white; border-bottom: 1px solid var(--gray-200); padding: 0 24px; height: 56px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; }
.admin-topbar h1 { font-size: 18px; font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--gray-600); }
.rol-badge { background: var(--gray-100); color: var(--gray-700); padding: 2px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.rol-badge--admin      { background: #ebf4ff; color: var(--primary); }
.rol-badge--secretaria { background: #f0fff4; color: var(--success); }
.rol-badge--colecturia { background: #fffaf0; color: var(--warning); }
.topbar-user-name { font-size: 13px; color: var(--gray-600); }

/* Content */
.admin-content { padding: 24px; flex: 1; }

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--gray-100); }
.login-card { background: white; padding: 36px; border-radius: 10px; width: 360px; box-shadow: 0 4px 20px rgba(0,0,0,.12); }
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-card h2 { font-size: 14px; color: var(--gray-600); margin-bottom: 24px; font-weight: 400; }

/* Cards */
.card { background: white; border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 20px; overflow: hidden; }
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--gray-100);
    background: white;
}
.card-header h3 { font-size: 15px; font-weight: 700; color: var(--gray-800); margin: 0; letter-spacing: -.2px; }
.card-header-actions { display: flex; align-items: center; gap: 10px; }
.card-body { padding: 20px; }
/* legacy: cards without explicit card-header */
.card > h3 { font-size: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--gray-200); padding-bottom: 12px; padding: 0 20px 12px; margin: 20px 20px 16px; border-bottom: 1px solid var(--gray-100); }

/* Métricas */
.metricas-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.metrica-card { padding: 20px; border-radius: 8px; color: white; }
.metrica-azul    { background: linear-gradient(135deg, #3182ce, #2c5282); }
.metrica-amarillo { background: linear-gradient(135deg, #d69e2e, #975a16); }
.metrica-verde   { background: linear-gradient(135deg, #38a169, #276749); }
.metrica-rojo    { background: linear-gradient(135deg, #e53e3e, #9b2c2c); }
.metrica-naranja { background: linear-gradient(135deg, #ed8936, #c05621); }
.metrica-numero  { font-size: 36px; font-weight: 700; line-height: 1; }
.metrica-label   { font-size: 12px; opacity: .85; margin-top: 6px; }

/* Dashboard grid */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 20px; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; padding: 10px 12px; background: var(--gray-50); border-bottom: 2px solid var(--gray-200); font-weight: 600; color: var(--gray-600); text-transform: uppercase; font-size: 11px; letter-spacing: .5px; white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.table tr:hover td { background: var(--gray-50); }
.table-hover tbody tr:hover td { background: #ebf8ff; }
.row-inactiva td { opacity: .5; }

/* Mini bar */
.mini-bar { display: inline-block; width: 60px; height: 6px; background: var(--gray-200); border-radius: 3px; overflow: hidden; vertical-align: middle; margin-right: 4px; }
.mini-bar-fill { height: 100%; border-radius: 3px; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 16px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--gray-600); text-transform: uppercase; letter-spacing: .4px; }
.form-control { width: 100%; padding: 7px 10px; border: 1px solid var(--gray-200); border-radius: 5px; font-size: 14px; transition: border .15s; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(43,108,176,.15); }
.form-control-sm { padding: 4px 8px; border: 1px solid var(--gray-200); border-radius: 4px; font-size: 13px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; }

/* Filtros */
.filtros-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filtros-form .form-control { flex: 1; min-width: 180px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; justify-content: center; padding: 7px 16px; border: 1px solid transparent; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none; transition: all .15s; white-space: nowrap; }
.btn svg { flex-shrink: 0; }
.btn-primary   { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: #2563a8; border-color: #2563a8; }
.btn-secondary { background: white; color: var(--gray-700); border-color: var(--gray-200); }
.btn-secondary:hover { background: var(--gray-50); border-color: var(--gray-300, #cbd5e0); }
.btn-success   { background: var(--success); color: white; border-color: var(--success); }
.btn-success:hover { filter: brightness(1.08); }
.btn-danger    { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { filter: brightness(1.08); }
.btn-ghost     { background: transparent; color: var(--gray-600); border-color: transparent; }
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-800); }
.btn:disabled  { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn-full      { width: 100%; }
.btn-sm        { padding: 5px 12px; font-size: 12px; gap: 4px; }
.btn-lg        { padding: 10px 24px; font-size: 15px; }

/* ── Action group (icon-only enterprise buttons) ──────────── */
.action-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}
.action-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    transition: background .13s, border-color .13s, color .13s;
    color: var(--gray-500);
    padding: 0;
    position: relative;
}
.action-btn svg { pointer-events: none; flex-shrink: 0; }

/* Edit */
.action-btn--edit { color: var(--primary); }
.action-btn--edit:hover { background: var(--primary-light); border-color: #bee3f8; }

/* Toggle — deactivate */
.action-btn--deactivate { color: var(--warning); }
.action-btn--deactivate:hover { background: var(--warning-light); border-color: #fbd38d; }

/* Toggle — activate */
.action-btn--activate { color: var(--success); }
.action-btn--activate:hover { background: var(--success-light); border-color: #9ae6b4; }

/* Delete */
.action-btn--delete { color: var(--danger); }
.action-btn--delete:hover { background: var(--danger-light); border-color: #feb2b2; }

/* Locked / disabled */
.action-btn--locked { color: var(--gray-400); cursor: not-allowed; }
.action-btn--locked:hover { background: var(--gray-100); border-color: var(--gray-200); }

/* View / neutral */
.action-btn--view { color: var(--gray-600); }
.action-btn--view:hover { background: var(--gray-100); border-color: var(--gray-200); color: var(--gray-800); }

/* Separator */
.action-sep {
    width: 1px; height: 18px;
    background: var(--gray-200);
    margin: 0 3px;
    flex-shrink: 0;
}

/* Alerts */
.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 14px; }
.alert-success { background: #f0fff4; border: 1px solid #9ae6b4; color: #276749; }
.alert-danger  { background: #fff5f5; border: 1px solid #feb2b2; color: #9b2c2c; }
.alert-warning { background: #fffaf0; border: 1px solid #fbd38d; color: #7b341e; }
.alert-info    { background: #ebf8ff; border: 1px solid #90cdf4; color: #2c5282; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-info          { background: #ebf8ff; color: #2c5282; }
.badge-efectivo      { background: #c6f6d5; color: #276749; }
.badge-reservado     { background: #bee3f8; color: #2c5282; }
.badge-en_colecturia { background: #e9d8fd; color: #553c9a; }
.badge-en_secretaria { background: #fefcbf; color: #744210; }
.badge-en_contrato   { background: #fefcbf; color: #744210; }
.badge-liberado      { background: var(--gray-100); color: var(--gray-600); }
.badge-cancelado     { background: #fed7d7; color: #9b2c2c; }
.badge-abierto       { background: #c6f6d5; color: #276749; }
.badge-cerrado       { background: var(--gray-100); color: var(--gray-600); }
.badge-pausado       { background: #fefcbf; color: #744210; }
.badge-finalizado    { background: #e2e8f0; color: #4a5568; }
.badge-pendiente     { background: #fefcbf; color: #744210; }
.badge-verificado    { background: #c6f6d5; color: #276749; }
.badge-rechazado     { background: #fed7d7; color: #9b2c2c; }

/* Pagos */
.pagos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }
.pago-card { }
.pago-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.pago-header h4 { font-size: 15px; }
.pago-datos { font-size: 13px; line-height: 1.8; color: var(--gray-600); margin-bottom: 12px; }
.pago-datos strong { color: var(--gray-800); }
.pago-comprobante { margin-bottom: 12px; }
.pago-acciones { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

code { background: var(--gray-100); padding: 1px 6px; border-radius: 4px; font-family: 'Courier New', monospace; font-size: 12px; }
