/* ==========================================================
   SIRGES - Admin Styles
   ========================================================== */

:root {
    --sidebar-width: 250px;
    --sidebar-collapsed: 0px;
    --topbar-height: 56px;
    --sidebar-bg: #1e1e2d;
    --sidebar-hover: #2a2a3d;
    --sidebar-active: #3a3a5c;
    --sidebar-text: #a2a3b7;
    --sidebar-text-active: #ffffff;
    --sidebar-divider: rgba(255,255,255,0.07);
    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-dark: #4f46e5;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --bg-main: #f1f5f9;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --card-shadow-hover: 0 10px 25px rgba(0,0,0,0.08);
    --radius: 0.75rem;
    --radius-sm: 0.5rem;
    --transition: 0.2s ease;
}

* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Top Navbar */
.top-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--sidebar-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 1040;
    border-bottom: 1px solid var(--sidebar-divider);
}

.top-navbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.top-navbar-brand {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.top-navbar-brand i {
    font-size: 1.3rem;
    color: var(--accent-light);
}

.top-navbar-brand:hover {
    color: #fff;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.375rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.sidebar-toggle:hover {
    color: #fff;
    background: var(--sidebar-hover);
}

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

.user-info {
    display: flex;
    align-items: center;
    color: var(--sidebar-text);
    font-size: 0.85rem;
}

.user-name {
    font-weight: 500;
}

.btn-logout {
    color: var(--sidebar-text);
    font-size: 1.2rem;
    transition: var(--transition);
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
}

.btn-logout:hover {
    color: var(--danger);
    background: rgba(239,68,68,0.1);
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--topbar-height));
    background: var(--sidebar-bg);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1030;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--sidebar-divider);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0.75rem 0;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
}

.sidebar-item {
    padding: 0 0.75rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.875rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    margin-bottom: 2px;
}

.sidebar-link:hover {
    color: var(--sidebar-text-active);
    background: var(--sidebar-hover);
}

.sidebar-link.active {
    color: var(--sidebar-text-active);
    background: var(--accent);
}

.sidebar-link i {
    font-size: 1.1rem;
    width: 1.25rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-divider {
    padding: 0.75rem 1.5rem 0.375rem;
    list-style: none;
}

.sidebar-divider span {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.25);
    font-weight: 600;
}

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--sidebar-divider);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1020;
}

/* Main Content */
.admin-body {
    margin: 0;
    padding: 0;
    background: var(--bg-main);
    min-height: 100vh;
}

.admin-main {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    min-height: calc(100vh - var(--topbar-height));
    transition: margin-left 0.3s ease;
}

/* Login page override */
.login-page {
    background: linear-gradient(135deg, #1e1e2d 0%, #2d2d44 50%, #1e1e2d 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-page .card {
    border: none;
    border-radius: var(--radius);
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
}

/* Responsive */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar-overlay.show {
        display: block;
    }

    .admin-main {
        margin-left: 0;
    }
}

/* Cards */
.card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    transition: box-shadow var(--transition);
}

.card:hover {
    box-shadow: var(--card-shadow-hover);
}

