/* ========================================
   ENHANCED LUXURY GALLERY STYLES
   ======================================== */

/* Gallery Section */
.apartment-gallery-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    position: relative;
    padding: 120px 0;
    overflow: hidden;
}

.apartment-gallery-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 80%, rgba(170, 132, 83, 0.08) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(170, 132, 83, 0.08) 0%, transparent 50%);
    pointer-events: none;
}

/* Gallery Header */
.gallery-header {
    margin-bottom: 80px;
    position: relative;
    z-index: 2;
}

.gallery-subtitle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-size: 16px;
    font-weight: 600;
    color: var(--gt-theme);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 25px;
    font-family: 'Barlow', sans-serif;
}

.subtitle-icon {
    width: 20px;
    height: 20px;
    opacity: 0.8;
}

.gallery-title {
    font-size: 3rem;
    font-weight: 400;
    color: var(--gt-header);
    margin-bottom: 25px;
    font-family: 'Gilda Display', serif;
    position: relative;
}

.gallery-title::after {
    content: '';
    display: block;
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, var(--gt-theme), #8B6914);
    margin: 25px auto 0;
    border-radius: 2px;
}

.gallery-description {
    font-size: 1.1rem;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.7;
    font-family: 'Barlow', sans-serif;
}

/* Gallery Container */
.gallery-container {
    position: relative;
    z-index: 2;
}

/* Enhanced Gallery Navigation Buttons */
.gallery-nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(170, 132, 83, 0.9), rgba(139, 105, 20, 0.9));
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 10;
    opacity: 0.8;
}

.gallery-nav-button:hover {
    background: linear-gradient(135deg, #AA8453, #8B6914);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 8px 25px rgba(170, 132, 83, 0.4);
    opacity: 1;
}

.gallery-nav-button.prev {
    left: -80px;
}

.gallery-nav-button.next {
    right: -80px;
}

.gallery-nav-button:focus {
    outline: 2px solid var(--gt-theme);
    outline-offset: 2px;
}

.gallery-nav-button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: translateY(-50%) scale(0.9);
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    margin: 0;
    padding: 0;
}

/* Gallery Items */
.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: #fff;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: translateY(30px);
}

.gallery-item.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.gallery-item:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 40px rgba(170, 132, 83, 0.25);
}

/* Enhanced Gallery Reflection Effect */
.gallery-item::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    right: 0;
    height: 25px;
    background: linear-gradient(to top, rgba(170, 132, 83, 0.15), transparent);
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0 0 12px 12px;
    pointer-events: none;
}

.gallery-item:hover::after {
    opacity: 1;
}

/* Active Gallery Item State */
.gallery-item.active {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 35px rgba(170, 132, 83, 0.3);
}

.gallery-item.active img {
    transform: scale(1.05);
    filter: brightness(1.1);
}

/* Gallery Image Wrapper */
.gallery-image-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

.gallery-item img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 12px;
    display: block;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

/* Gallery Overlay */
.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(170, 132, 83, 0.95) 0%,
        rgba(139, 105, 20, 0.9) 100%
    );
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
    visibility: visible;
}

/* Gallery Caption */
.gallery-caption {
    color: #fff;
    margin-bottom: 20px;
}

.gallery-caption h4 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 10px;
    font-family: 'Gilda Display', serif;
    letter-spacing: 0.5px;
}

.gallery-caption p {
    font-size: 0.9rem;
    opacity: 0.9;
    line-height: 1.4;
    font-family: 'Barlow', sans-serif;
}

/* Gallery Expand Button */
.gallery-expand {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.gallery-expand:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

/* ========================================
   LIGHTBOX STYLES
   ======================================== */

/* Lightbox Backdrop */
.lightbox-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.lightbox-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* Lightbox Container */
.lightbox-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Lightbox Content */
.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s ease;
}

