/* ===========================
   Gallery Section
   =========================== */
.gallery {
    padding: 56px 0;
    background: var(--white);
    position: relative;
    z-index: 10;
}

.gallery-filters {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    background: var(--bg-light);
    border: 2px solid transparent;
    border-radius: 18px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
    transition: var(--transition);
}

.filter-btn:hover {
    border-color: var(--accent-color);
    background: var(--white);
}

.filter-btn.active {
    background: var(--secondary-color);
    color: var(--white);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    position: relative;
    z-index: 1;
    /* animation: fadeIn 0.6s ease; */ /* Désactivé temporairement pour corriger le bug de rendu */
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Painting Card */
.painting-card {
    position: relative;
    background: var(--white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    /* transition: var(--transition); */ /* Désactivé temporairement */
    cursor: pointer;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.painting-card:hover {
    /* transform: translateY(-10px); */ /* Désactivé temporairement */
    box-shadow: var(--shadow-hover);
}

.painting-card.hidden {
    display: none;
}

.painting-image {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    background: var(--bg-light);
    overflow: hidden;
}

.painting-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.painting-card:hover .painting-image img {
    transform: scale(1.1);
}

.painting-image .image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    color: var(--text-light);
    font-size: 3rem;
}

/* Sale Badge */
.sale-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255,255,255,0.82);
    color: var(--text-color);
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(0,0,0,0.08);
    font-weight: 500;
    font-size: 0.72rem;
    letter-spacing: 0.02em;
    backdrop-filter: blur(2px);
    z-index: 10;
    box-shadow: none;
}

/* Frame Effect */
.painting-frame {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    border: 3px solid rgba(255,255,255,0.8);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.1);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.painting-card:hover .painting-frame {
    opacity: 1;
}

/* Painting Info */
.painting-info {
    padding: 0.95rem;
    background: var(--white);
}

.painting-title {
    font-size: 1.03rem;
    color: var(--primary-color);
    margin-bottom: 0.3rem;
    font-weight: 600;
}

.painting-details {
    color: var(--text-light);
    font-size: 0.82rem;
    line-height: 1.45;
}

.painting-technique {
    display: inline-block;
    padding: 3px 8px;
    background: var(--bg-light);
    border-radius: 4px;
    font-size: 0.74rem;
    margin-top: 0.35rem;
    font-weight: 500;
}

/* ===========================
   Lightbox
   =========================== */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90vh;
    display: flex;
    gap: 2rem;
    animation: zoomIn 0.4s ease;
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

#lightboxImage {
    max-width: 70%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 5px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.5);
    cursor: zoom-in;
    transition: transform 0.15s ease;
    transform-origin: center center;
}

#lightboxImage.zoom-active {
    cursor: grab;
}

#lightboxImage.zoom-active.is-panning {
    cursor: grabbing;
}

.lightbox-info {
    max-width: 25%;
    color: var(--white);
    overflow-y: auto;
}

.lightbox-info h3 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--white);
}

.painting-cartel {
    background: rgba(255,255,255,0.1);
    padding: 1.5rem;
    border-radius: 10px;
    border-left: 4px solid var(--secondary-color);
}

.painting-cartel p {
    margin-bottom: 0.8rem;
    line-height: 1.6;
    font-size: 1rem;
}

.painting-cartel p:last-child {
    margin-bottom: 0;
}

/* Lightbox Controls */
.lightbox-close {
    position: fixed;
    top: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.1);
    color: var(--white);
    font-size: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 10000;
}

.lightbox-close:hover {
    background: var(--secondary-color);
    transform: rotate(90deg);
}

.lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.1);
    color: var(--white);
    font-size: 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 10000;
}

.lightbox-prev {
    left: 30px;
}

.lightbox-next {
    right: 30px;
}

.lightbox-nav:hover {
    background: var(--secondary-color);
    transform: translateY(-50%) scale(1.1);
}

/* Details Carousel */
.details-carousel {
    margin: 2rem 0;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.details-title {
    color: var(--white);
    font-size: 1.2rem;
    margin: 0;
    font-weight: 500;
}

.show-main-btn {
    padding: 8px 16px;
    background: var(--accent-color);
    color: var(--white);
    border: none;
    border-radius: 5px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.show-main-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

.details-slider {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.details-track {
    position: relative;
    width: 100%;
    max-width: 600px;
    height: 200px;
    overflow: hidden;
    border-radius: 8px;
}

.detail-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    pointer-events: none;
    cursor: pointer;
}

.detail-image.active {
    opacity: 1;
    pointer-events: auto;
}

.detail-image:hover {
    transform: scale(1.02);
}

.details-nav {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    font-size: 1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    cursor: pointer;
    border: none;
}

.details-nav:hover {
    background: var(--secondary-color);
    transform: scale(1.1);
}

.details-prev {
    order: -1;
}

.details-next {
    order: 1;
}

/* ===========================
   Responsive Gallery
   =========================== */
@media (max-width: 968px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.5rem;
    }

    .lightbox-content {
        flex-direction: column;
        align-items: center;
    }

    #lightboxImage {
        max-width: 90%;
    }

    .lightbox-info {
        max-width: 90%;
    }

    .lightbox-nav {
        width: 50px;
        height: 50px;
    }

    .lightbox-prev {
        left: 15px;
    }

    .lightbox-next {
        right: 15px;
    }

    .details-carousel {
        padding: 1rem;
    }

    .details-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .show-main-btn {
        width: 100%;
    }

    .details-track {
        max-width: 100%;
        height: 150px;
    }

    .details-nav {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
}

@media (max-width: 640px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .gallery-filters {
        justify-content: flex-start;
        gap: 0.3rem;
        margin-bottom: 1rem;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.25rem;
    }

    .filter-btn {
        flex: 0 0 auto;
        padding: 6px 9px;
        border-radius: 14px;
        font-size: 0.75rem;
        line-height: 1.1;
        white-space: nowrap;
    }

    .painting-image {
        aspect-ratio: 2/3;
    }

    .painting-info {
        padding: 0.72rem;
    }

    .painting-title {
        font-size: 0.94rem;
    }

    .painting-details {
        font-size: 0.76rem;
        line-height: 1.35;
    }

    .painting-technique {
        font-size: 0.68rem;
    }

    .lightbox-close {
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
    }

    .painting-cartel {
        padding: 0.85rem;
    }

    .painting-cartel p {
        font-size: 0.84rem;
        line-height: 1.35;
        margin-bottom: 0.55rem;
    }

    .details-title {
        font-size: 1rem;
    }

    .details-track {
        height: 120px;
    }

    .details-nav {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
}

/* ===========================
   Virtual Gallery View
   =========================== */
.gallery-view-switch {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.view-btn {
    padding: 10px 20px;
    background: var(--bg-light);
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.view-btn:hover,
.view-btn.active {
    background: var(--accent-color);
    color: var(--white);
}

.virtual-gallery {
    display: none;
    perspective: 1000px;
}

.virtual-gallery.active {
    display: block;
}

.gallery-wall {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
    padding: 3rem;
    background: linear-gradient(to bottom, #8b7355 0%, #6b5844 100%);
    border-radius: 10px;
}

.wall-painting {
    transform: rotateY(-5deg);
    transition: transform 0.5s ease;
}

.wall-painting:hover {
    transform: rotateY(0deg) scale(1.05);
}
