/* =====================================================
   Sistema de Secretaría Académica - IESTP DAC
   Premium UI Stylesheet
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #1a237e;
    --primary-light: #283593;
    --primary-dark: #0d1257;
    --secondary: #0d47a1;
    --accent: #00bcd4;
    --accent-light: #4dd0e1;
    --success: #00c853;
    --success-light: #69f0ae;
    --warning: #ff9800;
    --danger: #ff5252;
    --info: #2196f3;
    --dark: #1a1a2e;
    --darker: #0f0f23;
    --light: #f0f2f5;
    --lighter: #f8f9fa;
    --white: #ffffff;
    --gray-100: #f1f3f5;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --navbar-height: 64px;
    --border-radius: 12px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.16);
    --shadow-xl: 0 12px 48px rgba(0,0,0,0.2);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --gradient-primary: linear-gradient(135deg, #1a237e 0%, #0d47a1 100%);
    --gradient-accent: linear-gradient(135deg, #00bcd4 0%, #0097a7 100%);
    --gradient-success: linear-gradient(135deg, #00c853 0%, #009624 100%);
    --gradient-danger: linear-gradient(135deg, #ff5252 0%, #d32f2f 100%);
    --gradient-warning: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    --gradient-purple: linear-gradient(135deg, #7c4dff 0%, #651fff 100%);
    --gradient-dark: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--light);
    color: var(--gray-800);
    overflow-x: hidden;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 { font-family: 'Outfit', sans-serif; font-weight: 700; color: var(--dark); }

/* ---- SIDEBAR ---- */
.sidebar {
    position: fixed; top: 0; left: 0;
    width: var(--sidebar-width); height: 100vh;
    background: var(--gradient-dark);
    z-index: 1050; transition: var(--transition);
    display: flex; flex-direction: column;
    box-shadow: 4px 0 24px rgba(0,0,0,0.2);
}
.sidebar-header {
    padding: 20px; display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    min-height: var(--navbar-height);
}
.sidebar-logo {
    width: 42px; height: 42px; border-radius: 10px;
    background: var(--gradient-accent);
    display: flex; align-items: center; justify-content: center;
    font-family: 'Outfit'; font-weight: 800; font-size: 18px; color: white;
    flex-shrink: 0;
}
.sidebar-logo-img {
    width: 60px; height: 60px; border-radius: 50%;
    object-fit: cover; flex-shrink: 0;
}
.sidebar-brand { color: white; font-family: 'Outfit'; font-size: 15px; font-weight: 600; line-height: 1.3; }
.sidebar-brand small { display: block; font-size: 10px; color: var(--accent); font-weight: 400; letter-spacing: 1px; text-transform: uppercase; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.nav-section { padding: 16px 20px 6px; font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--gray-500); font-weight: 600; }

.nav-item { padding: 0 12px; margin-bottom: 2px; }
.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; border-radius: 10px;
    color: rgba(255,255,255,0.65); font-size: 13.5px; font-weight: 500;
    text-decoration: none; transition: var(--transition);
    position: relative;
}
.nav-link:hover { color: white; background: rgba(255,255,255,0.08); }
.nav-link.active {
    color: white; background: var(--gradient-accent);
    box-shadow: 0 4px 12px rgba(0,188,212,0.3);
}
.nav-link i { font-size: 18px; width: 22px; text-align: center; flex-shrink: 0; }
.nav-link .badge {
    margin-left: auto; font-size: 10px; padding: 3px 8px;
    border-radius: 20px; font-weight: 600;
}

/* ---- MAIN CONTENT ---- */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh; transition: var(--transition);
}

/* ---- TOP NAVBAR ---- */
.top-navbar {
    position: sticky; top: 0; z-index: 1040;
    height: var(--navbar-height);
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--gray-200);
    display: flex; align-items: center;
    padding: 0 24px;
    box-shadow: var(--shadow-sm);
}
.navbar-left { display: flex; align-items: center; gap: 16px; }
.navbar-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }

