/**
 * Showroom Gallery Skeleton Styles
 * Version: 1.0.0
 */

/* Gallery Wrapper */
.showroom-gallery-wrapper {
    width: 100%;
    max-width: 100%;
}

/* Main Image Container */
.showroom-gallery-main {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    max-height: 600px;
    margin-bottom: 1rem;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.showroom-gallery-main-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
    /* Prevent layout shift */
    aspect-ratio: 4/3;
}

/* Status Badge */
.showroom-gallery-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 10;
}

.showroom-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
}

.showroom-badge-sold {
    background-color: #ef4444;
    color: white;
}

.showroom-badge-pending {
    background-color: #f59e0b;
    color: white;
}

.showroom-badge-used {
    background-color: #6b7280;
    color: white;
}

.showroom-badge-new {
    background-color: #10b981;
    color: white;
}

.showroom-badge-available {
    background-color: #3b82f6;
    color: white;
}

/* Navigation Arrows */
.showroom-gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 2.5rem;
    height: 2.5rem;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    z-index: 10;
}

.showroom-gallery-arrow:hover {
    background-color: rgba(0, 0, 0, 0.7);
    transform: translateY(-50%) scale(1.1);
}

.showroom-gallery-prev {
    left: 1rem;
}

.showroom-gallery-next {
    right: 1rem;
}

/* Thumbnails Wrapper */
.showroom-gallery-thumbnails-wrapper {
    position: relative;
    margin-bottom: 1rem;
    min-height: 90px; /* Reserve space to prevent CLS */
}

/* Skeleton Loader */
.showroom-thumbnail-skeleton {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    min-height: 90px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
}

.showroom-thumbnail-skeleton::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.skeleton-thumbnail-item {
    flex-shrink: 0;
    width: 6rem;
    min-width: 6rem;
    aspect-ratio: 4/3;
    border-radius: 0.5rem;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    /* Prevent layout shift */
    display: block;
    height: auto;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Hide skeleton when content is ready - use visibility to prevent CLS */
.showroom-thumbnail-skeleton.hidden {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

/* Actual Thumbnails Container */
.showroom-gallery-thumbnails {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    min-height: 90px; /* Match skeleton height */
    position: relative;
    width: 100%;
}

.showroom-gallery-thumbnails::-webkit-scrollbar {
    display: none;
}

.showroom-gallery-thumbnails.hidden {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0;
    overflow: hidden;
}

.showroom-gallery-thumbnails.ready {
    visibility: visible;
    opacity: 1;
    position: relative;
    height: auto;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

/* Thumbnail Buttons */
.showroom-thumbnail-btn {
    flex-shrink: 0;
    width: 6rem;
    min-width: 6rem;
    aspect-ratio: 4/3;
    border: 2px solid transparent;
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    background: none;
    padding: 0;
    /* Prevent layout shift */
    display: block;
    height: auto;
}

.showroom-thumbnail-btn:hover {
    border-color: #3b82f6;
    transform: scale(1.05);
}

.showroom-thumbnail-btn.active {
    border-color: #3b82f6;
}

.showroom-thumbnail-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    /* Prevent layout shift */
    aspect-ratio: 4/3;
}

/* Thumbnail Navigation Arrows */
.showroom-thumbnail-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 2.5rem;
    height: 2.5rem;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    z-index: 10;
}

.showroom-thumbnail-arrow:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

.showroom-thumbnail-prev {
    left: -1rem;
}

.showroom-thumbnail-next {
    right: -1rem;
}

/* Floorplan Section */
.showroom-gallery-floorplan {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
}

.showroom-gallery-floorplan h3 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
}

.showroom-gallery-floorplan .grid {
    display: grid;
    gap: 1rem;
}

.showroom-gallery-floorplan img {
    width: 100%;
    height: auto;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease-in-out;
}

.showroom-gallery-floorplan img:hover {
    transform: scale(1.02);
}

/* Lightbox */
.showroom-lightbox-open {
    overflow: hidden;
}

.showroom-gallery-lightbox {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2147483647;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem 5rem;
    isolation: isolate;
}

.showroom-gallery-lightbox.open {
    display: flex;
}

.showroom-lightbox-image {
    max-width: min(96vw, 1400px);
    max-height: 86vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 0.5rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    cursor: zoom-in;
    transition: transform 0.18s ease;
    transform-origin: center center;
}

.showroom-lightbox-zoom-controls {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 2147483001;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.5rem;
    border-radius: 9999px;
    background: rgba(17, 24, 39, 0.82);
}

.showroom-lightbox-zoom-btn {
    width: 2.2rem;
    height: 2.2rem;
    border: none;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}

.showroom-lightbox-zoom-btn:hover {
    background: rgba(255, 255, 255, 0.24);
    transform: translateY(-1px);
}

.showroom-lightbox-zoom-level {
    min-width: 3.1rem;
    text-align: center;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
}

