/**
 * Airbnb Gallery Widget Styles
 * ============================
 */

/* Variables CSS */
.airbnb-gallery-wrapper {
    --airbnb-transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --airbnb-transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --airbnb-shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.15);
    --airbnb-shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.2);
    --airbnb-radius-sm: 8px;
    --airbnb-radius-md: 12px;
    --airbnb-radius-lg: 16px;
}

/* =============================================
   GRID PRINCIPAL - Layout estilo Airbnb
   ============================================= */

.airbnb-gallery-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 8px;
    height: 500px;
    overflow: hidden;
    position: relative;
    border-radius: var(--airbnb-radius-md);
}

/* Primera imagen - Ocupa toda la columna izquierda */
.airbnb-gallery-item-1 {
    grid-column: 1;
    grid-row: 1 / 3;
    border-radius: var(--airbnb-radius-md) 0 0 var(--airbnb-radius-md);
}

/* Imágenes de la derecha */
.airbnb-gallery-item-2 {
    grid-column: 2;
    grid-row: 1;
}

.airbnb-gallery-item-3 {
    grid-column: 2;
    grid-row: 1;
    margin-left: calc(50% + 4px);
}

.airbnb-gallery-item-4 {
    grid-column: 2;
    grid-row: 2;
}

.airbnb-gallery-item-5 {
    grid-column: 2;
    grid-row: 2;
    margin-left: calc(50% + 4px);
    border-radius: 0 0 var(--airbnb-radius-md) 0;
}

/* Alternativa: Grid con 5 columnas para el lado derecho */
@supports (grid-template-columns: repeat(4, 1fr)) {
    .airbnb-gallery-grid {
        grid-template-columns: 2fr 1fr 1fr;
        grid-template-rows: 1fr 1fr;
    }
    
    .airbnb-gallery-item-1 {
        grid-column: 1;
        grid-row: 1 / 3;
        border-radius: var(--airbnb-radius-md) 0 0 var(--airbnb-radius-md);
    }
    
    .airbnb-gallery-item-2 {
        grid-column: 2;
        grid-row: 1;
        margin-left: 0;
    }
    
    .airbnb-gallery-item-3 {
        grid-column: 3;
        grid-row: 1;
        margin-left: 0;
        border-radius: 0 var(--airbnb-radius-md) 0 0;
    }
    
    .airbnb-gallery-item-4 {
        grid-column: 2;
        grid-row: 2;
        margin-left: 0;
    }
    
    .airbnb-gallery-item-5 {
        grid-column: 3;
        grid-row: 2;
        margin-left: 0;
        border-radius: 0 0 var(--airbnb-radius-md) 0;
    }
}

/* Estilos de los items de imagen */
.airbnb-gallery-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.airbnb-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--airbnb-transition-smooth), opacity var(--airbnb-transition-fast);
}

.airbnb-gallery-item:hover img {
    transform: scale(1.02);
}

/* Badge de video */
.airbnb-video-badge {
    position: absolute;
    bottom: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--airbnb-shadow-medium);
    cursor: pointer;
    transition: transform var(--airbnb-transition-fast);
}

.airbnb-video-badge:hover {
    transform: scale(1.1);
}

.airbnb-video-badge svg {
    width: 20px;
    height: 20px;
    margin-left: 3px;
}

/* =============================================
   BOTÓN "SHOW ALL PHOTOS"
   ============================================= */

.airbnb-gallery-button {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #fff;
    color: #222;
    border: 1px solid #222;
    border-radius: var(--airbnb-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--airbnb-transition-fast);
    z-index: 10;
    font-family: inherit;
}

.airbnb-gallery-button:hover {
    background: #f7f7f7;
    transform: scale(1.02);
}

.airbnb-gallery-button:active {
    transform: scale(0.98);
}

.airbnb-gallery-button i,
.airbnb-gallery-button svg {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* =============================================
   POPUP FULLSCREEN
   ============================================= */

.airbnb-gallery-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--airbnb-transition-smooth), visibility var(--airbnb-transition-smooth);
    overflow: hidden;
}

.airbnb-gallery-popup.active {
    opacity: 1;
    visibility: visible;
}

/* Animación de entrada */
.airbnb-gallery-popup.active .airbnb-popup-header {
    animation: slideDown 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.airbnb-gallery-popup.active .airbnb-popup-content {
    animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.1s forwards;
    opacity: 0;
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* =============================================
   HEADER DEL POPUP - Layout: Título | Categorías | Close
   ============================================= */

.airbnb-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 60px;
    background: #000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    gap: 24px;
}

/* Título a la izquierda */
.airbnb-popup-header-title {
    flex-shrink: 0;
}

.airbnb-popup-title {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    margin: 0;
    white-space: nowrap;
}

/* Navegación de categorías en el centro */
.airbnb-popup-header-nav {
    flex: 1;
    display: flex;
    justify-content: center;
    overflow: hidden;
    min-width: 0;
}

.airbnb-popup-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    padding: 0 8px;
}

.airbnb-popup-nav::-webkit-scrollbar {
    display: none;
}

.airbnb-popup-nav-item {
    position: relative;
    padding: 8px 16px;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--airbnb-transition-fast);
    white-space: nowrap;
    font-family: inherit;
}

.airbnb-popup-nav-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.airbnb-popup-nav-item.active {
    color: #000;
    background: #fff;
}

