/* =============================================
   MODALS - Sistema de Ventanas Modales
   ============================================= */

/* Overlay del modal */
.modal {
    display: none;
    position: fixed;
    z-index: var(--z-modal);
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    transition: opacity var(--transition-normal);
}

/* Modal activo */
.modal.active,
.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Contenido del modal */
.modal-content {
    background: white;
    width: 85%;
    max-width: 900px;
    height: 75vh;
    max-height: 75vh;
    display: flex;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid var(--soft-aqua);
    border-radius: 20px;
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Botón cerrar */
.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    color: var(--soft-aqua);
    cursor: pointer;
    transition: all var(--transition-fast);
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--soft-aqua);
}

.modal-close:hover {
    color: var(--blanco);
    background: var(--soft-aqua);
    color: var(--royal-blue);
    transform: rotate(90deg);
}

/* Contenido de texto del modal */
.modal-text {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    background: var(--royal-blue);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* Scrollbar personalizada para modal */
.modal-text::-webkit-scrollbar {
    width: 8px;
}

.modal-text::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.modal-text::-webkit-scrollbar-thumb {
    background: var(--soft-aqua);
}

/* Títulos en modal */
.modal-text h2 {
    color: var(--blanco);
    font-size: 1.6rem;
    margin-bottom: 5px;
    font-family: var(--font-secondary);
    flex-shrink: 0;
}

.modal-text h3 {
    color: var(--blanco);
    margin: 20px 0 10px;
    font-size: 1.1rem;
    font-family: var(--font-secondary);
    border-bottom: 1px solid var(--soft-aqua);
    padding-bottom: 8px;
    flex-shrink: 0;
}

/* Posición/cargo en modal */
.modal-text .position {
    color: var(--soft-aqua);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* Biografía en modal */
.modal-text .bio {
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.5;
    font-size: 0.85rem;
    flex: 1;
    overflow-y: auto;
}

/* Listas en modal */
.modal-text ul {
    list-style: none;
    margin-left: 0;
    margin-top: 15px;
}

.modal-text li {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 10px;
    padding-left: 25px;
    position: relative;
    font-size: 0.85rem;
    line-height: 1.5;
}

.modal-text li::before {
    content: '▪';
    position: absolute;
    left: 0;
    color: var(--soft-aqua);
    font-size: 1.2rem;
}

/* Imagen del modal */
.modal-image {
    width: 400px;
    min-width: 350px;
    background: var(--dim-gray);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.modal-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    filter: grayscale(20%);
}

/* Modal de servicio (sin imagen) */
.modal-service {
    max-width: 800px;
}

.modal-service .modal-content {
    flex-direction: column;
}

.modal-service .modal-header {
    padding: 30px 40px 20px;
    border-bottom: 2px solid var(--soft-aqua);
    background: linear-gradient(135deg, 
        rgba(0, 40, 86, 0.3), 
        rgba(21, 113, 112, 0.3)
    );
}

.modal-service .modal-body {
    padding: 30px 40px;
    overflow-y: auto;
    flex: 1;
}

/* Grid de características en modal */
.modal-features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 25px 0;
}

.modal-feature {
    padding: 15px;
    background: rgba(0, 40, 86, 0.3);
    border: 1px solid rgba(104, 175, 181, 0.3);
}

.modal-feature h4 {
    color: var(--soft-aqua);
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.modal-feature p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    line-height: 1.4;
}

/* Estadísticas en modal */
.modal-stats {
    display: flex;
    justify-content: space-around;
    padding: 20px;
    background: rgba(0, 40, 86, 0.2);
    margin: 20px 0;
}

.modal-stat {
    text-align: center;
}

.modal-stat-number {
    font-size: 1.8rem;
    color: var(--soft-aqua);
    font-weight: 600;
    font-family: var(--font-secondary);
}

.modal-stat-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 5px;
}

/* Modal pequeño (confirmación, alerta) */
.modal-small .modal-content {
    max-width: 500px;
    padding: 30px;
    text-align: center;
}

.modal-small .modal-icon {
    font-size: 3rem;
    color: var(--soft-aqua);
    margin-bottom: 20px;
}

.modal-small h3 {
    margin-bottom: 15px;
}

.modal-small p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 25px;
}

.modal-small .modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Animación de entrada alternativa */
.modal.fade-in .modal-content {
    animation: fadeInModal 0.4s ease;
}

@keyframes fadeInModal {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 1024px) {
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .modal-image {
        width: 350px;
    }
}

@media (max-width: 768px) {
    .modal-content {
        flex-direction: column;
        height: 85vh;
        width: 95%;
    }
    
    .modal-image {
        width: 100%;
        height: 200px;
        min-width: auto;
        order: -1;
        flex-shrink: 0;
    }
    
    .modal-image img {
        height: 200px;
        object-fit: contain;
        object-position: center;
    }
    
    .modal-text {
        padding: 20px;
        flex: 1;
        overflow-y: auto;
    }
    
    .modal-text h2 {
        font-size: 1.3rem;
        margin-bottom: 3px;
    }
    
    .modal-text .position {
        font-size: 0.7rem;
        margin-bottom: 10px;
    }
    
    .modal-text .bio {
        font-size: 0.8rem;
        line-height: 1.4;
    }
}

@media (max-width: 480px) {
    .modal-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border: none;
    }
    
    .modal-text {
        padding: 20px;
    }
    
    .modal-text h2 {
        font-size: 1.5rem;
    }
    
    .modal-close {
        top: 10px;
        right: 10px;
    }
}