/**
 * Modern Gallery Styling for Daft Integration
 * 
 * This file contains styling for the improved gallery layout with
 * portrait main image and rotating thumbnails.
 */

/* CSS Variables for consistent theming */
:root {
    --primary-color: #BCD62C;
    --secondary-color: #13adb7;
    --primary-hover: #a8c125;
    --secondary-hover: #0f9aa1;
    --text-dark: #2c3e50;
    --text-medium: #6c757d;
    --text-light: #8e9aaf;
    --background-light: #f8f9fa;
    --border-light: #e9ecef;
    --shadow-light: rgba(0, 0, 0, 0.08);
    --shadow-medium: rgba(0, 0, 0, 0.15);
}

/* Gallery Container */
.property-gallery {
    margin-bottom: 30px !important;
}

.gallery-container {
    width: 100% !important;
}

.modern-gallery {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
}

/* Main Image Container */
.gallery-main-container {
    width: 100% !important;
    position: relative !important;
}

.gallery-main {
    position: relative !important;
    width: 100% !important;
    max-height: 550px !important;
    aspect-ratio: 3/4 !important;
    /* Portrait aspect ratio */
    overflow: hidden !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 20px var(--shadow-light) !important;
    background: var(--background-light) !important;
}

.main-image {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
    transition: transform 0.3s ease !important;
}

.main-image:hover {
    transform: scale(1.02) !important;
}

/* Navigation Arrows */
.gallery-nav {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border: none !important;
    border-radius: 50% !important;
    width: 48px !important;
    height: 48px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    z-index: 10 !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
}

.gallery-nav:hover {
    background: white !important;
    transform: translateY(-50%) scale(1.1) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
}

.gallery-nav.prev {
    left: 16px !important;
}

.gallery-nav.next {
    right: 16px !important;
}

.gallery-nav svg {
    color: var(--text-dark) !important;
}

/* Image Counter */
.image-counter {
    position: absolute !important;
    bottom: 16px !important;
    right: 16px !important;
    background: rgba(0, 0, 0, 0.7) !important;
    color: white !important;
    padding: 8px 12px !important;
    border-radius: 20px !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
}

/* Thumbnail Container */
.gallery-thumbs-container {
    position: relative !important;
    margin-top: 12px !important;
    padding: 0 !important;
}

.gallery-thumbs {
    display: flex !important;
    gap: 12px !important;
    overflow: hidden !important;
    padding: 0 !important;
    transition: transform 0.3s ease !important;
    flex-wrap: nowrap !important;
}

.thumb {
    flex: 0 0 auto !important;
    width: 240px !important;
    /* Show 4 thumbnails at a time */
    aspect-ratio: 4/3 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    border: 2px solid transparent !important;
    position: relative !important;
}

.thumb:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 15px var(--shadow-medium) !important;
}

.thumb.active {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 2px rgba(188, 214, 44, 0.3) !important;
}

.thumb img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    transition: transform 0.3s ease !important;
}

.thumb:hover img {
    transform: scale(1.05) !important;
}

/* Thumbnail Navigation */
.thumb-nav {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border: none !important;
    border-radius: 50% !important;
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    z-index: 5 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

.thumb-nav:hover {
    background: white !important;
    transform: translateY(-50%) scale(1.1) !important;
}

.thumb-nav.prev,
.thumb-nav.next {
    top: 50px !important
}

.thumb-nav.prev {
    left: -16px !important;
}

.thumb-nav.next {
    right: -16px !important;
}

.thumb-nav svg {
    color: var(--text-dark) !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .gallery-main {
        aspect-ratio: 4/5 !important;
        /* Slightly less portrait on mobile */
    }

    .thumb {
        flex: 0 0 calc(50% - 6px) !important;
        /* Show 2 thumbnails on mobile */
    }

    .gallery-nav {
        width: 40px !important;
        height: 40px !important;
    }

    .gallery-nav.prev {
        left: 12px !important;
    }

    .gallery-nav.next {
        right: 12px !important;
    }

    .image-counter {
        bottom: 12px !important;
        right: 12px !important;
        font-size: 0.8rem !important;
        padding: 6px 10px !important;
    }
}

@media (max-width: 480px) {
    .modern-gallery {
        gap: 12px !important;
    }

    .gallery-main {
        border-radius: 8px !important;
        aspect-ratio: 1/1 !important;
        /* Square on very small screens */
    }

    .thumb {
        border-radius: 6px !important;
    }

    .gallery-nav {
        width: 36px !important;
        height: 36px !important;
    }

    .thumb-nav {
        width: 28px !important;
        height: 28px !important;
    }
}

/* Loading State */
.gallery-loading {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 400px !important;
    background: var(--background-light) !important;
    border-radius: 12px !important;
}

.gallery-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-light);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Animation for smooth transitions */
.main-image {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Focus states for accessibility */
.gallery-nav:focus,
.thumb-nav:focus,
.thumb:focus {
    outline: 2px solid var(--primary-color) !important;
    outline-offset: 2px !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .gallery-container {
        padding: 0 !important;
    }

    .main-image-container {
        max-height: 250px !important;
    }

    .thumb {
        width: calc(33.333% - 8px) !important;
        /* Show 3 thumbnails on mobile */
    }

    .thumb-nav {
        width: 30px !important;
        height: 30px !important;
    }

    .thumb-nav svg {
        width: 12px !important;
        height: 12px !important;
    }
}

@media (max-width: 480px) {
    .thumb {
        width: calc(50% - 6px) !important;
        /* Show 2 thumbnails on small mobile */
    }
}