/* =====================================================
   Property Gallery Modal Styles - Full Screen with Dark Overlay
   ===================================================== */

/* Modal Overrides for Full Screen Coverage - Dark Overlay */
#galleryModal {
    background: rgba(0, 0, 0, 0.6) !important;
}

#galleryModal .modal-backdrop {
    display: none !important;
}

#galleryModal .modal-dialog {
    max-width: 100vw;
    width: 100vw;
    height: 100vh;
    margin: 0;
    background: transparent;
}

#galleryModal .modal-content {
    height: 100%;
    border: none;
    border-radius: 0;
    overflow: hidden;
    background: transparent !important;
    box-shadow: none;
}

/* Override the main style.css modal-body background specifically for our gallery modal */
#galleryModal .modal-body {
    background: transparent !important;
    background-color: transparent !important;
    padding: 0 !important;
}

#galleryModal .modal-header {
    background: transparent;
    border: none;
    padding: 20px 20px 0 0;
    position: absolute;
    top: 0;
    right: 0;
    z-index: 1070;
    width: auto;
    display: flex;
    justify-content: flex-end;
}

#galleryModal .modal-title {
    display: none;
}

#galleryModal .btn-close {
    opacity: 0.9;
    font-size: 24px;
    background: transparent;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #fff;
    color: #fff;
    font-weight: bold;
    position: relative;
    transition: all 0.3s ease;
}

#galleryModal .btn-close::before {
    content: '×';
    font-size: 28px;
    line-height: 1;
    color: #fff;
    font-weight: 300;
}

#galleryModal .btn-close:hover {
    opacity: 1;
    background: transparent;
    transform: scale(1.1);
}

#galleryModal .btn-close:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5);
    outline: none;
}

/* Gallery Main Container - Full Screen */
.gallery-main-image {
    position: relative;
    height: calc(100vh - 160px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    overflow: hidden;
    padding: 0 30px;
}

/* Main Gallery Image */
#modalImage {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    border-radius: 0;
    transition: opacity 0.3s ease;
}

/* Navigation Arrows */
.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 2.5rem;
    font-weight: 300;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1050;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    opacity: 0.8;
}

.gallery-nav:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-50%) scale(1.1);
    opacity: 1;
    color: #fff;
}

.gallery-nav:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.gallery-prev {
    left: 30px;
}

.gallery-next {
    right: 30px;
}

/* Remove counter completely */
.gallery-counter {
    display: none;
}

/* Thumbnail Navigation Section - No Background */
.gallery-thumbnails {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: transparent;
    padding: 20px;
    border: none;
}

.thumbnail-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin: 0 auto;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.thumbnail-container::-webkit-scrollbar {
    height: 4px;
}

.thumbnail-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.thumbnail-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.thumbnail-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Individual Thumbnails */
.gallery-thumbnail {
    width: 80px !important;
    height: 60px !important;
    min-width: 80px !important;
    max-width: 80px !important;
    min-height: 60px !important;
    max-height: 60px !important;
    background-color: black;
    
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.2);
    opacity: 0.7;
    
    flex: 0 0 auto;
    flex-shrink: 0;
    flex-grow: 0;
    
    position: relative;
    overflow: hidden;
    display: inline-block;
}

.gallery-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.gallery-thumbnail.video-thumbnail .play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-left: 18px solid white;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    filter: drop-shadow(0 0 3px rgba(0,0,0,0.5));
    z-index: 2;
    pointer-events: none;
    margin-left: 4px;
}

.gallery-thumbnail::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.gallery-thumbnail:hover {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.6);
    opacity: 1;
}

.gallery-thumbnail:hover::before {
    opacity: 0;
}

.gallery-thumbnail.active {
    border-color: #c00;
    box-shadow: 0 0 0 2px rgba(97, 97, 97, 0.4);
    opacity: 1;
    transform: scale(1.02);
}

.gallery-thumbnail.active::before {
    opacity: 0;
}
.thumbnail-item.item-video > div {
   background: #000;
}
.thumbnail-item.item-video > div > img {
   opacity: 0.65;
   transition: opacity 0.3s ease;
}
.thumbnail-item.item-video:hover > div > img {
   opacity: 1;
   transition: opacity 0.3s ease;
}
/* Loading State */
.gallery-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.gallery-loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* =====================================================
   Responsive Design
   ===================================================== */