/* Botón Close a la derecha */
.airbnb-popup-header-close {
    flex-shrink: 0;
}

.airbnb-popup-close {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--airbnb-transition-fast);
    font-family: inherit;
}

.airbnb-popup-close:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.airbnb-popup-close svg {
    width: 16px;
    height: 16px;
}

/* =============================================
   CONTENIDO DEL POPUP - IMÁGENES
   ============================================= */

.airbnb-popup-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
    scroll-behavior: smooth;
}

.airbnb-popup-category {
    margin-bottom: 48px;
}

.airbnb-popup-category:last-child {
    margin-bottom: 0;
}

.airbnb-popup-category-title {
    font-size: 22px;
    font-weight: 600;
    color: #fff;
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.airbnb-popup-images {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.airbnb-popup-image-item {
    position: relative;
    border-radius: var(--airbnb-radius-md);
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 4/3;
    grid-column: span 1 !important; /* Forzar siempre 1 columna */
}

/* Asegurar que la primera imagen también sea de 1 columna */
.airbnb-popup-images .airbnb-popup-image-item:first-child,
.airbnb-popup-images .airbnb-popup-image-item:nth-child(1) {
    grid-column: span 1 !important;
    aspect-ratio: 4/3;
}

.airbnb-popup-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--airbnb-transition-smooth);
}

.airbnb-popup-image-item:hover img {
    transform: scale(1.05);
}

/* =============================================
   LIGHTBOX PARA IMAGEN INDIVIDUAL
   ============================================= */

.airbnb-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--airbnb-transition-smooth), visibility var(--airbnb-transition-smooth);
}

.airbnb-lightbox.active {
    opacity: 1;
    visibility: visible;
}

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

.airbnb-lightbox-content img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: var(--airbnb-radius-sm);
}

.airbnb-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--airbnb-transition-fast);
}

.airbnb-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.airbnb-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--airbnb-transition-fast);
}

.airbnb-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.airbnb-lightbox-prev {
    left: 24px;
}

.airbnb-lightbox-next {
    right: 24px;
}

.airbnb-lightbox-counter {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
}

/* =============================================
   RESPONSIVE DESIGN
   ============================================= */

@media (max-width: 1024px) {
    .airbnb-popup-images {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .airbnb-popup-nav-item {
        padding: 6px 12px;
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    /* Grid principal en móvil */
    .airbnb-gallery-grid {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
        height: 300px;
    }
    
    .airbnb-gallery-item-2,
    .airbnb-gallery-item-3,
    .airbnb-gallery-item-4,
    .airbnb-gallery-item-5 {
        display: none;
    }
    
    .airbnb-gallery-item-1 {
        grid-column: 1;
        grid-row: 1;
        border-radius: var(--airbnb-radius-md);
    }
    
    .airbnb-gallery-button {
        bottom: 16px;
        right: 16px;
        padding: 8px 12px;
        font-size: 13px;
    }
    
    /* Header del popup en móvil - stack vertical */
    .airbnb-popup-header {
        flex-direction: column;
        height: auto;
        padding: 12px 16px;
        gap: 12px;
    }
    
    .airbnb-popup-header-title {
        width: 100%;
        order: 1;
    }
    
    .airbnb-popup-header-nav {
        width: 100%;
        order: 2;
        justify-content: flex-start;
    }
    
    .airbnb-popup-header-close {
        position: absolute;
        top: 12px;
        right: 16px;
    }
    
    .airbnb-popup-title {
        font-size: 14px;
        padding-right: 80px;
    }
    
    .airbnb-popup-nav {
        padding: 0;
        justify-content: flex-start;
    }
    
    .airbnb-popup-nav-item {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .airbnb-popup-content {
        padding: 16px;
    }
    
    /* Imágenes en 1 columna en móvil */
    .airbnb-popup-images {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .airbnb-popup-category-title {
        font-size: 18px;
    }
    
    /* Lightbox en móvil */
    .airbnb-lightbox-nav {
        width: 44px;
        height: 44px;
    }
    
    .airbnb-lightbox-prev {
        left: 12px;
    }
    
    .airbnb-lightbox-next {
        right: 12px;
    }
}

@media (max-width: 480px) {
    .airbnb-popup-close span {
        display: none;
    }
    
    .airbnb-popup-close {
        padding: 8px;
        border-radius: 50%;
        width: 36px;
        height: 36px;
        justify-content: center;
    }
    
    .airbnb-popup-title {
        padding-right: 50px;
    }
}

/* =============================================
   ANIMACIONES ADICIONALES
   ============================================= */

/* Efecto de carga para imágenes */
.airbnb-popup-image-item img,
.airbnb-gallery-item img {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 25%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 75%
    );
    background-size: 200% 100%;
}

.airbnb-popup-image-item img[src],
.airbnb-gallery-item img[src] {
    background: none;
}

/* Transición suave al scroll */
.airbnb-popup-content {
    scroll-behavior: smooth;
}

/* Focus states para accesibilidad */
.airbnb-gallery-button:focus,
.airbnb-popup-close:focus,
.airbnb-popup-nav-item:focus,
.airbnb-popup-action:focus,
.airbnb-lightbox-close:focus,
.airbnb-lightbox-nav:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Prevenir scroll del body cuando popup está abierto */
body.airbnb-popup-open {
    overflow: hidden;
}
