/* Sistema de Notas Escolares v4.4 - MINEDU Perú - Estilos Completos y Corregidos */

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

#loginPage {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    width: 95%;
    max-width: 1400px;
    min-height: 90vh;
    overflow: hidden;
    animation: fadeInUp 0.6s ease-out;
    margin: 2.5vh auto;
    display: flex;
    flex-direction: column;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ENCABEZADO ANIMADO CON EFECTO ROJO */
.header {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 50%, #991b1b 100%);
    background-size: 400% 400%;
    animation: gradientShift 4s ease-in-out infinite;
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: shimmer 3s infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.header h1 { 
    font-size: 2em; 
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header p { 
    font-size: 1em; 
    opacity: 0.95;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.login-form {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 40px;
    text-align: center;
    width: 100%;
    max-width: 450px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.credits {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
}

.credits a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.credits a:hover {
    text-decoration: underline;
}

.logo {
    height: 80px;
    max-width: 250px;
    margin-bottom: 20px;
    object-fit: contain;
}

.main-content { 
    padding: 30px; 
    flex-grow: 1; 
}

footer#appFooter {
    text-align: center;
    padding: 15px;
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
    color: #6c757d;
}

footer#appFooter a { 
    color: #667eea; 
    text-decoration: none; 
    font-weight: 600; 
}

footer#appFooter a:hover { 
    text-decoration: underline; 
}

.nav-tabs { 
    display: flex; 
    gap: 8px; 
    margin-bottom: 30px; 
    border-bottom: 2px solid #e0e0e0; 
}

.nav-tab {
    padding: 12px 20px;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    cursor: pointer;
    border-radius: 10px 10px 0 0;
    font-weight: 600;
    transition: all 0.3s ease;
}

.nav-tab.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: #667eea;
}

.nav-tab:hover:not(.active) {
    background: #e9ecef;
}

.tab-content { 
    display: none; 
}

.tab-content.active { 
    display: block; 
}

.admin-tabs { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 8px; 
    margin: 30px 0 25px 0; 
    padding: 20px; 
    background: #f8f9fa; 
    border-radius: 15px; 
}

.admin-tab { 
    padding: 14px 20px; 
    background: white; 
    border: 2px solid #e9ecef; 
    cursor: pointer; 
    border-radius: 12px; 
    font-weight: 600; 
    transition: all 0.3s ease;
}

