/* 
 * CSS - Sistema de Consulta de Estado Curricular
 * IES N° 6036
 */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --secondary: #0f172a;
    --background: #f8fafc;
    --surface: #ffffff;
    --surface-border: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    
    /* Estados Curriculares Color Tokens */
    --status-aprobado-bg: #dcfce7;
    --status-aprobado-text: #15803d;
    --status-aprobado-border: #86efac;

    --status-regular-bg: #fef9c3;
    --status-regular-text: #a16207;
    --status-regular-border: #fde047;

    --status-libre-bg: #fee2e2;
    --status-libre-text: #b91c1c;
    --status-libre-border: #fca5a5;

    --status-cursando-bg: #e0f2fe;
    --status-cursando-text: #0369a1;
    --status-cursando-border: #7dd3fc;
    
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 20px 30px rgba(0, 0, 0, 0.12);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
}

/* Header & Navbar */
.app-header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: white;
    padding: 24px 32px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-logo {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.brand-text h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.brand-text p {
    font-size: 13px;
    color: #94a3b8;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.08);
    padding: 4px 6px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.nav-link, .nav-btn {
    background: transparent;
    border: none;
    color: #e2e8f0;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.nav-link:hover, .nav-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.nav-link.active {
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 6px 14px;
    border-radius: 12px;
}

.user-avatar-circle {
    font-size: 20px;
    background: rgba(255, 255, 255, 0.15);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-info-text {
    display: flex;
    flex-direction: column;
}

.user-name-title {
    font-size: 13px;
    font-weight: 600;
    color: #f8fafc;
    line-height: 1.2;
}

.user-dni-sub {
    font-size: 11px;
    color: #94a3b8;
}

.btn-logout {
    background: #ef4444;
    color: white;
    border: none;
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.btn-header {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-header:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* Modal de Gestión de Perfil - Cambiar Clave Web */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-dialog {
    background: #ffffff;
    border-radius: 18px;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    animation: slideUp 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    color: white;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-secondary {
    background: #e2e8f0;
    color: #334155;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: #cbd5e1;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Main Layout */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* Search Bar Section */
.search-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--surface-border);
    margin-bottom: 32px;
}

.search-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-box {
    position: relative;
    display: flex;
    gap: 12px;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
}

.search-input {
    width: 100%;
    padding: 14px 20px 14px 48px;
    font-size: 16px;
    border: 2px solid var(--surface-border);
    border-radius: var(--radius-md);
    outline: none;
    transition: all 0.2s ease;
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: var(--text-muted);
}

.btn-search {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0 28px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-search:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Dropdown de Autocompletado */
.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--surface-border);
    margin-top: 6px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.autocomplete-item {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.15s ease;
}

.autocomplete-item:hover {
    background: var(--primary-light);
}

.autocomplete-item strong {
    color: var(--secondary);
}

.autocomplete-item span {
    font-size: 13px;
    color: var(--text-muted);
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
}

/* Profile Card */
.student-profile-card {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 32px;
    box-shadow: var(--shadow-md);
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 24px;
    align-items: center;
}

.avatar {
    width: 72px;
    height: 72px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}

.student-info h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
}

.student-meta {
    display: flex;
    gap: 20px;
    color: #cbd5e1;
    font-size: 14px;
    flex-wrap: wrap;
}

.student-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--surface-border);
    display: flex;
    align-items: center;
    gap: 16px;
}

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

.stat-icon.total { background: #e0f2fe; color: #0284c7; }
.stat-icon.aprobado { background: #dcfce7; color: #16a34a; }
.stat-icon.regular { background: #fef9c3; color: #ca8a04; }
.stat-icon.libre { background: #fee2e2; color: #dc2626; }

.stat-details h4 {
    font-size: 24px;
    font-weight: 700;
    color: var(--secondary);
}

.stat-details p {
    font-size: 13px;
    color: var(--text-muted);
}

/* Filters & Table Section */
.content-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--surface-border);
    overflow: hidden;
}

.card-header-bar {
    padding: 20px 28px;
    border-bottom: 1px solid var(--surface-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--secondary);
}

.filter-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-select, .filter-search {
    padding: 8px 14px;
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: white;
    outline: none;
}

.filter-select:focus, .filter-search:focus {
    border-color: var(--primary);
}

.btn-print {
    background: #0f172a;
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s ease;
}

.btn-print:hover {
    background: #334155;
}

/* Table Styles */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

.data-table th {
    background: #f8fafc;
    padding: 14px 20px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--surface-border);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.05em;
}

.data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-main);
}

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

/* Badges de Estado */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.status-aprobado, .status-1, .status-aprobada {
    background: var(--status-aprobado-bg);
    color: var(--status-aprobado-text);
    border: 1px solid var(--status-aprobado-border);
}

.status-regular, .status-2 {
    background: var(--status-regular-bg);
    color: var(--status-regular-text);
    border: 1px solid var(--status-regular-border);
}

.status-libre, .status-3 {
    background: var(--status-libre-bg);
    color: var(--status-libre-text);
    border: 1px solid var(--status-libre-border);
}

.status-cursando, .status-4, .status-inscrito {
    background: var(--status-cursando-bg);
    color: var(--status-cursando-text);
    border: 1px solid var(--status-cursando-border);
}

/* Empty State & Loader */
.empty-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.loader {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    animation: spin 0.8s linear infinite;
    margin: 40px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Footer de Tabla con Promedio General */
.card-footer-bar {
    padding: 18px 28px;
    background: #f8fafc;
    border-top: 2px solid var(--surface-border);
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.promedio-box {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    color: var(--secondary);
}

.promedio-box strong {
    font-size: 18px;
    color: var(--primary);
    background: var(--primary-light);
    padding: 2px 10px;
    border-radius: 6px;
    border: 1px solid #bfdbfe;
}

/* Estilos de Impresión */
@media print {
    body {
        background: white;
        color: black;
    }
    .app-header, .search-card, .filter-bar, .btn-print, .header-actions {
        display: none !important;
    }
    .container {
        max-width: 100%;
        padding: 0;
    }
    .student-profile-card {
        background: white !important;
        color: black !important;
        border: 1px solid #ccc;
        box-shadow: none;
    }
    .student-info h2 { color: black; }
    .content-card {
        box-shadow: none;
        border: none;
    }
}