/* Large Desktop */
@media (min-width: 1400px) {
    .gallery-thumbnail {
        width: 100px !important;
        height: 75px !important;
        min-width: 100px !important;
        max-width: 100px !important;
        min-height: 75px !important;
        max-height: 75px !important;
    }
    
    .thumbnail-container {
        gap: 15px;
    }
}

/* Tablet */
@media (max-width: 992px) {
    #galleryModal .modal-header {
        padding: 15px 15px 0 0;
    }
    
    #galleryModal .btn-close {
        width: 35px;
        height: 35px;
        font-size: 20px;
        top: 90px;
    }
    
    #galleryModal .btn-close::before {
        font-size: 24px;
    }
    
    .gallery-main-image {
        height: calc(100vh - 140px);
        padding: 0 20px;
    }
    
    .gallery-nav {
        width: 55px;
        height: 55px;
        font-size: 2rem;
    }
    
    .gallery-prev {
        left: 20px;
    }
    
    .gallery-next {
        right: 20px;
    }
    
    .gallery-thumbnails {
        padding: 15px;
    }
    
    .gallery-thumbnail {
        width: 70px !important;
        height: 52px !important;
        min-width: 70px !important;
        max-width: 70px !important;
        min-height: 52px !important;
        max-height: 52px !important;
    }
    
    .gallery-thumbnail.video-thumbnail .play-icon {
        border-left: 15px solid white;
        border-top: 9px solid transparent;
        border-bottom: 9px solid transparent;
        margin-left: 3px;
    }
    
    .thumbnail-container {
        gap: 10px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    #galleryModal .modal-header {
        padding: 12px 12px 0 0;
    }
    
    #galleryModal .btn-close {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
    
    #galleryModal .btn-close::before {
        font-size: 22px;
    }
    
    .gallery-main-image {
        height: calc(100vh - 120px);
        padding: 0 15px;
    }
    
    .gallery-nav {
        width: 50px;
        height: 50px;
        font-size: 1.8rem;
    }
    
    .gallery-prev {
        left: 15px;
    }
    
    .gallery-next {
        right: 15px;
    }
    
    .gallery-thumbnails {
        padding: 12px;
    }
    
    .gallery-thumbnail {
        width: 60px !important;
        height: 45px !important;
        min-width: 60px !important;
        max-width: 60px !important;
        min-height: 45px !important;
        max-height: 45px !important;
    }
    
    .gallery-thumbnail.video-thumbnail .play-icon {
        border-left: 12px solid white;
        border-top: 8px solid transparent;
        border-bottom: 8px solid transparent;
        margin-left: 3px;
    }
    
    .thumbnail-container {
        gap: 8px;
        padding: 8px 0;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    #galleryModal .modal-header {
        padding: 10px 10px 0 0;
    }
    
    #galleryModal .btn-close {
        width: 30px;
        height: 30px;
        font-size: 16px;
    }
    
    #galleryModal .btn-close::before {
        font-size: 20px;
    }
    
    .gallery-nav {
        width: 45px;
        height: 45px;
        font-size: 1.5rem;
    }
    
    .gallery-thumbnail {
        width: 50px !important;
        height: 38px !important;
        min-width: 50px !important;
        max-width: 50px !important;
        min-height: 38px !important;
        max-height: 38px !important;
    }
    
    .gallery-thumbnail.video-thumbnail .play-icon {
        border-left: 9px solid white;
        border-top: 6px solid transparent;
        border-bottom: 6px solid transparent;
        margin-left: 2px;
    }
    
    .thumbnail-container {
        gap: 6px;
    }
}

/* =====================================================
   Accessibility & Animation Preferences
   ===================================================== */

/* Focus states for keyboard navigation */
.gallery-thumbnail:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .gallery-nav,
    .gallery-thumbnail,
    #modalImage {
        transition: none;
    }
    
    .gallery-nav:hover {
        transform: translateY(-50%);
    }
    
    .gallery-thumbnail:hover {
        transform: none;
    }
    
    .gallery-loading::after {
        animation: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .gallery-nav {
        background: rgba(0, 0, 0, 0.8);
        border-color: #fff;
    }
    
    .gallery-thumbnail {
        border-color: #fff;
    }
    
    .gallery-thumbnail.active {
        border-color: #00ff00;
        background: rgba(0, 255, 0, 0.2);
    }
}

/* Smooth transitions for image changes */
.image-transition-enter {
    opacity: 0;
    transform: scale(0.95);
}

.image-transition-enter-active {
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.image-transition-exit {
    opacity: 1;
    transform: scale(1);
}

.image-transition-exit-active {
    opacity: 0;
    transform: scale(1.05);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
