/* =============================================
   Academy - Sistema de Gestión de Matrícula
============================================= */

:root {
    --sidebar-bg: #1a1c2e;
    --sidebar-bg2: #252848;
    --primary: #4e73df;
    --success: #1cc88a;
    --warning: #f6c23e;
    --danger: #e74a3b;
    --info: #36b9cc;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 78px;
}

body { font-family: 'Segoe UI', system-ui, sans-serif; background-color: #f0f2f5; color: #3a3b45; }

/* SIDEBAR */
#sidebar {
    position: fixed; top: 0; left: 0; height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg2) 100%);
    z-index: 1000; overflow-y: auto; overflow-x: hidden;
    box-shadow: 4px 0 15px rgba(0,0,0,0.2);
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent;
    transition: width 0.25s ease;
}
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.sidebar-brand {
    display: flex; align-items: center;
    padding: 20px 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-decoration: none;
}
.sidebar-brand-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, #4e73df, #36b9cc);
    border-radius: 10px; display: flex; align-items: center; justify-content: center;
    color: white; font-size: 1.1rem; flex-shrink: 0;
}
.sidebar-brand-text { color: white; font-weight: 700; font-size: 1rem; margin-left: 10px; line-height: 1.2; }
.sidebar-brand-text small { display: block; font-size: 0.68rem; opacity: 0.6; font-weight: 400; }

.sidebar-heading {
    color: rgba(255,255,255,0.4); font-size: 0.65rem; font-weight: 700;
    letter-spacing: 0.1em; text-transform: uppercase; padding: 16px 18px 6px; margin: 0;
}
.nav-link-sidebar {
    display: flex; align-items: center; padding: 10px 18px;
    color: rgba(255,255,255,0.72); text-decoration: none;
    transition: all 0.2s ease; font-size: 0.875rem; gap: 10px;
}
.nav-link-sidebar:hover { color: white; background: rgba(255,255,255,0.08); }
.nav-link-sidebar.active { color: white; background: rgba(78,115,223,0.25); border-left: 3px solid var(--primary); }
.nav-link-sidebar i { width: 20px; text-align: center; font-size: 0.9rem; }
.nav-submenu { background: rgba(0,0,0,0.15); list-style: none; padding: 0; margin: 0; }
.nav-submenu .nav-link-sidebar { padding-left: 48px; font-size: 0.82rem; color: rgba(255,255,255,0.6); }
.nav-submenu .nav-link-sidebar:hover, .nav-submenu .nav-link-sidebar.active { color: white; }
.nav-link-sidebar .arrow { margin-left: auto; transition: transform 0.2s; font-size: 0.7rem; }
.nav-link-sidebar[aria-expanded="true"] .arrow { transform: rotate(180deg); }

/* SIDEBAR COLLAPSED (icon-only, desktop) */
body.sidebar-collapsed #sidebar { width: var(--sidebar-collapsed-width); }
body.sidebar-collapsed #content-wrapper { margin-left: var(--sidebar-collapsed-width); }
body.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 20px 0 16px; }
body.sidebar-collapsed .sidebar-brand-text { display: none; }
body.sidebar-collapsed .sidebar-heading { display: none; }
body.sidebar-collapsed .nav-link-sidebar { justify-content: center; padding: 10px 0; gap: 0; font-size: 0; }
body.sidebar-collapsed .nav-link-sidebar i:not(.arrow) { font-size: 0.95rem; }
body.sidebar-collapsed .nav-link-sidebar .arrow { display: none; }
body.sidebar-collapsed .collapse { display: none !important; }