/* Stat Cards */
.stat-card {
    position: relative;
    overflow: hidden;
    border: none;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    color: #1e293b;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Grilla de pagos */
.grilla-pagos {
    overflow-x: auto;
}

.grilla-pagos table {
    border-collapse: separate;
    border-spacing: 0;
    min-width: 100%;
}

.grilla-pagos th {
    background: #f8fafc;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.6rem 0.5rem;
    white-space: nowrap;
    border-bottom: 2px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 5;
}

.grilla-pagos th:first-child {
    position: sticky;
    left: 0;
    z-index: 10;
    background: #f8fafc;
    min-width: 200px;
}

.grilla-pagos td:first-child {
    position: sticky;
    left: 0;
    z-index: 5;
    background: #fff;
    font-weight: 500;
    font-size: 0.85rem;
    min-width: 200px;
    border-right: 2px solid #e2e8f0;
}

.grilla-pagos td {
    padding: 0.4rem;
    text-align: center;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    min-width: 80px;
}

.grilla-pagos tr:hover td {
    background-color: #f8fafc;
}

.grilla-pagos tr:hover td:first-child {
    background-color: #f1f5f9;
}

/* Celdas de estado de pago */
.pago-cell {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
    border: 2px solid transparent;
    text-decoration: none;
}

.pago-cell:hover {
    transform: scale(1.15);
}

.pago-pagado {
    background: #dcfce7;
    color: #16a34a;
    border-color: #bbf7d0;
}

.pago-pagado:hover {
    background: #bbf7d0;
    color: #16a34a;
}

.pago-pendiente {
    background: #f1f5f9;
    color: #94a3b8;
    border-color: #e2e8f0;
}

.pago-pendiente:hover {
    background: #e2e8f0;
    color: #64748b;
    border-color: #cbd5e1;
}

.pago-nc {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fecaca;
}

.pago-nc:hover {
    background: #fecaca;
    color: #b91c1c;
    border-color: #fca5a5;
}

.pago-imputado {
    background: #dbeafe;
    color: #2563eb;
    border-color: #bfdbfe;
}

.pago-imputado:hover {
    background: #bfdbfe;
    color: #1d4ed8;
}

/* Pago de alumno becado */
.pago-becado {
    background: #ede9fe;
    color: #7c3aed;
    border-color: #ddd6fe;
}

.pago-becado:hover {
    background: #ddd6fe;
    color: #6d28d9;
}

/* Badge de becado */
.badge-becado {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    letter-spacing: 0.03em;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    animation: fadeIn 0.3s ease;
}

/* Botón de beca */
.btn-beca {
    background: none;
    border: 1.5px solid #c4b5fd;
    color: #7c3aed;
    border-radius: 6px;
    padding: 0.15rem 0.4rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    line-height: 1;
}

.btn-beca:hover {
    background: #7c3aed;
    color: #fff;
    border-color: #7c3aed;
    transform: scale(1.05);
}

.btn-beca.btn-beca-quitar {
    border-color: #fca5a5;
    color: #dc2626;
}

.btn-beca.btn-beca-quitar:hover {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
}

/* Fila de alumno becado en la grilla */
.grilla-pagos tr.fila-becado td {
    background-color: #faf5ff;
}

.grilla-pagos tr.fila-becado:hover td {
    background-color: #f3e8ff;
}

.grilla-pagos tr.fila-becado td:first-child {
    background-color: #faf5ff;
    border-left: 3px solid #8b5cf6;
}

.grilla-pagos tr.fila-becado:hover td:first-child {
    background-color: #f3e8ff;
}

.pago-vencido {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

.pago-vencido:hover {
    background: #fecaca;
    color: #dc2626;
}

/* Indicadores financieros */
.indicador-positivo {
    color: var(--success);
}

.indicador-negativo {
    color: var(--danger);
}

.indicador-neutro {
    color: var(--warning);
}

.text-money-positive {
    color: #16a34a;
    font-weight: 600;
}

.text-money-negative {
    color: #dc2626;
    font-weight: 600;
}

.text-retencion {
    color: #114a97 !important;
    font-weight: 600;
}

.badge-retencion {
    background-color: rgba(17, 74, 151, 0.1) !important;
    color: #114a97 !important;
}

.badge-director {
    background-color: rgba(124, 58, 237, 0.12);
    color: #6d28d9;
}

.badge-coordinador {
    background-color: rgba(13, 148, 136, 0.12);
    color: #0f766e;
}

/* Barra de progreso de recaudacion */
.progress-recaudacion {
    height: 8px;
    border-radius: 4px;
    background: #e2e8f0;
    overflow: hidden;
}

.progress-recaudacion .progress-bar {
    border-radius: 4px;
    transition: width 0.6s ease;
}

/* Tablas generales */
.table-sirges {
    font-size: 0.875rem;
}

.table-sirges th {
    font-weight: 600;
    color: #475569;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #e2e8f0;
    background: #f8fafc;
    padding: 0.75rem;
}

.table-sirges td {
    padding: 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.table-sirges tbody tr:hover {
    background: #f8fafc;
}

/* Action buttons in tables */
.btn-action {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    border-radius: 0.375rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: all var(--transition);
}

/* Page headers */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.page-header p {
    color: #64748b;
    margin: 0.25rem 0 0;
    font-size: 0.9rem;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #94a3b8;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h5 {
    color: #64748b;
    font-weight: 600;
}

/* Breadcrumb */
.breadcrumb-item a {
    color: var(--accent);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    color: var(--accent-dark);
    text-decoration: underline;
}

/* Badge styles */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
}

/* Form styles */
.form-label {
    font-weight: 500;
    font-size: 0.85rem;
    color: #475569;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--accent-light);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Btn accent */
.btn-accent {
    background: var(--accent);
    color: #fff;
    border: none;
    font-weight: 500;
}

.btn-accent:hover {
    background: var(--accent-dark);
    color: #fff;
}

/* Alert status for programs */
.programa-status-ok {
    border-left: 4px solid var(--success);
}

.programa-status-warning {
    border-left: 4px solid var(--warning);
}

.programa-status-danger {
    border-left: 4px solid var(--danger);
}

/* Calendario de meses (anulados) */
.card-mes-calendario {
    cursor: pointer;
    transition: all var(--transition);
    border: 2px solid transparent;
}

.card-mes-calendario.mes-activo {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.card-mes-calendario.mes-activo:hover {
    border-color: #86efac;
    box-shadow: 0 2px 8px rgba(34,197,94,0.15);
}

.card-mes-calendario.mes-anulado {
    border-color: #fecaca;
    background: #fef2f2;
    opacity: 0.75;
}

.card-mes-calendario.mes-anulado:hover {
    opacity: 1;
    border-color: #fca5a5;
    box-shadow: 0 2px 8px rgba(239,68,68,0.15);
}

.card-mes-calendario .form-check-input:checked {
    background-color: var(--danger);
    border-color: var(--danger);
}

/* Comprobante preview */
.comprobante-preview {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius-sm);
    border: 1px solid #e2e8f0;
}

/* Scrollbar styles */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--sidebar-hover);
    border-radius: 4px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* Print styles */
@media print {
    .sidebar, .top-navbar, .sidebar-toggle, .btn-logout, .btn-action {
        display: none !important;
    }
    .admin-main {
        margin-left: 0 !important;
        margin-top: 0 !important;
    }
}