.lightbox-content.active {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* Lightbox Image */
.lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* Enhanced Lightbox Caption */
.lightbox-caption {
    position: absolute;
    bottom: -60px;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 15px 20px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

/* Enhanced Lightbox Back Button */
.lightbox-back-button {
    position: absolute;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #AA8453, #8B6914);
    color: #fff;
    border: none;
    border-radius: 25px;
    padding: 12px 24px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Barlow', sans-serif;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lightbox-back-button:hover {
    background: linear-gradient(135deg, #8B6914, #AA8453);
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 20px rgba(170, 132, 83, 0.4);
}

.lightbox-back-button:focus {
    outline: 2px solid var(--gt-theme);
    outline-offset: 2px;
}

.lightbox-back-button svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.lightbox-back-button:hover svg {
    transform: translateX(-2px);
}

.lightbox-caption h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 5px;
    font-family: 'Gilda Display', serif;
}

.lightbox-caption p {
    font-size: 0.9rem;
    opacity: 0.8;
    font-family: 'Barlow', sans-serif;
}

/* Lightbox Navigation */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.lightbox-prev {
    left: -70px;
}

.lightbox-next {
    right: -70px;
}

/* Lightbox Close Button */
.lightbox-close {
    position: absolute;
    top: -60px;
    right: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Lightbox Counter */
.lightbox-counter {
    position: absolute;
    top: -60px;
    left: 0;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-family: 'Barlow', sans-serif;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Large Desktop */
@media (max-width: 1400px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 25px;
    }

    .gallery-item img {
        height: 250px;
    }
}

/* Tablet */
@media (max-width: 992px) {
    .apartment-gallery-section {
        padding: 100px 0;
    }

    .gallery-header {
        margin-bottom: 60px;
    }

    .gallery-title {
        font-size: 2.5rem;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .gallery-item img {
        height: 260px;
    }

    .lightbox-nav {
        display: none;
    }
}

        /* Mobile */
        @media (max-width: 768px) {
            .apartment-gallery-section {
                padding: 80px 0;
            }

            .gallery-header {
                margin-bottom: 50px;
            }

            .gallery-subtitle {
                font-size: 14px;
                gap: 10px;
            }

            .gallery-title {
                font-size: 2.2rem;
            }

            .gallery-description {
                font-size: 1rem;
            }

            .gallery-grid {
                grid-template-columns: 1fr;
                gap: 20px;
            }

            .gallery-item img {
                height: 280px;
            }

            .lightbox-container {
                padding: 10px;
            }

            .lightbox-content {
                max-width: 95vw;
                max-height: 95vh;
            }

            .lightbox-caption {
                position: static;
                margin-top: 15px;
            }

            .lightbox-close {
                top: 10px;
                right: 10px;
            }

            .lightbox-counter {
                top: 10px;
                left: 10px;
            }

            .lightbox-back-button {
                bottom: -80px;
                font-size: 0.8rem;
                padding: 10px 20px;
            }

            .lightbox-loading-text {
                font-size: 0.7rem;
                padding: 6px 12px;
            }
        }

/* Small Mobile */
@media (max-width: 480px) {
    .apartment-gallery-section {
        padding: 60px 0;
    }

    .gallery-title {
        font-size: 1.8rem;
    }

    .gallery-item img {
        height: 250px;
    }

    .gallery-overlay {
        padding: 15px;
    }

    .gallery-caption h4 {
        font-size: 1rem;
    }

    .gallery-caption p {
        font-size: 0.8rem;
    }

    .gallery-expand {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

/* ========================================
   ENHANCED LOADING & ANIMATION STATES
   ======================================== */

/* Enhanced Loading Animation for Images */
.gallery-item img {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.gallery-item img.loaded {
    animation: fadeInImage 0.5s ease-in-out;
    background: none;
}

@keyframes fadeInImage {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.gallery-item.touch-active {
    transform: scale(0.98) !important;
}

/* Enhanced Loading States for Modal */
.lightbox-image-loading {
    position: relative;
    overflow: hidden;
}

.lightbox-image-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, rgba(170, 132, 83, 0.1) 25%, rgba(170, 132, 83, 0.2) 50%, rgba(170, 132, 83, 0.1) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    z-index: 1;
}

.lightbox-loading-text {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-family: 'Barlow', sans-serif;
    z-index: 2;
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    .gallery-item,
    .gallery-overlay,
    .gallery-expand,
    .lightbox-content {
        transition: none;
    }

    .gallery-item:hover {
        transform: none;
    }
}

/* Focus styles for keyboard navigation */
.gallery-expand:focus {
    outline: 2px solid var(--gt-theme);
    outline-offset: 2px;
}

.lightbox-nav:focus {
    outline: 2px solid var(--gt-theme);
    outline-offset: 2px;
}

.lightbox-close:focus {
    outline: 2px solid var(--gt-theme);
    outline-offset: 2px;
}