.btn-toggle-sidebar {
    width: 38px; height: 38px; border: none; border-radius: 10px;
    background: var(--gray-100); color: var(--gray-700);
    cursor: pointer; transition: var(--transition);
    display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.btn-toggle-sidebar:hover { background: var(--primary); color: white; }

.breadcrumb-wrapper { font-size: 13px; }
.breadcrumb-wrapper .breadcrumb { margin: 0; background: none; padding: 0; }
.breadcrumb-wrapper .breadcrumb-item a { color: var(--primary); text-decoration: none; }
.breadcrumb-wrapper .breadcrumb-item.active { color: var(--gray-600); }

.user-dropdown .btn {
    display: flex; align-items: center; gap: 8px;
    background: var(--gray-100); border: none; border-radius: 10px;
    padding: 6px 14px 6px 8px; font-size: 13px; color: var(--gray-700);
    transition: var(--transition);
}
.user-dropdown .btn:hover { background: var(--gray-200); }
.user-avatar {
    width: 32px; height: 32px; border-radius: 8px;
    background: var(--gradient-primary);
    color: white; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px;
}

/* ---- PAGE CONTENT ---- */
.page-content { padding: 24px; }
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-header h1 { font-size: 24px; font-weight: 700; margin: 0; }
.page-header p { font-size: 14px; color: var(--gray-600); margin: 4px 0 0; }

/* ---- CARDS ---- */
.card {
    border: none; border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: hidden;
    background: white;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
    background: white; border-bottom: 1px solid var(--gray-200);
    font-family: 'Outfit'; font-weight: 600; font-size: 15px;
    padding: 16px 20px;
    display: flex; align-items: center; justify-content: space-between;
}
.card-body { padding: 20px; }

/* ---- KPI CARDS ---- */
.kpi-card {
    border-radius: var(--border-radius);
    padding: 24px; color: white;
    position: relative; overflow: hidden;
    transition: var(--transition);
    cursor: default;
}
.kpi-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.kpi-card::before {
    content: ''; position: absolute; top: -30px; right: -30px;
    width: 100px; height: 100px; border-radius: 50%;
    background: rgba(255,255,255,0.1);
}
.kpi-card::after {
    content: ''; position: absolute; bottom: -20px; right: 20px;
    width: 60px; height: 60px; border-radius: 50%;
    background: rgba(255,255,255,0.08);
}
.kpi-card .kpi-icon {
    width: 48px; height: 48px; border-radius: 12px;
    background: rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; margin-bottom: 16px;
    backdrop-filter: blur(4px);
}
.kpi-card .kpi-value { font-family: 'Outfit'; font-size: 32px; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.kpi-card .kpi-label { font-size: 13px; opacity: 0.85; font-weight: 500; }
.kpi-card .kpi-trend { font-size: 12px; margin-top: 8px; opacity: 0.7; }
.kpi-card.kpi-primary { background: var(--gradient-primary); }
.kpi-card.kpi-accent { background: var(--gradient-accent); }
.kpi-card.kpi-success { background: var(--gradient-success); }
.kpi-card.kpi-purple { background: var(--gradient-purple); }
.kpi-card.kpi-warning { background: var(--gradient-warning); }
.kpi-card.kpi-danger { background: var(--gradient-danger); }

/* ---- TABLES ---- */
.table-wrapper { border-radius: var(--border-radius); overflow: hidden; background: white; box-shadow: var(--shadow-sm); }
.table { margin-bottom: 0; font-size: 13.5px; }
.table thead th {
    background: var(--primary-dark); color: white;
    font-weight: 600; font-size: 12px; text-transform: uppercase;
    letter-spacing: 0.5px; padding: 12px 16px; border: none;
    white-space: nowrap;
}
.table tbody td { padding: 10px 16px; vertical-align: middle; border-color: var(--gray-100); }
.table tbody tr { transition: var(--transition); }
.table tbody tr:hover { background: rgba(0,188,212,0.04); }
.table-striped tbody tr:nth-of-type(odd) { background-color: rgba(0,0,0,0.015); }

/* ---- STATUS BADGES ---- */
.badge-status { padding: 5px 12px; border-radius: 20px; font-size: 11px; font-weight: 600; letter-spacing: 0.3px; }
.badge-activo { background: rgba(0,200,83,0.12); color: #00c853; }
.badge-evaluado { background: rgba(33,150,243,0.12); color: #2196f3; }
.badge-ingresante { background: rgba(124,77,255,0.12); color: #7c4dff; }
.badge-rechazado { background: rgba(255,82,82,0.12); color: #ff5252; }
.badge-matriculado { background: rgba(0,188,212,0.12); color: #0097a7; }
.badge-cursando { background: rgba(33,150,243,0.12); color: #1976d2; }
.badge-aprobado { background: rgba(0,200,83,0.12); color: #00c853; }
.badge-desaprobado { background: rgba(255,82,82,0.12); color: #ff5252; }
.badge-retirado { background: rgba(255,152,0,0.12); color: #f57c00; }
.badge-fallecido { background: rgba(0,0,0,0.08); color: #616161; }
.badge-egresado { background: rgba(124,77,255,0.12); color: #7c4dff; }
.badge-regular { background: rgba(0,188,212,0.12); color: #0097a7; }
.badge-irregular { background: rgba(255,152,0,0.12); color: #f57c00; }
.badge-repitente { background: rgba(255,82,82,0.12); color: #ff5252; }

/* ---- BUTTONS ---- */
.btn { border-radius: 8px; font-weight: 500; font-size: 13.5px; transition: var(--transition); padding: 8px 18px; }
.btn-primary-custom {
    background: var(--gradient-primary); border: none; color: white;
    box-shadow: 0 4px 12px rgba(26,35,126,0.3);
}
.btn-primary-custom:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(26,35,126,0.4); color: white; }
.btn-accent {
    background: var(--gradient-accent); border: none; color: white;
    box-shadow: 0 4px 12px rgba(0,188,212,0.3);
}
.btn-accent:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,188,212,0.4); color: white; }
.btn-outline-custom { border: 1.5px solid var(--primary); color: var(--primary); background: transparent; }
.btn-outline-custom:hover { background: var(--primary); color: white; }

.btn-action {
    width: 32px; height: 32px; padding: 0; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 14px; border: none; transition: var(--transition);
}
.btn-action.btn-view { background: rgba(33,150,243,0.1); color: #1976d2; }
.btn-action.btn-view:hover { background: #1976d2; color: white; }
.btn-action.btn-edit { background: rgba(255,152,0,0.1); color: #f57c00; }
.btn-action.btn-edit:hover { background: #f57c00; color: white; }
.btn-action.btn-delete { background: rgba(255,82,82,0.1); color: #ff5252; }
.btn-action.btn-delete:hover { background: #ff5252; color: white; }

/* ---- FORMS ---- */
.form-control, .form-select {
    border: 1.5px solid var(--gray-300); border-radius: 8px;
    padding: 10px 14px; font-size: 13.5px;
    transition: var(--transition);
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,188,212,0.15);
}
.form-label { font-weight: 600; font-size: 13px; color: var(--gray-700); margin-bottom: 6px; }
.form-text { font-size: 12px; color: var(--gray-500); }

/* ---- ALERTS ---- */
.alert { border: none; border-radius: 10px; font-size: 13.5px; padding: 14px 20px; border-left: 4px solid; }
.alert-success { background: rgba(0,200,83,0.08); border-left-color: var(--success); color: #2e7d32; }
.alert-danger { background: rgba(255,82,82,0.08); border-left-color: var(--danger); color: #c62828; }
.alert-warning { background: rgba(255,152,0,0.08); border-left-color: var(--warning); color: #e65100; }
.alert-info { background: rgba(33,150,243,0.08); border-left-color: var(--info); color: #1565c0; }

/* ---- FILTER BAR ---- */
.filter-bar {
    background: white; border-radius: var(--border-radius);
    padding: 16px 20px; margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    display: flex; gap: 12px; align-items: end; flex-wrap: wrap;
}
.filter-bar .form-group { flex: 1; min-width: 180px; }
.filter-bar .form-group label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gray-500); font-weight: 600; margin-bottom: 4px; }
.filter-bar .form-control, .filter-bar .form-select { font-size: 13px; padding: 8px 12px; }

/* ---- CHART CONTAINERS ---- */
.chart-container { position: relative; padding: 16px; }
.chart-container canvas { max-height: 350px; }

/* ---- ANIMATIONS ---- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }

.animate-fadeInUp { animation: fadeInUp 0.5s ease forwards; }
.animate-fadeIn { animation: fadeIn 0.4s ease forwards; }
.animate-slideIn { animation: slideInLeft 0.4s ease forwards; }

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }

/* ---- DATATABLE OVERRIDES ---- */
.dataTables_wrapper .dataTables_length select { border-radius: 6px; padding: 4px 8px; font-size: 13px; }
.dataTables_wrapper .dataTables_filter input { border-radius: 8px; padding: 6px 12px; font-size: 13px; border: 1.5px solid var(--gray-300); }
.dataTables_wrapper .dataTables_filter input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(0,188,212,0.15); }
.dataTables_wrapper .dataTables_info { font-size: 12.5px; color: var(--gray-600); }
.dataTables_wrapper .dataTables_paginate .paginate_button { border-radius: 6px !important; margin: 0 2px; font-size: 13px; }
.dataTables_wrapper .dataTables_paginate .paginate_button.current { background: var(--primary) !important; color: white !important; border-color: var(--primary) !important; }

/* ---- LOGIN PAGE ---- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    background: var(--gradient-dark);
}
.login-left {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    background: var(--gradient-primary);
    position: relative; overflow: hidden;
    padding: 40px;
}
.login-left::before {
    content: ''; position: absolute; width: 400px; height: 400px;
    border-radius: 50%; background: rgba(0,188,212,0.1);
    top: -100px; right: -100px;
}
.login-left::after {
    content: ''; position: absolute; width: 300px; height: 300px;
    border-radius: 50%; background: rgba(0,188,212,0.08);
    bottom: -80px; left: -80px;
}
.login-left h2 { color: white; font-family: 'Outfit'; font-size: 28px; margin-bottom: 12px; text-align: center; z-index: 1; position: relative; }
.login-left p { color: rgba(255,255,255,0.7); font-size: 14px; text-align: center; z-index: 1; position: relative; max-width: 360px; }
.login-left .login-features { z-index: 1; position: relative; margin-top: 30px; }
.login-left .login-features li {
    color: rgba(255,255,255,0.8); font-size: 13px; padding: 8px 0;
    display: flex; align-items: center; gap: 10px;
}
.login-left .login-features li i { color: var(--accent); font-size: 16px; }

.login-right {
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 40px; background: var(--lighter);
}
.login-card {
    width: 100%; max-width: 420px;
    background: white; border-radius: 16px;
    padding: 40px; box-shadow: var(--shadow-xl);
}
.login-card h3 { font-family: 'Outfit'; font-size: 22px; margin-bottom: 8px; color: var(--dark); }
.login-card .subtitle { font-size: 13.5px; color: var(--gray-600); margin-bottom: 28px; }
.login-card .form-group { margin-bottom: 20px; }
.login-card .input-group .input-group-text { background: var(--gray-100); border-color: var(--gray-300); color: var(--gray-500); border-radius: 8px 0 0 8px; }
.login-card .btn-login {
    width: 100%; padding: 12px;
    background: var(--gradient-primary); border: none; color: white;
    font-weight: 600; font-size: 15px; border-radius: 10px;
    transition: var(--transition);
}
.login-card .btn-login:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(26,35,126,0.4); }

/* ---- RESPONSIVE ---- */
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .login-left { display: none; }
}

@media (max-width: 768px) {
    .page-content { padding: 16px; }
    .kpi-card .kpi-value { font-size: 24px; }
    .filter-bar { flex-direction: column; }
    .page-header { flex-direction: column; align-items: flex-start; }
}

/* ---- OVERLAY FOR MOBILE SIDEBAR ---- */
.sidebar-overlay {
    display: none; position: fixed; top: 0; left: 0;
    width: 100%; height: 100%; background: rgba(0,0,0,0.5);
    z-index: 1045; backdrop-filter: blur(4px);
}
.sidebar-overlay.show { display: block; }

/* ---- DETAIL VIEW ---- */
.detail-card { border-radius: var(--border-radius); overflow: hidden; }
.detail-header {
    background: var(--gradient-primary); color: white; padding: 24px;
    position: relative; overflow: hidden;
}
.detail-header::before {
    content: ''; position: absolute; top: -50px; right: -50px;
    width: 150px; height: 150px; border-radius: 50%;
    background: rgba(255,255,255,0.08);
}
.detail-header h3 { font-family: 'Outfit'; font-weight: 700; margin: 0 0 4px; }
.detail-header .detail-code { font-size: 14px; opacity: 0.8; }
.detail-body { padding: 24px; }
.detail-row { display: flex; padding: 10px 0; border-bottom: 1px solid var(--gray-100); }
.detail-label { width: 180px; font-weight: 600; font-size: 13px; color: var(--gray-600); flex-shrink: 0; }
.detail-value { font-size: 14px; color: var(--dark); }

/* ---- EMPTY STATE ---- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--gray-500); }
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h5 { color: var(--gray-600); font-size: 18px; margin-bottom: 8px; }
.empty-state p { font-size: 14px; }
