/**
 * Estilos para Galería Grid Masonry
 *
 * Este CSS permite mostrar las galerías de imágenes en un estilo masonry
 * donde las imágenes se adaptan a diferentes alturas manteniendo el ancho uniforme
 */

/* Contenedor principal */
.mtz-masonry-gallery-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    box-sizing: border-box;
}

/* Grid Masonry Principal - Siempre centrado */
.mtz-masonry-gallery-wrapper[data-main-grid="true"] {
    width: 100%;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

.mtz-masonry-gallery-wrapper[data-main-grid="true"] .mtz-masonry-gallery-grid {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: block;
    column-count: 3; /* Desktop: 3 columnas */
    column-gap: 16px;
}

/* Grid Masonry - Usando CSS Columns para efecto Pinterest real */
.mtz-masonry-gallery-grid {
    column-count: 4;
    column-gap: 16px;
    line-height: 0;
    width: calc(100% - 40px); /* Restar padding del wrapper */
    max-width: calc(1200px - 40px); /* Ancho máximo menos padding */
    margin: 0 auto; /* Centrar horizontalmente */
    box-sizing: border-box;
}

/* Items de la galería masonry */
.mtz-masonry-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: #f3f4f6;
    display: inline-block;
    width: 100%;
    margin-bottom: 16px;
    break-inside: avoid;
    page-break-inside: avoid;
    -webkit-column-break-inside: avoid;
    /* SOBRESCRIBIR estilos de la galería normal - NO usar aspect-ratio fijo */
    aspect-ratio: auto !important;
    height: auto !important;
}

.mtz-masonry-gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.mtz-masonry-gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    /* NO usar object-fit: cover para mantener proporciones naturales */
    transition: transform 0.3s ease;
    border-radius: 12px;
    /* Permitir que las imágenes mantengan su aspecto natural */
    max-width: 100%;
    /* SOBRESCRIBIR estilos de la galería normal */
    position: relative !important;
    top: auto !important;
    left: auto !important;
    object-fit: none !important;
}

/* Enlace del item del grid principal */
.mtz-masonry-item-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
    position: relative;
}

.mtz-masonry-item-link:hover {
    text-decoration: none;
}

/* Overlay oscuro con transparencia para el grid principal */
.mtz-masonry-gallery-item[data-main-grid-item="true"] .mtz-masonry-item-link {
    position: relative;
}

.mtz-masonry-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
    border-radius: 12px;
    opacity: 0;
    pointer-events: none;
}

.mtz-masonry-gallery-item[data-main-grid-item="true"]:hover .mtz-masonry-overlay {
    background: rgba(0, 0, 0, 0.7);
    opacity: 1;
}

.mtz-masonry-overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}

.mtz-masonry-plan-title {
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 12px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    font-family: 'Poppins', sans-serif;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    line-height: 1.4;
}

.mtz-masonry-gallery-item[data-main-grid-item="true"]:hover .mtz-masonry-plan-title {
    opacity: 1;
    transform: translateY(0);
}

.mtz-masonry-hotel-name {
    color: #ffffff;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease 0.1s, transform 0.3s ease 0.1s;
    font-family: 'Poppins', sans-serif;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    line-height: 1.4;
    margin-bottom: 8px;
}

.mtz-masonry-hotel-name i {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.mtz-masonry-gallery-item[data-main-grid-item="true"]:hover .mtz-masonry-hotel-name {
    opacity: 1;
    transform: translateY(0);
}

.mtz-masonry-passengers {
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease 0.2s, transform 0.3s ease 0.2s;
    font-family: 'Poppins', sans-serif;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    line-height: 1.4;
}

.mtz-masonry-passengers i {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.mtz-masonry-gallery-item[data-main-grid-item="true"]:hover .mtz-masonry-passengers {
    opacity: 1;
    transform: translateY(0);
}

.mtz-masonry-gallery-item:hover img {
    transform: scale(1.05);
}

/* Responsive - Tablets */
@media (max-width: 1024px) {
    .mtz-masonry-gallery-wrapper {
        padding: 16px;
    }

    .mtz-masonry-gallery-wrapper[data-main-grid="true"] {
        padding: 16px;
    }

    .mtz-masonry-gallery-wrapper[data-main-grid="true"] .mtz-masonry-gallery-grid {
        max-width: 100%;
        column-count: 3; /* Tablets: 3 columnas */
        column-gap: 12px;
    }

    .mtz-masonry-gallery-grid {
        column-count: 3;
        column-gap: 12px;
        width: calc(100% - 32px); /* Restar padding del wrapper */
        max-width: 100%;
    }

    .mtz-masonry-gallery-item {
        margin-bottom: 12px;
    }
}

/* Responsive - Móviles */
@media (max-width: 768px) {
    .mtz-masonry-gallery-wrapper {
        padding: 12px;
    }

    .mtz-masonry-gallery-wrapper[data-main-grid="true"] {
        padding: 12px;
    }

    .mtz-masonry-gallery-wrapper[data-main-grid="true"] .mtz-masonry-gallery-grid {
        max-width: 100%;
        column-count: 2; /* Móviles: 2 columnas */
        column-gap: 10px;
    }

    .mtz-masonry-gallery-grid {
        column-count: 2;
        column-gap: 10px;
        width: calc(100% - 24px); /* Restar padding del wrapper */
        max-width: 100%;
    }

    .mtz-masonry-gallery-item {
        margin-bottom: 10px;
    }
}

/* Responsive - Móviles pequeños */
@media (max-width: 480px) {
    .mtz-masonry-gallery-wrapper {
        padding: 8px;
    }

    .mtz-masonry-gallery-wrapper[data-main-grid="true"] {
        padding: 8px;
    }

    .mtz-masonry-gallery-wrapper[data-main-grid="true"] .mtz-masonry-gallery-grid {
        max-width: 100%;
        column-count: 1; /* Móviles pequeños: 1 columna */
        column-gap: 8px;
    }

    .mtz-masonry-gallery-grid {
        column-count: 2;
        column-gap: 8px;
        width: calc(100% - 16px); /* Restar padding del wrapper */
        max-width: 100%;
    }

    .mtz-masonry-gallery-item {
        margin-bottom: 8px;
    }
}

/* Estilos para el lightbox (ya existe en tourist-plans.css pero los incluimos por si acaso) */
.mtz-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.mtz-lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mtz-lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}

.mtz-lightbox-close,
.mtz-lightbox-prev,
.mtz-lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 100000;
}

.mtz-lightbox-close {
    top: 20px;
    right: 20px;
}

.mtz-lightbox-prev {
    left: 20px;
}

.mtz-lightbox-next {
    right: 20px;
}

.mtz-lightbox-close:hover,
.mtz-lightbox-prev:hover,
.mtz-lightbox-next:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.mtz-lightbox-caption {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 8px;
    text-align: center;
    max-width: 80%;
}

.mtz-lightbox-counter {
    display: block;
    margin-top: 8px;
    font-size: 0.875rem;
    opacity: 0.9;
}

