/* ===== MODAL DE IMAGEN ===== */
.image-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease-out;
}

.image-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-modal-content {
    position: relative;
    max-width: 95%; /* Aumentado de 90% a 95% */
    max-height: 95%; /* Aumentado de 90% a 95% */
    margin: auto;
    animation: zoomIn 0.3s ease-out;
    width: fit-content; /* Se ajusta al contenido */
}

.image-modal-content img {
    width: auto;
    height: auto;
    max-width: 95vw; /* Máximo 95% del ancho de ventana */
    max-height: 85vh; /* Máximo 85% del alto de ventana */
    object-fit: contain;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    display: block; /* Elimina espacios inline */
}

.image-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: var(--white);
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.image-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Contador de imágenes */
.image-modal-counter {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--white);
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: var(--font-size-sm);
    font-weight: 600;
    backdrop-filter: blur(4px);
    z-index: 10002;
}

.image-modal-info {
    position: absolute;
    bottom: -60px;
    left: 0;
    right: 0;
    color: var(--white);
    text-align: center;
    background: rgba(0, 0, 0, 0.7);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
}

.image-modal-info h3 {
    margin: 0 0 var(--spacing-sm) 0;
    font-size: var(--font-size-lg);
}

.image-modal-info p {
    margin: 0;
    font-size: var(--font-size-sm);
    opacity: 0.8;
}

/* Navegación entre imágenes */
.image-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: var(--white);
    border: none;
    font-size: 1.5rem;
    padding: var(--spacing-md);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: var(--transition);
    z-index: 10001;
}

.image-modal-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.image-modal-prev {
    left: 20px;
}

.image-modal-next {
    right: 20px;
}

/* Indicador de carga */
.image-modal-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--white);
    font-size: var(--font-size-lg);
}

.image-modal-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid var(--white);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--spacing-md);
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes zoomIn {
    from { 
        opacity: 0;
        transform: scale(0.8);
    }
    to { 
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .image-modal-content {
        max-width: 98%; /* Casi todo el ancho en tablets */
        max-height: 90%;
    }
    
    .image-modal-content img {
        max-width: 98vw;
        max-height: 80vh;
    }
    
    .image-modal-close {
        top: -35px;
        font-size: 1.5rem;
        width: 35px;
        height: 35px;
    }
    
    .image-modal-info {
        bottom: -50px;
        padding: var(--spacing-sm);
    }
    
    .image-modal-nav {
        font-size: 1.2rem;
        padding: var(--spacing-sm);
    }
    
    .image-modal-prev {
        left: 10px;
    }
    
    .image-modal-next {
        right: 10px;
    }
}

@media (max-width: 480px) {
    .image-modal-content {
        max-width: 100%;
        max-height: 85%;
    }
    
    .image-modal-content img {
        max-width: 100vw;
        max-height: 75vh;
    }
    
    .image-modal-info {
        position: relative;
        bottom: 0;
        margin-top: var(--spacing-md);
    }
    
    .image-modal-close {
        top: -30px;
        right: -10px;
    }
}

/* Cursor personalizado para imágenes clickeables */
.package-image img,
.extra-image img {
    cursor: zoom-in;
    transition: var(--transition);
}

.package-image img:hover,
.extra-image img:hover {
    transform: scale(1.05);
}