/* =========================================
   1. AJUSTES DE SEGURIDAD (ANTIFLOJERA)
   ========================================= */
/* El box-sizing asegura que el padding no "empuje" el ancho del contenedor */
.gallery-section, 
.gallery-container,
.modal-hotel,
.modal-header,
.grid-caption {
    box-sizing: border-box;
}

/* Evita que el body detecte desbordamientos accidentales */
body {
    overflow-x: hidden;
    width: 100%;
}

/* =========================================
   2. GALERÍA MOSAICO (INTERFAZ PRINCIPAL)
   ========================================= */
.gallery-section {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 15px;
    width: 100%;
}

.gallery-container {
    display: grid;
    /* Grid de 4 columnas para lograr el efecto 1 grande + 4 pequeñas */
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: 250px 250px; 
    gap: 8px;
    border-radius: 15px;
    overflow: hidden; 
    width: 100%;
}

.gallery-item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    height: 100%;
    background-color: #eee; /* Color de carga */
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover; 
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: block;
}

.gallery-item:hover img {
    transform: scale(1.08);
}

/* Imagen Principal (Ocupa el 50% izquierdo) */
.main-item {
    grid-column: 1 / 3;
    grid-row: 1 / 3;
}

.grid-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 30px 15px 10px 15px; 
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    color: white;
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 5;
}

.btn-ver-mas {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background-color: white;
    color: #333;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.btn-ver-mas:hover {
    background-color: #f0f0f0;
}

/* =========================================
   3. MODAL DE GALERÍA (ESTABILIZADO)
   ========================================= */
.modal-hotel {
    display: none;
    position: fixed;
    z-index: 100000;
    left: 0; top: 0;
    width: 100%; 
    height: 100%;
    background-color: #fff;
    flex-direction: column;
    overflow: hidden; 
}

/* Clase que activa el JS */
.modal-hotel.modal-visible {
    display: flex !important;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 15px;
    border-bottom: 1px solid #eee;
    background: #fff;
    height: 60px;
    flex-shrink: 0;
}

.btn-close {
    position: absolute;
    left: 15px;
    background: #f0f0f0;
    border: none;
    width: 38px; height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-filters-container {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

.modal-filters-container::-webkit-scrollbar { display: none; }

.filter-item {
    display: inline-block;
    text-decoration: none;
    color: #555;
    margin-right: 12px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 0.85rem;
    border: 1px solid #ddd;
}

.filter-item.active {
    background-color: #0d46d6;
    color: white;
    border-color: #0d46d6;
}

.modal-body-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: #fcfcfc;
}

.photo-grid-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
    max-width: 1100px;
    margin: 0 auto;
}

.modal-photo-item {
    margin: 0;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.modal-photo-item img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
}

.modal-photo-item figcaption {
    padding: 12px;
    font-size: 0.9rem;
    color: #333;
    font-weight: 500;
}

/* =========================================
   4. RESPONSIVIDAD (MOBILE-FIRST)
   ========================================= */
@media (max-width: 768px) {
    .gallery-section {
        padding: 0 10px;
        margin: 25px auto;
    }

    .gallery-container { 
        grid-template-columns: 1fr 1fr; 
        grid-template-rows: auto;
        gap: 6px;
        border-radius: 10px;
    }
    
    .main-item { 
        grid-column: 1 / 3; 
        height: 250px; 
    }
    
    .gallery-item {
        height: 150px;
    }

    .photo-grid-group {
        grid-template-columns: 1fr; /* Lista vertical en móvil */
    }

    .btn-ver-mas {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}