/* TOPBAR USER */
.topbar-user { position: relative; }
.topbar-user-toggle { text-decoration: none; cursor: pointer; padding: 4px 6px; border-radius: 8px; transition: background 0.15s; }
.topbar-user-toggle:hover { background: #f4f5fa; }
.topbar-user-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--info));
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    color: white; font-size: 0.85rem; font-weight: 700; flex-shrink: 0;
}
.topbar-user-name { font-size: 0.82rem; font-weight: 600; color: #3a3b45; line-height: 1.15; }
.topbar-user-role { font-size: 0.68rem; color: #858796; }

/* LAYOUT */
#content-wrapper { margin-left: var(--sidebar-width); min-height: 100vh; display: flex; flex-direction: column; transition: margin-left 0.25s ease; }
.topbar {
    height: 60px; background: white; box-shadow: 0 1px 8px rgba(0,0,0,0.08);
    display: flex; align-items: center; padding: 0 24px; position: sticky; top: 0; z-index: 100; gap: 12px;
}
.topbar-title { font-size: 1rem; font-weight: 600; color: #3a3b45; flex: 1; }
.topbar .breadcrumb { margin: 0; background: none; padding: 0; font-size: 0.8rem; }
.page-content { padding: 24px; flex: 1; }

/* CARDS */
.card { border: none; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.card-header { background: white; border-bottom: 1px solid #f0f0f0; border-radius: 12px 12px 0 0 !important; padding: 16px 20px; font-weight: 600; }

.stat-card { border-left: 4px solid; border-radius: 12px; transition: transform 0.2s, box-shadow 0.2s; }
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.1) !important; }
.stat-card.primary { border-left-color: var(--primary); }
.stat-card.success { border-left-color: var(--success); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card.danger { border-left-color: var(--danger); }
.stat-card.info { border-left-color: var(--info); }
.stat-card .stat-icon { font-size: 2rem; opacity: 0.2; }
.stat-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #858796; }
.stat-value { font-size: 1.6rem; font-weight: 700; color: #3a3b45; line-height: 1.2; }

/* BADGES */
.badge-mora { background: #fde8e8; color: #c0392b; font-size: 0.72rem; }
.badge-activo { background: #e8f8f2; color: #1a7a50; font-size: 0.72rem; }
.badge-inactivo { background: #f2f2f5; color: #7a7a8a; font-size: 0.72rem; }
.badge-cerrado { background: #fff3cd; color: #856404; font-size: 0.72rem; }

/* TABLES */
.table-hover tbody tr:hover { background-color: rgba(78,115,223,0.04); }
.table th { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #858796; background: #f8f9fc; border-bottom: 2px solid #e3e6f0; }

/* LOGIN */
.login-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--sidebar-bg) 0%, #2d3561 60%, #4e73df 100%);
    display: flex; align-items: center; justify-content: center;
}
.login-card { background: white; border-radius: 20px; padding: 40px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-logo { width: 64px; height: 64px; background: linear-gradient(135deg, var(--primary), var(--info)); border-radius: 16px; display: flex; align-items: center; justify-content: center; color: white; font-size: 1.8rem; margin: 0 auto 20px; }

/* HISTORIAL MESES */
.mes-card { border-radius: 10px; padding: 12px 16px; margin-bottom: 8px; display: flex; align-items: center; gap: 12px; transition: transform 0.15s; }
.mes-card:hover { transform: translateX(2px); }
.mes-card.pagado { background: #e8f8f2; border-left: 3px solid var(--success); }
.mes-card.mora { background: #fde8e8; border-left: 3px solid var(--danger); }
.mes-card.pendiente { background: #fff8e8; border-left: 3px solid var(--warning); }
.mes-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.mes-card.pagado .mes-icon { background: var(--success); color: white; }
.mes-card.mora .mes-icon { background: var(--danger); color: white; }
.mes-card.pendiente .mes-icon { background: var(--warning); color: white; }

/* FORMS & BUTTONS */
.btn { border-radius: 8px; font-size: 0.875rem; font-weight: 500; padding: 7px 16px; }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: #2e59d9; border-color: #2e59d9; }
.form-control, .form-select { border-radius: 8px; border-color: #e3e6f0; font-size: 0.875rem; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 0.15rem rgba(78,115,223,0.2); }
.form-label { font-size: 0.83rem; font-weight: 600; color: #555; }
.empty-state { text-align: center; padding: 48px 24px; color: #b0b3c0; }
.empty-state i { font-size: 3rem; margin-bottom: 12px; }

/* RESPONSIVE */
@media (max-width: 768px) {
    #sidebar { width: 0; overflow: hidden; }
    #sidebar.show { width: var(--sidebar-width); }
    #content-wrapper { margin-left: 0; }
}

/* DataTables */
.dataTables_wrapper .dataTables_filter input { border-radius: 8px; border: 1px solid #e3e6f0; padding: 4px 12px; }
.dataTables_wrapper .dataTables_length select { border-radius: 8px; border: 1px solid #e3e6f0; }
table.dataTable thead th { background: #f8f9fc !important; }
