/* ==============================
   Villa Image Gallery
   ============================== */

/* --- Hero Grid --- */
.villa-gallery-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    grid-template-rows: 1fr 1fr;
    gap: 6px;
    height: 450px;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
}

.villa-gallery-grid .gallery-main {
    grid-row: 1 / 3;
}

.villa-gallery-grid .gallery-item {
    overflow: hidden;
}

.villa-gallery-grid .gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.villa-gallery-grid .gallery-item:hover img {
    transform: scale(1.03);
}

/* Show all photos button */
.gallery-show-all {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.15);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #1a1a1a;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 2;
}

.gallery-show-all:hover {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Photo count badge (mobile) */
.gallery-photo-count {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    z-index: 2;
}

/* --- Mobile Carousel --- */
.villa-gallery-mobile {
    display: none;
    position: relative;
    height: 300px;
    border-radius: 12px;
    overflow: hidden;
}

.villa-gallery-mobile .mobile-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.villa-gallery-mobile .mobile-slide.active {
    opacity: 1;
}

.villa-gallery-mobile .mobile-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mobile-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.85);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1rem;
    color: #333;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-nav-btn:hover {
    background: #fff;
}

.mobile-nav-prev {
    left: 10px;
}

.mobile-nav-next {
    right: 10px;
}

/* --- Lightbox Modal --- */
.gallery-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    flex-direction: column;
}

.gallery-lightbox.active {
    display: flex;
}

.lightbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    color: #fff;
}

.lightbox-counter {
    font-size: 0.95rem;
    font-weight: 500;
}

.lightbox-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

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

.lightbox-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 0;
    padding: 0 60px;
}

.lightbox-main img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.lightbox-prev {
    left: 8px;
}

.lightbox-next {
    right: 8px;
}

/* --- Thumbnail Strip --- */
.lightbox-thumbnails {
    display: flex;
    gap: 6px;
    padding: 12px 24px 16px;
    overflow-x: auto;
    justify-content: center;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.lightbox-thumb {
    flex-shrink: 0;
    width: 64px;
    height: 48px;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
    border: 2px solid transparent;
}

.lightbox-thumb.active {
    opacity: 1;
    border-color: #fff;
}

.lightbox-thumb:hover {
    opacity: 0.8;
}

.lightbox-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .villa-gallery-grid {
        display: none;
    }

    .villa-gallery-mobile {
        display: block;
    }

    .lightbox-main {
        padding: 0 48px;
    }

    .lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .lightbox-thumbnails {
        padding: 8px 12px 12px;
    }

    .lightbox-thumb {
        width: 48px;
        height: 36px;
    }
}
