/* ===== ESTILOS BASE ===== */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--color-50) 0%, var(--color-100) 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* ===== HEADER INSTITUCIONAL ===== */
.institutional-header {
    background: linear-gradient(135deg, var(--unam-blue-dark) 0%, var(--unam-blue) 100%);
    border-bottom: 4px solid var(--unam-gold);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.institutional-logo {
    max-height: 80px;
    width: auto;
    transition: transform 0.3s ease;
}

.institutional-logo:hover {
    transform: scale(1.05);
}

.logo-link {
    display: block;
    width: 100%;
    text-align: center;
}

.logo-link img {
    display: block;
    margin: 0 auto;
}


.institutional-title {
    color: #ffffff;
    font-weight: 600;
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.institutional-subtitle {
    color: #e0e0e0;
    font-size: 0.95rem;
    font-weight: 400;
}

/* ===== NAVBAR ===== */
.navbar {
    background: linear-gradient(90deg, var(--color-700), var(--color-600));
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.navbar-brand {
    font-weight: 700;
    color: white !important;
    font-size: 1.4rem;
}

/* ===== TARJETAS ===== */
.card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    background: white;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.card-header {
    background: linear-gradient(135deg, var(--color-600), var(--color-500));
    color: white;
    border-radius: 15px 15px 0 0 !important;
    padding: 1.2rem;
    font-weight: 600;
}

.academic-card {
    border: none;
    box-shadow: 0 4px 15px rgba(0, 61, 122, 0.1);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    margin-bottom: 2rem;
}

.academic-card-header {
    background: linear-gradient(135deg, var(--unam-blue-dark) 0%, var(--unam-blue) 100%);
    color: #ffffff;
    padding: 1.5rem;
    border: none;
}

.step-number {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin-right: 1rem;
    color: #ffffff;
}

/* ===== BOTONES ===== */
.btn-primary {
    background: var(--color-600);
    border-color: var(--color-600);
    font-weight: 600;
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    transition: all 0.3s;
}

.btn-primary:hover {
    background: var(--color-700);
    border-color: var(--color-700);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.btn-success {
    background: var(--color-teal);
    border-color: var(--color-teal);
    font-weight: 600;
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
}

.btn-success:hover {
    background: #027569;
    border-color: #027569;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.academic-btn {
    background: linear-gradient(135deg, var(--unam-blue-dark) 0%, var(--unam-blue) 100%);
    border: none;
    font-weight: 600;
    padding: 1rem 2rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 61, 122, 0.2);
}

.academic-btn:hover {
    background: linear-gradient(135deg, #002855 0%, var(--unam-blue-dark) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 61, 122, 0.3);
}

.academic-btn-success {
    background: linear-gradient(135deg, #1e7e34 0%, #28a745 100%);
    border: none;
    font-weight: 600;
    padding: 1rem 2rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(40, 167, 69, 0.2);
}

.academic-btn-success:hover {
    background: linear-gradient(135deg, #155724 0%, #1e7e34 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(40, 167, 69, 0.3);
}

/* ===== ALERTAS ===== */
.alert {
    border-radius: 10px;
    border: none;
}

.alert-info {
    background: var(--color-50);
    color: var(--color-900);
    border-left: 4px solid var(--color-500);
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid var(--color-teal);
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.academic-alert {
    border-left: 4px solid var(--unam-blue);
    background: #e8f4fd;
    border-radius: 8px;
    padding: 1rem 1.25rem;
}

.academic-success-alert {
    border-left: 4px solid #28a745;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
}

.loading-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 2rem;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.loading-spinner {
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    border: 6px solid rgba(0, 0, 0, 0.12);
    border-top-color: var(--color-600);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-texts h4 {
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.loading-texts p {
    margin-bottom: 1rem;
    color: var(--color-700);
}

.loading-progress-bar {
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.06);
}

.loading-progress-bar .progress-bar {
    background: var(--color-600);
}

/* ===== FORMULARIOS ===== */
.form-control, .form-select {
    border-radius: 8px;
    border: 2px solid var(--color-200);
    padding: 0.6rem 1rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--color-500);
    box-shadow: 0 0 0 0.2rem rgba(3, 103, 166, 0.15);
}

.form-control-lg {
    padding: 0.8rem 1rem;
    font-size: 1rem;
    border: 2px solid #d0d0d0;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.form-control-lg:focus {
    border-color: var(--unam-blue-dark);
    box-shadow: 0 0 0 0.2rem rgba(0, 61, 122, 0.15);
}

.form-label {
    font-weight: 600;
    color: var(--color-800);
    margin-bottom: 0.5rem;
}

.example-code {
    background: #f8f9fa;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    border-left: 3px solid var(--unam-blue-dark);
    display: inline-block;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--unam-blue-dark);
}

/* ===== MÉTRICAS ===== */
.metric-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
}

.metric-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-700);
}

.metric-label {
    color: #666;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.metric-card-academic {
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.metric-card-academic:hover {
    border-color: var(--unam-blue-dark);
    box-shadow: 0 4px 12px rgba(0, 61, 122, 0.1);
    transform: translateY(-3px);
}

.metric-icon {
    font-size: 2rem;
    color: var(--unam-blue-dark);
    margin-bottom: 0.5rem;
}

.metric-value-academic {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--unam-blue-dark);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.metric-label-academic {
    font-size: 0.95rem;
    color: #666;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== CAJAS DE EXPLICACIÓN ===== */
.explanation-box {
    background: var(--color-50);
    border-left: 4px solid var(--color-500);
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.explanation-box h4 {
    color: var(--color-800);
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.explanation-box p {
    margin-bottom: 0.8rem;
    line-height: 1.6;
}

.methodology-box {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.methodology-title {
    color: var(--unam-blue-dark);
    font-weight: 700;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    border-bottom: 2px solid var(--unam-blue-dark);
    padding-bottom: 0.5rem;
}

.method-item {
    background: #ffffff;
    padding: 1.25rem;
    border-radius: 8px;
    border-left: 4px solid var(--unam-blue-dark);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    height: 100%;
}

.method-name {
    color: var(--unam-blue-dark);
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.method-description {
    color: #555;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 0;
}

.info-box {
    background: white;
    border: 2px solid var(--color-200);
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
}

.info-box h4 {
    color: var(--color-700);
    margin-bottom: 1rem;
}

.info-box ul {
    list-style: none;
    padding-left: 0;
}

.info-box li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.info-box li:before {
    content: "";
    position: absolute;
    left: 0;
    color: var(--color-teal);
    font-weight: bold;
}

.info-academic-box {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid #dee2e6;
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.info-title {
    color: var(--unam-blue-dark);
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 3px solid var(--unam-gold);
    padding-bottom: 0.75rem;
}

.section-subtitle {
    color: var(--unam-blue-dark);
    font-weight: 600;
    font-size: 1.2rem;
    margin-bottom: 1rem;
    margin-top: 1.5rem;
}

.feature-list {
    list-style: none;
    padding-left: 0;
}

.feature-list li {
    padding: 0.5rem 0;
    color: #333;
    line-height: 1.6;
}

.feature-list i {
    color: #28a745;
    margin-right: 0.75rem;
    font-size: 1.1rem;
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.loading-content {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
}

.loading-content h4 {
    color: var(--color-700);
    margin-bottom: 1rem;
}

.spinner-border {
    border-color: var(--color-500);
    border-right-color: transparent;
}

.progress {
    height: 8px;
    border-radius: 4px;
    background: var(--color-100);
}

.progress-bar {
    background: var(--color-600);
}

.loading-spinner {
    width: 3rem;
    height: 3rem;
}

.loading-progress-bar {
    width: 0%;
}

.red-frame {
    min-height: 650px;
    border: 1px solid #ddd;
    border-radius: 12px;
}

/* ===== TABS Y TABLAS ===== */
.nav-tabs .nav-link {
    color: var(--color-700);
    border: none;
    padding: 1rem 1.5rem;
    font-weight: 600;
}

.nav-tabs .nav-link.active {
    color: white;
    background: var(--color-600);
    border-radius: 8px 8px 0 0;
}

.table {
    border-radius: 8px;
    overflow: hidden;
}

.table thead th {
    background: var(--color-600);
    color: white;
    border: none;
    padding: 1rem;
}

.table-striped tbody tr:nth-of-type(odd) {
    background: var(--color-50);
}

/* ===== FOOTER INSTITUCIONAL ===== */
.institutional-footer {
    background: linear-gradient(135deg, var(--unam-blue-dark) 0%, var(--unam-blue) 100%);
    color: #ffffff;
    border-top: 4px solid var(--unam-gold);
    margin-top: 4rem;
}

.footer-logo {
    max-height: 60px;
    width: auto;
    filter: brightness(0) invert(1);
}

.footer-institution {
    color: #ffffff;
    font-weight: 600;
    font-size: 0.95rem;
}

.footer-text {
    color: #e0e0e0;
    font-size: 0.9rem;
    line-height: 1.6;
}

.footer-text strong {
    color: #ffffff;
    font-weight: 600;
}

/* ===== RESPONSIVO ===== */
@media (max-width: 768px) {
    .institutional-logo {
        max-height: 60px;
        margin-bottom: 1rem;
    }
    
    .institutional-title {
        font-size: 1rem;
    }
    
    .institutional-subtitle {
        font-size: 0.85rem;
    }
    
    .step-number {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .metric-value-academic {
        font-size: 2rem;
    }
    
    .methodology-box {
        padding: 1.5rem;
    }
}

.plotly, .plotly-graph-div, .js-plotly-plot {
    visibility: visible !important;
    opacity: 1 !important;
    min-height: 320px;
}

/* ===== ANIMACIONES ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.academic-card {
    animation: fadeInUp 0.6s ease-out;
}