.showroom-lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 2147483001;
    width: 2.75rem;
    height: 2.75rem;
    border: none;
    border-radius: 9999px;
    background: rgba(17, 24, 39, 0.85);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: transform 0.2s ease, background 0.2s ease;
}

.showroom-lightbox-close:hover {
    background: rgba(17, 24, 39, 1);
    transform: scale(1.05);
}

.showroom-lightbox-arrow {
    position: absolute;
    top: 50%;
    z-index: 2147483001;
    transform: translateY(-50%);
    width: 2.75rem;
    height: 2.75rem;
    border: none;
    border-radius: 9999px;
    background: rgba(17, 24, 39, 0.85);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.2s ease;
}

.showroom-lightbox-arrow:hover {
    background: rgba(17, 24, 39, 1);
    transform: translateY(-50%) scale(1.05);
}

.showroom-lightbox-prev {
    left: 1rem;
}

.showroom-lightbox-next {
    right: 1rem;
}

.showroom-lightbox-share {
    position: absolute;
    left: 50%;
    bottom: 1.25rem;
    z-index: 2147483001;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.65rem;
    border-radius: 9999px;
    background: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(2px);
}

.showroom-lightbox-thumbnails {
    position: absolute;
    left: 50%;
    bottom: 4.9rem;
    z-index: 2147483001;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: min(92vw, 1100px);
    padding: 0.45rem 0.6rem;
    border-radius: 0.75rem;
    background: rgba(17, 24, 39, 0.72);
    overflow-x: auto;
    scrollbar-width: none;
}

.showroom-lightbox-thumbnails::-webkit-scrollbar {
    display: none;
}

.showroom-lightbox-thumbnail-btn {
    flex-shrink: 0;
    width: 5.5rem;
    min-width: 5.5rem;
    aspect-ratio: 4 / 3;
    border: 2px solid transparent;
    border-radius: 0.45rem;
    overflow: hidden;
    padding: 0;
    margin: 0;
    background: transparent;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.showroom-lightbox-thumbnail-btn:hover {
    transform: scale(1.03);
}

.showroom-lightbox-thumbnail-btn.active {
    border-color: #60a5fa;
}

.showroom-lightbox-thumbnail-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.showroom-share-link {
    width: 2.25rem;
    height: 2.25rem;
    border: none;
    border-radius: 9999px;
    text-decoration: none;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.14);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.2s ease;
}

.showroom-share-link:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.22);
}

.showroom-share-copy.copied {
    background: #16a34a;
}

/* Responsive Design */
@media (max-width: 768px) {
    .showroom-gallery-main {
        max-height: 400px;
    }
    
    .showroom-gallery-arrow {
        width: 2rem;
        height: 2rem;
    }
    
    .showroom-gallery-prev {
        left: 0.5rem;
    }
    
    .showroom-gallery-next {
        right: 0.5rem;
    }
    
    .showroom-thumbnail-btn {
        width: 5rem;
    }
    
    .skeleton-thumbnail-item {
        width: 5rem;
    }
    
    .showroom-thumbnail-arrow {
        display: none;
    }
    
    .showroom-gallery-floorplan {
        margin-top: 1.5rem;
        padding-top: 1.5rem;
    }
    
    .showroom-gallery-floorplan h3 {
        font-size: 1.125rem;
    }
    
    .showroom-gallery-floorplan .grid {
        grid-template-columns: 1fr;
    }

    .showroom-gallery-lightbox {
        padding: 1rem 0.75rem 5.25rem;
    }

    .showroom-lightbox-image {
        max-width: 98vw;
        max-height: 80vh;
    }

    .showroom-lightbox-close {
        top: 0.75rem;
        right: 0.75rem;
    }

    .showroom-lightbox-zoom-controls {
        top: 0.75rem;
        left: 0.75rem;
        gap: 0.25rem;
        padding: 0.35rem 0.4rem;
    }

    .showroom-lightbox-zoom-btn {
        width: 2rem;
        height: 2rem;
    }

    .showroom-lightbox-zoom-level {
        min-width: 2.7rem;
        font-size: 0.75rem;
    }

    .showroom-lightbox-arrow {
        width: 2.25rem;
        height: 2.25rem;
    }

    .showroom-lightbox-prev {
        left: 0.5rem;
    }

    .showroom-lightbox-next {
        right: 0.5rem;
    }

    .showroom-lightbox-share {
        bottom: 0.75rem;
        max-width: calc(100vw - 1rem);
        overflow-x: auto;
        scrollbar-width: none;
    }

    .showroom-lightbox-share::-webkit-scrollbar {
        display: none;
    }

    .showroom-lightbox-thumbnails {
        bottom: 4.25rem;
        max-width: calc(100vw - 1rem);
        padding: 0.35rem 0.45rem;
    }

    .showroom-lightbox-thumbnail-btn {
        width: 4.35rem;
        min-width: 4.35rem;
    }
}

/* Loading State */
.showroom-gallery-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.showroom-gallery-thumbnails.ready {
    animation: fadeIn 0.3s ease-in-out;
}