.admin-tab.active { 
    background: linear-gradient(135deg, #667eea, #764ba2); 
    color: white; 
    border-color: #667eea; 
}

.admin-tab:hover:not(.active) {
    background: #f1f3f4;
}

.admin-tab-content { 
    display: none; 
}

.admin-tab-content.active { 
    display: block; 
}

.form-group { 
    margin-bottom: 20px; 
    text-align: left; 
}

.form-group label { 
    display: block; 
    margin-bottom: 8px; 
    font-weight: 600; 
    color: #2c3e50;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus { 
    border-color: #667eea; 
    outline: none; 
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn { 
    padding: 12px 25px; 
    border: none; 
    border-radius: 10px; 
    cursor: pointer; 
    font-size: 16px; 
    font-weight: 600; 
    margin: 5px; 
    color: white; 
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-primary { 
    background: linear-gradient(135deg, #667eea, #764ba2); 
}

.btn-success { 
    background: linear-gradient(135deg, #48bb78, #38a169); 
}

.btn-danger { 
    background: linear-gradient(135deg, #f56565, #e53e3e); 
}

.btn-warning { 
    background: linear-gradient(135deg, #ed8936, #dd6b20); 
}

.btn-info { 
    background: linear-gradient(135deg, #4299e1, #3182ce); 
}

.btn-secondary { 
    background: linear-gradient(135deg, #a0aec0, #718096); 
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-top: 20px; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.08); 
    border-radius: 10px;
    overflow: hidden;
}

.table th, .table td { 
    padding: 15px 12px; 
    text-align: left; 
    border-bottom: 1px solid #f0f0f0; 
}

.table th { 
    background: #f8f9fa; 
    font-weight: 600; 
    color: #2c3e50;
}

.table tr:hover { 
    background-color: #f8f9fa; 
}

.table tr:last-child td {
    border-bottom: none;
}

.card { 
    background: white; 
    border-radius: 15px; 
    box-shadow: 0 8px 25px rgba(0,0,0,0.1); 
    padding: 30px; 
    margin-bottom: 25px; 
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
}

.card h3 { 
    color: #2d3748; 
    margin-bottom: 25px; 
    border-bottom: 3px solid #667eea; 
    padding-bottom: 15px; 
}

.card h4 {
    color: #4a5568;
    margin-bottom: 15px;
}

.card h5 {
    color: #667eea;
    margin-bottom: 10px;
}

/* ======================= DASHBOARD MODERNO - STATS CARDS ======================= */

.grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); 
    gap: 20px; 
    margin-bottom: 30px; 
}

.stats-card { 
    background: white;
    color: #2d3748;
    padding: 25px 20px;
    border-radius: 16px;
    text-align: left;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
    position: relative;
    overflow: hidden;
}

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--card-color, #667eea);
}

.stats-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.stats-card.students {
    --card-color: #4299e1;
}

.stats-card.teachers {
    --card-color: #48bb78;
}

.stats-card.classrooms {
    --card-color: #ed8936;
}

.stats-card.grades {
    --card-color: #9f7aea;
}

.stats-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 24px;
    color: white;
    background: var(--card-color, #667eea);
}

.stats-number {
    font-size: 2.2em;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 8px;
    line-height: 1;
}

.stats-label {
    font-size: 14px;
    color: #718096;
    font-weight: 500;
    margin-bottom: 12px;
}

.stats-trend {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #38a169;
    font-weight: 600;
}

.stats-trend.neutral {
    color: #718096;
}

.stats-trend-icon {
    font-size: 14px;
}

/* Responsive para móviles */
@media (max-width: 768px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .stats-card {
        padding: 20px 15px;
    }
    
    .stats-number {
        font-size: 1.8em;
    }
    
    .stats-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

.user-info { 
    display: flex; 
    align-items: center; 
    gap: 15px; 
}

.logout-btn { 
    background: #f56565; 
    color: white; 
    border: none; 
    padding: 8px 15px; 
    border-radius: 20px; 
    cursor: pointer; 
    font-weight: 600; 
    transition: background 0.3s ease;
}

.logout-btn:hover {
    background: #e53e3e;
}

.modal { 
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.6); 
    backdrop-filter: blur(5px); 
}

.modal-content { 
    background-color: white; 
    margin: 3% auto; 
    padding: 30px; 
    border-radius: 20px; 
    width: 95%; 
    max-width: 800px; 
    max-height: 85vh; 
    overflow-y: auto; 
    position: relative; 
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-50px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-content.report-modal { 
    max-width: 900px; 
}

.modal-content.grading-modal {
    max-width: 1000px;
}

.modal-content.student-details-modal {
    max-width: 1100px;
}

.close { 
    color: #aaa; 
    position: absolute; 
    top: 15px; 
    right: 20px; 
    font-size: 28px; 
    font-weight: bold; 
    cursor: pointer; 
    transition: color 0.3s ease;
}

.close:hover {
    color: #667eea;
}

.coordinator-controls, .report-controls, .tutor-reports, .grading-controls, .tutor-controls, .student-controls { 
    display: flex; 
    gap: 15px; 
    flex-wrap: wrap; 
    padding: 20px; 
    background: #f8f9fa; 
    border-radius: 12px; 
    align-items: flex-end; 
}

.report-buttons { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 10px; 
}

/* Estilos para datos de estudiante */
.student-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 20px;
}

.student-info-grid div {
    padding: 10px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.area-header {
    background: #667eea !important;
    color: white !important;
    font-weight: bold;
}

/* Estilos de importación */
.import-instructions {
    background: #e3f2fd;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #2196f3;
}

.import-instructions p {
    margin: 5px 0;
    color: #1565c0;
}

/* Teacher Assignment Styles */
.teacher-assignments {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.assignment-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.assignment-card h5 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.assignment-block { 
    border: 2px solid #e9ecef; 
    border-radius: 12px; 
    padding: 20px; 
    margin-bottom: 20px; 
    background: #f9f9f9; 
    transition: border-color 0.3s ease;
}

.assignment-block:hover {
    border-color: #667eea;
}

.assignment-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 15px; 
}

.assignment-header strong { 
    color: #667eea; 
    font-size: 16px;
}

.assignment-courses label { 
    display: block; 
    font-weight: normal; 
    margin-bottom: 8px; 
    padding: 5px;
    transition: background 0.3s ease;
}

.assignment-courses label:hover {
    background: #e9ecef;
    border-radius: 5px;
}

.assignment-courses input[type="checkbox"] {
    margin-right: 8px;
}

/* Grade Input Styles */
.grade-input, .teacher-grade-input, .tutor-grade-input {
    width: 80px !important;
    padding: 8px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
}

.grade-input:focus, .teacher-grade-input:focus, .tutor-grade-input:focus {
    border-color: #667eea;
    outline: none;
}

.conduct-input, .tutor-conduct-input {
    width: 120px;
    padding: 8px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
}

.conduct-input:focus, .tutor-conduct-input:focus {
    border-color: #667eea;
    outline: none;
}

/* Report Styles - MEJORADOS PARA LOGOS */
.report-logo { 
    width: 80px; 
    height: 80px; 
    margin-right: 20px; 
    object-fit: contain; 
    border-radius: 8px;
    background: white;
    padding: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.report-logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
}

.report-header { 
    display: flex; 
    align-items: center; 
    text-align: left; 
    margin-bottom: 20px; 
    border-bottom: 4px solid #dc3545; 
    padding-bottom: 15px; 
}

.report-header-text h2 { 
    margin: 0; 
    font-size: 20px; 
    color: #333; 
}

.report-header-text h3 { 
    margin: 5px 0 0 0; 
    font-size: 16px; 
    color: #c82333; 
}

.report-student-info-compact { 
    margin-top: 15px; 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
    gap: 10px; 
    font-size: 12px; 
    background-color: #f8f9fa; 
    padding: 12px; 
    border-radius: 8px; 
    margin-bottom: 15px;
}

.report-student-info { 
    margin-top: 20px; 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 10px; 
    font-size: 12px; 
    background-color: #f8f9fa; 
    padding: 15px; 
    border-radius: 8px; 
}

.report-table { 
    width: 100%; 
    border-collapse: collapse; 
    font-size: 10px; 
    margin: 15px 0; 
}

.report-table th, .report-table td { 
    border: 1px solid #ccc; 
    padding: 6px; 
    text-align: center; 
}

.report-table th { 
    background-color: #f2f2f2; 
    font-weight: bold; 
}

.report-table .area-header { 
    background: linear-gradient(135deg, #dc3545, #c82333); 
    color: white !important; 
    font-weight: bold; 
    text-align: left; 
    padding-left: 10px; 
    font-size: 11px; 
    -webkit-print-color-adjust: exact; 
    print-color-adjust: exact; 
}

.report-table .subject-name { 
    text-align: left; 
    padding-left: 15px; 
}

.report-table .area-average {
    background-color: #e8f4fd;
    font-weight: bold;
    color: #1565c0;
}

/* Loading Spinner */
.loading-spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    text-align: center;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        width: 100%;
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
    }
    
    .header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .grid {
        grid-template-columns: 1fr;
    }
    
    .admin-tabs {
        justify-content: center;
    }
    
    .admin-tab {
        flex: 1;
        min-width: 120px;
    }
    
    .coordinator-controls, .report-controls, .tutor-reports, .grading-controls, .tutor-controls, .student-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .teacher-assignments {
        grid-template-columns: 1fr;
    }
    
    .report-student-info, .report-student-info-compact {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 98%;
        margin: 1% auto;
        padding: 20px;
    }
    
    .table {
        font-size: 12px;
    }
    
    .table th, .table td {
        padding: 8px 6px;
    }
    
    .student-info-grid {
        grid-template-columns: 1fr;
    }
    
    .report-header {
        flex-direction: column;
        text-align: center;
    }
    
    .report-logo {
        margin-right: 0;
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .login-form {
        padding: 20px;
        max-width: 350px;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .card {
        padding: 20px;
    }
    
    .stats-card h2 {
        font-size: 2.2em;
    }
    
    .btn {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .admin-tab {
        padding: 10px 12px;
        font-size: 12px;
    }
    
    .nav-tab {
        padding: 8px 12px;
        font-size: 14px;
    }
}

/* Print Styles */
@media print {
    body { 
        background: #fff; 
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .container { 
        box-shadow: none; 
        margin: 0; 
        min-height: 0; 
        border-radius: 0; 
    }
    
    .modal { 
        position: static; 
        background-color: transparent; 
    }
    
    .modal-content { 
        box-shadow: none; 
        margin: 0; 
        max-height: none; 
        border-radius: 0; 
        padding: 0; 
        border: none; 
    }
    
    .no-print { 
        display: none !important; 
    }
    
    .report-table .area-header {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        background: #dc3545 !important;
        color: white !important;
    }
    
    .report-header {
        border-bottom: 4px solid #dc3545 !important;
    }
    
    .page-break {
        page-break-before: always;
    }
    
    .report-logo {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Tooltip Styles */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Success/Error States */
.success-state {
    border-color: #48bb78 !important;
    background-color: #f0fff4;
}

.error-state {
    border-color: #f56565 !important;
    background-color: #fff5f5;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #5a67d8;
}

/* Focus States */
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

/* Button Loading State */
.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a202c;
        --text-color: #e2e8f0;
        --card-bg: #2d3748;
        --border-color: #4a5568;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
    
    .card {
        border: 2px solid #333;
    }
    
    .table th,
    .table td {
        border: 1px solid #333;
    }
}/* ======================= CSS ADICIONAL PARA REPORTES A4 ======================= */

/* Mejoras para reportes en A4 */
.report-header {
    display: flex;
    align-items: center;
    text-align: left;
    margin-bottom: 15px;
    border-bottom: 4px solid #dc3545;
    padding-bottom: 10px;
    page-break-inside: avoid;
}

.report-logo {
    width: 60px;
    height: 60px;
    margin-right: 15px;
    object-fit: contain;
    border-radius: 6px;
    background: white;
    padding: 3px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.report-logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
}

.report-header-text h2 {
    margin: 0;
    font-size: 18px;
    color: #333;
    line-height: 1.2;
}

.report-header-text h3 {
    margin: 3px 0 0 0;
    font-size: 14px;
    color: #c82333;
    line-height: 1.2;
}

.report-student-info-compact {
    margin: 10px 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    font-size: 11px;
    background-color: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
    page-break-inside: avoid;
}

.report-student-info {
    margin: 15px 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 11px;
    background-color: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    page-break-inside: avoid;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 8px;
    margin: 10px 0;
    page-break-inside: auto;
}

.report-table th,
.report-table td {
    border: 1px solid #ccc;
    padding: 4px;
    text-align: center;
    line-height: 1.2;
}

.report-table th {
    background-color: #f2f2f2;
    font-weight: bold;
    font-size: 8px;
}

.report-table .area-header {
    background: linear-gradient(135deg, #dc3545, #c82333) !important;
    color: white !important;
    font-weight: bold;
    text-align: left;
    padding-left: 8px;
    font-size: 9px;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.report-table .subject-name {
    text-align: left;
    padding-left: 12px;
    font-size: 8px;
}

.report-table .area-average {
    background-color: #e8f4fd !important;
    font-weight: bold;
    color: #1565c0 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

/* Optimización para impresión A4 */
@media print {
    @page {
        size: A4;
        margin: 1cm;
    }
    
    body {
        background: #fff;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        font-size: 10px;
    }
    
    .report-header {
        border-bottom: 4px solid #dc3545 !important;
        margin-bottom: 10px;
    }
    
    .report-table {
        font-size: 7px;
    }
    
    .report-table th,
    .report-table td {
        padding: 2px;
    }
    
    .report-table .area-header {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        background: #dc3545 !important;
        color: white !important;
    }
    
    .report-table .area-average {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        background-color: #e8f4fd !important;
        color: #1565c0 !important;
    }
    
    .report-logo {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        width: 50px;
        height: 50px;
    }
    
    .no-print {
        display: none !important;
    }
    
    .page-break {
        page-break-before: always;
    }
}

/* Estilos para consolidado agrupado */
.report-table thead th[colspan] {
    background-color: #6c757d !important;
    color: white !important;
    font-weight: bold;
    text-align: center;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

/* Responsive para reportes */
@media (max-width: 768px) {
    .report-header {
        flex-direction: column;
        text-align: center;
    }
    
    .report-logo {
        margin-right: 0;
        margin-bottom: 8px;
    }
    
    .report-student-info,
    .report-student-info-compact {
        grid-template-columns: 1fr;
    }
    
    .report-table {
        font-size: 10px;
    }
}

/* ======================= CSS ADICIONAL PARA REPORTES A4 MEJORADOS ======================= */
/* AGREGAR AL FINAL DEL ARCHIVO styles.css */

/* Configuración específica para reportes A4 */
@media print {
    @page {
        size: A4;
        margin: 1cm;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    /* Para consolidados - orientación horizontal */
    @page.landscape {
        size: A4 landscape;
        margin: 0.5cm;
    }
    
    .report-modal {
        page: landscape;
    }
    
    body {
        background: white !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        margin: 0;
        padding: 0;
    }
    
    /* Header optimizado para A4 */
    .report-header {
        display: flex !important;
        align-items: center !important;
        margin-bottom: 10px !important;
        border-bottom: 3px solid #dc3545 !important;
        padding-bottom: 8px !important;
        page-break-inside: avoid !important;
        height: auto !important;
    }
    
    /* Logo optimizado - sin recorte */
    .report-logo {
        width: 50px !important;
        height: 50px !important;
        margin-right: 12px !important;
        object-fit: contain !important;
        object-position: center !important;
        background: white !important;
        padding: 2px !important;
        border: 1px solid #ddd !important;
        border-radius: 4px !important;
        flex-shrink: 0 !important;
    }
    
    .report-logo-container {
        min-width: 60px !important;
        max-width: 60px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .report-header-text {
        flex: 1 !important;
    }
    
    .report-header-text h2 {
        margin: 0 !important;
        font-size: 16px !important;
        color: #333 !important;
        line-height: 1.2 !important;
    }
    
    .report-header-text h3 {
        margin: 2px 0 0 0 !important;
        font-size: 12px !important;
        color: #c82333 !important;
        line-height: 1.2 !important;
    }
    
    /* Info del estudiante/aula */
    .report-student-info,
    .report-student-info-compact {
        display: grid !important;
        grid-template-columns: 1fr 1fr 1fr !important;
        gap: 8px !important;
        background: #f8f9fa !important;
        padding: 8px !important;
        margin: 8px 0 !important;
        border-radius: 4px !important;
        font-size: 10px !important;
        page-break-inside: avoid !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    /* Tabla de reporte */
    .report-table {
        width: 100% !important;
        border-collapse: collapse !important;
        font-size: 8px !important;
        margin: 8px 0 !important;
        page-break-inside: auto !important;
    }
    
    .report-table th,
    .report-table td {
        border: 1px solid #333 !important;
        padding: 3px !important;
        text-align: center !important;
        line-height: 1.1 !important;
        vertical-align: middle !important;
    }
    
    .report-table th {
        background: #f2f2f2 !important;
        font-weight: bold !important;
        font-size: 8px !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .report-table .area-header {
        background: #dc3545 !important;
        color: white !important;
        font-weight: bold !important;
        text-align: left !important;
        padding-left: 6px !important;
        font-size: 8px !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    .report-table .subject-name {
        text-align: left !important;
        padding-left: 8px !important;
        font-size: 7px !important;
    }
    
    .report-table .area-average {
        background: #e8f4fd !important;
        font-weight: bold !important;
        color: #1565c0 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    /* Para consolidados con muchas columnas */
    .report-table thead th[colspan] {
        background: #6c757d !important;
        color: white !important;
        font-weight: bold !important;
        text-align: center !important;
        font-size: 7px !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    /* Ocultar elementos no imprimibles */
    .no-print,
    .modal-footer,
    .btn,
    button {
        display: none !important;
    }
    
    /* Optimización para nombres largos */
    .report-table td:nth-child(2) {
        max-width: 120px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }
}

/* Estilos específicos para reportes individuales (retrato) */
.modal-content.report-modal .report-table {
    font-size: 9px;
}

.modal-content.report-modal .report-table th,
.modal-content.report-modal .report-table td {
    padding: 4px;
}

/* Estilos específicos para consolidados (paisaje) */
.modal-content.grading-modal .report-table,
.modal-content.student-details-modal .report-table {
    font-size: 8px;
}

.modal-content.grading-modal .report-table th,
.modal-content.grading-modal .report-table td,
.modal-content.student-details-modal .report-table th,
.modal-content.student-details-modal .report-table td {
    padding: 2px;
}

/* Responsive para tablets */
@media (max-width: 1024px) {
    .report-header {
        flex-direction: column;
        text-align: center;
    }
    
    .report-logo {
        margin-right: 0;
        margin-bottom: 8px;
    }
    
    .report-student-info,
    .report-student-info-compact {
        grid-template-columns: 1fr;
    }
}

/* Responsive para móviles */
@media (max-width: 768px) {
    .modal-content.report-modal,
    .modal-content.grading-modal {
        padding: 15px;
        margin: 1%;
    }
    
    .report-table {
        font-size: 10px;
    }
    
    .report-table th,
    .report-table td {
        padding: 3px;
    }
}

/* ======================= ESTILOS PARA AÑOS ACADÉMICOS ======================= */
.year-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    align-items: flex-end;
}

.academic-year-card {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.academic-year-card.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.year-info h4 {
    margin: 0;
    font-size: 1.2em;
}

.year-info p {
    margin: 5px 0 0 0;
    opacity: 0.9;
}

/* ======================= ESTILOS PARA CRITERIOS DE CONDUCTA ======================= */
.tutor-conduct-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    align-items: flex-end;
}

.conduct-criteria-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.conduct-criteria-table th,
.conduct-criteria-table td {
    border: 1px solid #dee2e6;
    padding: 10px;
    text-align: center;
}

.conduct-criteria-table th {
    background: #f8f9fa;
    font-weight: 600;
}

.conduct-criteria-input {
    width: 100px;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-align: center;
}

/* ======================= MODALES MÁS GRANDES ======================= */
.modal-content.large-modal {
    max-width: 1200px;
    width: 95%;
}

.modal-content.extra-large-modal {
    max-width: 1400px;
    width: 98%;
}

/* ======================= ORIENTACIÓN DE IMPRESIÓN ======================= */
.print-orientation-controls {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
}

.print-orientation-controls label {
    margin: 0 15px;
    font-weight: normal;
}

/* Estilos específicos para impresión horizontal */
@media print {
    @page.landscape {
        size: A4 landscape;
        margin: 1cm;
    }
    
    .print-landscape {
        page: landscape;
    }
    
    .print-landscape .report-table {
        font-size: 6px;
    }
    
    .print-landscape .report-table th,
    .print-landscape .report-table td {
        padding: 1px;
    }
}

/* ======================= CSS ESPECÍFICO PARA TABLA DE CONDUCTA - BORDES DELGADOS ======================= */

.conduct-report-section {
    margin-top: 20px !important;
    page-break-inside: avoid !important;
}

.conduct-report-section h4 {
    margin-bottom: 15px !important;
    color: #333 !important;
    font-size: 14px !important;
    font-weight: bold !important;
}

.conduct-report-table {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    font-size: 10px !important;
    margin: 10px 0 !important;
    border: 0.5px solid #000 !important;
}

.conduct-report-table thead {
    display: table-header-group !important;
}

.conduct-report-table tbody {
    display: table-row-group !important;
}

.conduct-report-table tr {
    display: table-row !important;
    border: 0.5px solid #000 !important;
}

.conduct-report-table th,
.conduct-report-table td {
    display: table-cell !important;
    border: 0.5px solid #000 !important;
    padding: 6px 4px !important;
    text-align: center !important;
    vertical-align: middle !important;
    line-height: 1.2 !important;
    background-color: transparent !important;
    border-style: solid !important;
    border-width: 1px !important;
    border-color: #000 !important;
}

.conduct-report-table th {
    background: #f2f2f2 !important;
    font-weight: bold !important;
    border: 0.5px solid #000 !important;
}

.conduct-criteria-header td {
    background: #6c757d !important;
    color: white !important;
    font-weight: bold !important;
    text-align: center !important;
    border: 0.5px solid #000 !important;
}

/* ESTILOS CRÍTICOS PARA IMPRESIÓN */
@media print {
    .conduct-report-section {
        margin-top: 15px !important;
        page-break-inside: avoid !important;
        display: block !important;
    }
    
    .conduct-report-table {
        width: 100% !important;
        border-collapse: separate !important;
        border-spacing: 0 !important;
        border: 0.5px solid #000 !important;
        font-size: 9px !important;
        margin: 10px 0 !important;
        display: table !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    .conduct-report-table thead {
        display: table-header-group !important;
    }
    
    .conduct-report-table tbody {
        display: table-row-group !important;
    }
    
    .conduct-report-table tr {
        display: table-row !important;
        border: 0.5px solid #000 !important;
        page-break-inside: avoid !important;
    }
    
    .conduct-report-table th,
    .conduct-report-table td {
        display: table-cell !important;
        border: 0.5px solid #000 !important;
        padding: 4px 3px !important;
        text-align: center !important;
        vertical-align: middle !important;
        background-color: transparent !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        border-style: solid !important;
        border-width: 1px !important;
        border-color: #000 !important;
        box-shadow: inset 0 0 0 1px #000 !important;
    }
    
    .conduct-report-table th {
        background: #f0f0f0 !important;
        font-weight: bold !important;
        border: 0.5px solid #000 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    .conduct-criteria-header td {
        background: #666 !important;
        color: white !important;
        font-weight: bold !important;
        border: 0.5px solid #000 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* OVERRIDE CUALQUIER ESTILO CONFLICTIVO */
#studentReportToPrint .conduct-report-table,
#tutorReportToPrint .conduct-report-table,
.modal-content .conduct-report-table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

#studentReportToPrint .conduct-report-table th,
#studentReportToPrint .conduct-report-table td,
#tutorReportToPrint .conduct-report-table th,
#tutorReportToPrint .conduct-report-table td,
.modal-content .conduct-report-table th,
.modal-content .conduct-report-table td {
    border: 0.5px solid #000 !important;
    border-style: solid !important;
    border-width: 1px !important;
    border-color: #000 !important;
}

/* ======================= ESTILOS PARA PORTAL DE PADRES ======================= */

.parent-portal-header {
    margin-bottom: 0;
}

.parent-portal-header .report-header {
    border-bottom: 4px solid #667eea;
    margin-bottom: 0;
}

.parent-portal-header .report-header h3 {
    color: #667eea;
    font-size: 16px;
}

/* Formulario de consulta */
#studentDNI {
    font-size: 18px;
    text-align: center;
    font-weight: bold;
    letter-spacing: 1px;
    border: 3px solid #667eea;
    padding: 15px;
    border-radius: 10px;
}

#studentDNI:focus {
    border-color: #5a67d8;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* Sección del reporte */
#studentReportSection {
    animation: slideInUp 0.6s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Gráficas */
#progressChart, #areasChart {
    max-height: 300px;
}

/* Información del estudiante destacada */
.student-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    margin: 20px 0;
    border: 2px solid #667eea;
}

.student-info-grid div {
    padding: 12px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Botones del portal */
.parent-portal-header a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.parent-portal-header a:hover {
    color: #5a67d8;
}

/* Mensaje de no encontrado */
.not-found-message {
    text-align: center;
    padding: 40px 20px;
    background: #fff5f5;
    border: 2px dashed #fc8181;
    border-radius: 12px;
    color: #c53030;
}

/* Responsive para portal de padres */
@media (max-width: 768px) {
    .parent-portal-header .report-header {
        flex-direction: column;
        text-align: center;
    }
    
    .student-info-grid {
        grid-template-columns: 1fr;
    }
    
    #studentReportSection {
        margin: 10px;
        padding: 20px;
    }
    
    #progressChart, #areasChart {
        max-height: 250px;
    }
}

/* Estilos para impresión del portal */
@media print {
    body {
        background: white !important;
    }
    
    .parent-portal-header,
    .no-print,
    button {
        display: none !important;
    }
    
    #studentReportSection {
        margin: 0;
        box-shadow: none;
    }
    
    .report-table {
        font-size: 10px;
    }
    
    .student-info-grid {
        background: #f8f9fa;
        border: 1px solid #dee2e6;
    }
}

/* Mensaje de éxito/error para portal */
.portal-alert {
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    font-weight: 600;
}

.portal-alert.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.portal-alert.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.portal-alert.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Loading específico para portal */
.portal-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(102, 126, 234, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.portal-loading .spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255, 255, 255, 0.3);
    border-top: 6px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Mejoras visuales para las gráficas */
.chart-container {
    position: relative;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.chart-container h5 {
    text-align: center;
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 16px;
}

/* Destacar promedio anual */
.annual-average {
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
    color: white !important;
    font-weight: bold !important;
}

/* Estilos para notas por color */
.grade-excellent { color: #28a745; font-weight: bold; } /* 18-20 */
.grade-good { color: #007bff; font-weight: bold; }      /* 15-17 */
.grade-regular { color: #ffc107; font-weight: bold; }   /* 11-14 */
.grade-poor { color: #dc3545; font-weight: bold; }      /* 0-10 */

/* ======================= ESTILOS RESPONSIVOS PARA PORTAL DE PADRES ======================= */

/* Mejoras generales para móviles */
@media (max-width: 768px) {
    /* Header responsive */
    .parent-portal-header .report-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .parent-portal-header .report-logo-container {
        min-width: auto;
        margin-bottom: 10px;
    }
    
    .parent-portal-header .report-logo {
        width: 50px;
        height: 50px;
    }
    
    .parent-portal-header .report-header-text h2 {
        font-size: 18px;
        line-height: 1.2;
    }
    
    .parent-portal-header .report-header-text h3 {
        font-size: 14px;
        line-height: 1.2;
    }
    
    /* Formulario de búsqueda responsive */
    #studentDNI {
        font-size: 16px; /* Evita zoom en iOS */
        padding: 12px;
    }
    
    .btn {
        width: 100%;
        padding: 12px;
        font-size: 16px;
        margin: 5px 0;
    }
    
    /* Información del estudiante responsive */
    .student-info-grid {
        grid-template-columns: 1fr !important;
        gap: 10px;
        padding: 15px;
    }
    
    .student-info-grid div {
        padding: 10px;
        font-size: 14px;
    }
    
    /* Gráficas responsive */
    .chart-container {
        margin-bottom: 15px;
        padding: 15px;
    }
    
    #progressChart, #areasChart {
        max-height: 250px !important;
    }
    
    /* Tabla de reporte responsive */
    .report-table {
        font-size: 11px;
        width: 100%;
        overflow-x: auto;
        display: block;
        white-space: nowrap;
    }
    
    .report-table thead,
    .report-table tbody,
    .report-table tr {
        display: table;
        width: 100%;
        table-layout: fixed;
    }
    
    .report-table th,
    .report-table td {
        padding: 6px 3px;
        font-size: 10px;
        word-wrap: break-word;
    }
    
    /* Área headers en móviles */
    .report-table .area-header {
        font-size: 11px;
        padding: 6px;
    }
    
    .report-table .subject-name {
        font-size: 10px;
        padding-left: 6px;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Botones de acción responsive */
    .parent-portal-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-top: 20px;
    }
    
    .parent-portal-actions .btn {
        width: 100%;
        margin: 0;
    }
}

/* Estilos específicos para móviles pequeños */
@media (max-width: 480px) {
    /* Contenedores principales */
    .container {
        margin: 5px !important;
        padding: 15px !important;
        border-radius: 10px !important;
    }
    
    /* Header más compacto */
    .parent-portal-header .report-header-text h2 {
        font-size: 16px;
    }
    
    .parent-portal-header .report-header-text h3 {
        font-size: 12px;
    }
    
    /* Formulario más compacto */
    .card {
        padding: 15px !important;
    }
    
    .card h3 {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    .form-group label {
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    #studentDNI {
        font-size: 16px;
        padding: 10px;
        letter-spacing: 2px;
    }
    
    /* Información del estudiante más compacta */
    .student-info-grid div {
        padding: 8px;
        font-size: 13px;
    }
    
    /* Gráficas más pequeñas */
    #progressChart, #areasChart {
        max-height: 200px !important;
    }
    
    /* Tabla responsive horizontal scroll */
    .report-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 10px -15px; /* Compensar padding del card */
        padding: 0 15px;
    }
    
    .report-table {
        min-width: 600px; /* Ancho mínimo para mantener legibilidad */
        font-size: 9px;
    }
    
    .report-table th,
    .report-table td {
        padding: 4px 2px;
        min-width: 40px;
    }
    
    .report-table .subject-name {
        min-width: 100px;
        max-width: 120px;
    }
    
    /* Botones apilados */
    .btn {
        font-size: 14px;
        padding: 10px;
    }
}

/* Landscape móviles */
@media (max-width: 768px) and (orientation: landscape) {
    .parent-portal-header .report-header {
        flex-direction: row;
    }
    
    .student-info-grid {
        grid-template-columns: 1fr 1fr !important;
    }
    
    #progressChart, #areasChart {
        max-height: 180px !important;
    }
}

/* Tablets */
@media (min-width: 769px) and (max-width: 1024px) {
    .student-info-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .report-table {
        font-size: 12px;
    }
    
    .report-table th,
    .report-table td {
        padding: 6px;
    }
    
    #progressChart, #areasChart {
        max-height: 280px;
    }
}

/* Mejoras para pantallas touch */
@media (hover: none) and (pointer: coarse) {
    /* Botones más grandes para touch */
    .btn {
        padding: 12px 20px;
        font-size: 16px;
        min-height: 44px; /* Tamaño mínimo recomendado para touch */
    }
    
    /* Inputs más grandes */
    input, select {
        min-height: 44px;
        font-size: 16px; /* Evita zoom en iOS */
    }
    
    /* Enlaces más grandes */
    a {
        padding: 8px;
        display: inline-block;
    }
}

/* Estilos específicos para iOS */
@supports (-webkit-touch-callout: none) {
    input {
        font-size: 16px; /* Prevenir zoom automático */
    }
    
    .btn {
        -webkit-appearance: none;
        border-radius: 10px;
    }
}

/* Dark mode support para el portal */
@media (prefers-color-scheme: dark) {
    .parent-portal-dark {
        background: #1a1a1a;
        color: #e0e0e0;
    }
    
    .parent-portal-dark .card {
        background: #2d2d2d;
        color: #e0e0e0;
    }
    
    .parent-portal-dark .report-table th {
        background: #3d3d3d;
        color: #e0e0e0;
    }
}

/* Mejoras de accesibilidad */
@media (prefers-reduced-motion: reduce) {
    #studentReportSection {
        animation: none;
    }
    
    .chart-container {
        animation: none;
    }
}

/* Print específico para móviles */
@media print {
    .report-table {
        font-size: 8px !important;
        min-width: auto !important;
    }
    
    .student-info-grid {
        grid-template-columns: 1fr 1fr !important;
    }
    
    .report-table th,
    .report-table td {
        padding: 2px !important;
    }
}


/* ======================= PANEL CONTABLE ======================= */

.contable-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 12px;
}

.contable-tab-content {
    display: none;
    animation: fadeIn 0.5s ease-in;
}

.contable-tab-content.active {
    display: block;
}

.payment-controls,
.debt-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 20px;
}

.payment-summary {
    background: linear-gradient(135deg, #667eea15, #764ba215);
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
    border-left: 4px solid #667eea;
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.stats-card.payments {
    --card-color: #28a745;
}

/* Responsive para panel contable */
@media (max-width: 768px) {
    .contable-tabs {
        flex-direction: column;
    }
    
    .payment-controls,
    .debt-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .payment-summary > div {
        grid-template-columns: 1fr;
    }
}

/* ======================= ESTADO DE CUENTA - PORTAL PADRES ======================= */

.payment-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.payment-card {
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.payment-card:hover {
    transform: translateY(-5px);
}

.payment-filters {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    flex-wrap: wrap;
}

.payment-filters label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 20px;
    transition: background 0.3s ease;
}

.payment-filters label:hover {
    background: #e9ecef;
}

.payment-filters input[type="radio"]:checked + {
    background: #667eea;
    color: white;
}

.table-danger {
    background-color: #f8d7da !important;
}

.table-danger td {
    color: #721c24;
}

/* Responsive para estado de cuenta */
@media (max-width: 768px) {
    .payment-summary-cards {
        grid-template-columns: 1fr 1fr;
    }
    
    .payment-card {
        padding: 15px;
    }
    
    .payment-card div:first-child {
        font-size: 20px !important;
    }
    
    #paymentDetailTable table {
        font-size: 11px !important;
    }
    
    #paymentDetailTable th,
    #paymentDetailTable td {
        padding: 4px !important;
        font-size: 10px !important;
    }
}

@media (max-width: 480px) {
    .payment-summary-cards {
        grid-template-columns: 1fr;
    }
    
    .payment-filters {
        flex-direction: column;
    }
}

/* Estilos de impresión para estado de cuenta */
@media print {
    #paymentStatusSection {
        padding: 20px !important;
    }
    
    .payment-card {
        break-inside: avoid;
    }
    
    .payment-filters,
    .parent-portal-actions,
    .btn {
        display: none !important;
    }
    
    .table-danger {
        background-color: #f8d7da !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* Agregar este CSS a tu archivo styles.css */

/* ======================= BOTONES DE TIPO DE CONSULTA ======================= */

.consultation-type-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 30px;
    border-radius: 20px;
    margin: 20px auto;
    max-width: 900px; /* Limitar ancho igual al header */
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.consultation-type-section h3 {
    color: white;
    text-align: center;
    margin-bottom: 25px;
    font-size: 24px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.consultation-buttons-container {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Dos columnas iguales */
    gap: 20px;
    margin-top: 20px;
    max-width: 600px; /* Más estrecho */
    margin-left: auto;
    margin-right: auto;
}

.consultation-btn {
    background: white;
    border: none;
    padding: 25px 20px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: inherit;
}

.consultation-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    transition: left 0.5s;
}

.consultation-btn:hover::before {
    left: 100%;
}

.consultation-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.consultation-btn.active {
    background: linear-gradient(135deg, #28a745, #20c997) !important; /* Verde diferente */
    color: white !important;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(40, 167, 69, 0.4);
    border: 3px solid #ffffff !important;
}

.consultation-btn-title {
    font-size: 20px; /* Más grande */
    font-weight: 700; /* Más negrita */
    margin-bottom: 8px;
    color: #333;
    transition: color 0.3s ease;
}

.consultation-btn.active .consultation-btn-title {
    color: white !important;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    font-size: 22px; /* Aún más grande cuando activo */
}

.consultation-btn-subtitle {
    font-size: 16px; /* Más grande */
    font-weight: 600; /* Más negrita */
    color: #666;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.consultation-btn.active .consultation-btn-subtitle {
    color: rgba(255,255,255,0.95) !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}


/* ======================= MEJORAS PARA FORMULARIO DNI ======================= */

.dni-form-section {
    display: none;
    max-width: 350px !important; /* Más estrecho */
    margin: 30px auto;
    padding: 25px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
    transition: all 0.3s ease;
}

.dni-form-section .form-group {
    text-align: center;
    margin-bottom: 20px;
}

.dni-form-section .form-group label {
    display: block;
    text-align: center;
    font-size: 16px;
    margin-bottom: 15px;
    color: #333;
    font-weight: 600;
}

.dni-form-section input {
    max-width: 200px !important; /* Más estrecho para 8 dígitos */
    margin: 0 auto !important;
    display: block !important;
    text-align: center !important;
    font-size: 18px !important;
    font-weight: bold !important;
    letter-spacing: 2px !important;
    border: 3px solid #667eea !important;
    padding: 15px !important;
    border-radius: 10px !important;
}

.dni-form-section button {
    margin: 0 auto !important;
    display: block !important;
    min-width: 200px !important;
    padding: 15px 25px !important;
    font-size: 16px !important;
}

/* Responsive para formulario DNI */
@media (max-width: 768px) {
    .dni-form-section {
        max-width: 320px !important;
        padding: 20px !important;
    }
    
    .dni-form-section input {
        max-width: 180px !important;
        font-size: 16px !important;
        padding: 12px !important;
    }
    
    .dni-form-section button {
        min-width: 180px !important;
        padding: 12px 20px !important;
        font-size: 14px !important;
    }
}

@media (max-width: 480px) {
    .dni-form-section {
        max-width: 300px !important;
        padding: 15px !important;
    }
    
    .dni-form-section input {
        max-width: 160px !important;
        font-size: 16px !important;
        padding: 10px !important;
        letter-spacing: 1px !important;
    }
}


/* Efectos especiales para cada botón */
.consultation-btn:nth-child(1) {
    background: linear-gradient(135deg, #fff 0%, #f8f9ff 100%);
}

.consultation-btn:nth-child(2) {
    background: linear-gradient(135deg, #fff 0%, #fff8f0 100%);
}

.consultation-btn:nth-child(1):hover {
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.25);
}

.consultation-btn:nth-child(2):hover {
    box-shadow: 0 10px 25px rgba(255, 193, 7, 0.25);
}

/* Responsive */
@media (max-width: 768px) {
    .consultation-type-section {
        padding: 20px;
        border-radius: 15px;
        margin: 15px 0;
    }
    
    .consultation-type-section h3 {
        font-size: 20px;
        margin-bottom: 20px;
    }
    
    .consultation-buttons-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .consultation-btn {
        padding: 20px 15px;
        min-height: 100px;
        border-radius: 12px;
    }
    
    .consultation-btn-icon {
        font-size: 28px;
        margin-bottom: 8px;
    }
    
    .consultation-btn-title {
        font-size: 16px;
        margin-bottom: 6px;
    }
    
    .consultation-btn-subtitle {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .consultation-type-section {
        padding: 15px;
        margin: 10px 0;
    }
    
    .consultation-btn {
        padding: 15px 10px;
        min-height: 90px;
    }
    
    .consultation-btn-icon {
        font-size: 24px;
        margin-bottom: 6px;
    }
    
    .consultation-btn-title {
        font-size: 14px;
        margin-bottom: 4px;
    }
    
    .consultation-btn-subtitle {
        font-size: 11px;
    }
}

/* Animación de carga */
@keyframes pulse-soft {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.consultation-btn.loading {
    animation: pulse-soft 1.5s infinite;
    pointer-events: none;
}

/* Indicador visual de selección */
.consultation-btn.active::after {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 15px;
    background: rgba(255,255,255,0.2);
    color: white;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

/* Ocultar formulario DNI hasta seleccionar tipo de consulta */
.dni-form-section {
    display: none;
    transition: all 0.3s ease;
}

.dni-form-section.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Centrar formulario DNI */
.dni-form-section {
    display: none;
    max-width: 400px; /* Más estrecho */
    margin: 30px auto;
    padding: 25px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
    transition: all 0.3s ease;
}

.dni-form-section input {
    max-width: 250px !important; /* Más estrecho */
    margin: 0 auto !important;
    display: block !important;
}

.dni-form-section.show {
    display: block;
    animation: slideDown 0.4s ease-out;
}

@keyframes slideDown {
    from { 
        opacity: 0; 
        transform: translateY(-20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.dni-form-section .form-group {
    margin-bottom: 20px;
}

.dni-form-section input {
    max-width: 300px !important;
    margin: 0 auto !important;
    display: block !important;
}

.dni-form-section button {
    margin: 0 auto !important;
    display: block !important;
}
.success-modal .modal-content {
    border: 3px solid #28a745;
    border-radius: 15px;
}

/* ========== RESPONSIVE MEJORADO PARA MÓVILES ========== */
@media screen and (max-width: 768px) {
    .container {
        padding: 10px 5px;
        margin: 0;
    }
    
    .consultation-options {
        flex-direction: column;
        gap: 10px;
    }
    
    .consultation-btn {
        width: 100%;
        padding: 15px;
        font-size: 16px;
    }
    
    .dni-form {
        padding: 15px 10px;
    }
    
    .dni-form input {
        font-size: 16px;
        padding: 12px;
    }
    
    .search-btn {
        width: 100%;
        margin-top: 10px;
        padding: 12px;
        font-size: 16px;
    }
    
    .student-info-grid {
        grid-template-columns: 1fr;
        gap: 8px;
        font-size: 14px;
    }
    
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .table {
        min-width: 600px;
        font-size: 12px;
    }
    
    .table th, .table td {
        padding: 6px 4px;
        white-space: nowrap;
    }
    
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .form-control, .form-select {
        font-size: 16px;
        padding: 12px;
        border-radius: 8px;
        border: 2px solid #ddd;
        transition: border-color 0.3s ease;
    }
    
    .form-control:focus, .form-select:focus {
        border-color: #667eea;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    }
    
    .btn {
        min-height: 44px;
        border-radius: 8px;
        font-weight: 500;
    }
    
    .btn-sm {
        padding: 6px 8px;
        font-size: 11px;
        min-height: 36px;
    }
    
    .payment-card {
        margin-bottom: 10px;
        padding: 12px;
    }
}

@media screen and (max-width: 480px) {
    .container {
        padding: 5px;
    }
    
    h1 {
        font-size: 20px;
        text-align: center;
    }
    
    .table {
        font-size: 10px;
        min-width: 500px;
    }
    
    .table th, .table td {
        padding: 4px 2px;
    }
    
    .badge {
        font-size: 9px;
        padding: 2px 4px;
    }
    
    .btn {
        font-size: 12px;
        padding: 6px 8px;
    }
}

/* MODAL MÓVIL OPTIMIZADO */
.modal-dialog-mobile {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    width: 100%;
    height: 100vh;
    max-width: 100%;
    max-height: 100%;
}

.modal-dialog-mobile .modal-content {
    height: 100vh;
    border-radius: 0;
    display: flex;
    flex-direction: column;
}

.modal-dialog-mobile .modal-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@media screen and (max-width: 768px) and (orientation: landscape) {
    .modal-dialog {
        max-height: 95vh;
    }
    
    .table-responsive {
        max-height: 60vh;
        overflow-y: auto;
    }
}
/* MODAL MÓVIL OPTIMIZADO */
.modal-dialog-mobile {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    width: 100%;
    height: 100vh;
    max-width: 100%;
    max-height: 100%;
}

.modal-dialog-mobile .modal-content {
    height: 100vh;
    border-radius: 0;
    display: flex;
    flex-direction: column;
}

.modal-dialog-mobile .modal-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* MEJORAS PARA CAMPOS DE FORMULARIO EN MÓVILES */
@media screen and (max-width: 768px) {
    .form-control, .form-select {
        border-radius: 8px;
        border: 2px solid #ddd;
        transition: border-color 0.3s ease;
    }
    
    .form-control:focus, .form-select:focus {
        border-color: #667eea;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    }
    
    .btn {
        min-height: 44px; /* Tamaño mínimo táctil iOS */
        border-radius: 8px;
        font-weight: 500;
    }
}


/* MEJORAR LEGIBILIDAD EN MÓVILES */
@media screen and (max-width: 768px) {
    .table {
        font-size: 14px !important;
    }
    
    .table th, .table td {
        padding: 8px 6px;
        font-size: 14px !important;
    }
    
    .btn-sm {
        font-size: 12px !important;
        padding: 6px 8px;
    }
    
    .badge {
        font-size: 11px !important;
        padding: 3px 6px;
    }
}

@media screen and (max-width: 480px) {
    .table {
        font-size: 13px !important;
    }
    
    .table th, .table td {
        padding: 6px 4px;
        font-size: 13px !important;
    }
}

/* Control de vista desktop/móvil para tablas de pagos */
@media screen and (min-width: 769px) {
    .desktop-table {
        display: block !important;
    }
    .mobile-cards {
        display: none !important;
    }
}

@media screen and (max-width: 768px) {
    .desktop-table {
        display: none !important;
    }
    .mobile-cards {
        display: block !important;
    }
}

/* Mensaje de deuda pendiente */
.debt-warning {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* Responsive para mensaje de deuda */
@media (max-width: 768px) {
    .debt-warning {
        padding: 20px 15px !important;
    }
    
    .debt-warning h3 {
        font-size: 20px !important;
    }
    
    .debt-warning p {
        font-size: 14px !important;
    }
    
    .debt-warning button {
        width: 100% !important;
        margin: 5px 0 !important;
    }
}
