/**
 * Système de Navigation de Galerie avec Flèches
 * Mayram Fashion House
 */

/* === CONTENEUR GALERIE === */
.product-gallery {
    position: relative;
}

.gallery-main {
    position: relative;
    background: var(--bg-secondary, #f5f5f5);
    border-radius: 12px;
    overflow: hidden;
}

.gallery-main-image {
    width: 100%;
    height: 600px;
    object-fit: contain;
    border-radius: 12px;
    background: var(--bg-secondary, #f5f5f5);
    transition: opacity 0.3s ease;
}

/* === FLÈCHES DE NAVIGATION === */
.gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.95);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.gallery-arrow:hover {
    background: white;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    transform: translateY(-50%) scale(1.1);
}

.gallery-arrow:active {
    transform: translateY(-50%) scale(0.95);
}

.gallery-arrow svg {
    color: #1a1a1a;
    transition: color 0.3s ease;
}

.gallery-arrow:hover svg {
    color: #d4af37;
}

.gallery-arrow-left {
    left: 20px;
}

.gallery-arrow-right {
    right: 20px;
}

/* Animation d'apparition au survol */
@media (hover: hover) {
    .gallery-arrow {
        opacity: 0;
        pointer-events: none;
    }
    
    .gallery-main:hover .gallery-arrow {
        opacity: 1;
        pointer-events: auto;
    }
}

/* Sur mobile, toujours visible mais plus petit */
@media (max-width: 768px) {
    .gallery-arrow {
        opacity: 1 !important;
        pointer-events: auto !important;
        width: 40px;
        height: 40px;
        background: rgba(255, 255, 255, 0.9);
    }
    
    .gallery-arrow-left {
        left: 10px;
    }
    
    .gallery-arrow-right {
        right: 10px;
    }
    
    .gallery-arrow svg {
        width: 20px;
        height: 20px;
    }
}

/* === INDICATEUR DE POSITION === */
.gallery-indicator {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    z-index: 10;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.gallery-indicator span {
    font-weight: 700;
}

@media (max-width: 768px) {
    .gallery-indicator {
        font-size: 0.75rem;
        padding: 6px 12px;
        bottom: 10px;
    }
}

/* === MINIATURES === */
.gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    max-height: 120px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.5rem 0;
    
    /* Scrollbar personnalisé */
    scrollbar-width: thin;
    scrollbar-color: #d4af37 #f5f5f5;
}

.gallery-thumbs::-webkit-scrollbar {
    height: 6px;
}

.gallery-thumbs::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 3px;
}

.gallery-thumbs::-webkit-scrollbar-thumb {
    background: #d4af37;
    border-radius: 3px;
}

.gallery-thumbs::-webkit-scrollbar-thumb:hover {
    background: #b8941f;
}

.gallery-thumb {
    position: relative;
    padding-top: 100%;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    min-width: 80px;
}

.gallery-thumb:hover {
    border-color: #d4af37;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.gallery-thumb.active {
    border-color: #d4af37;
    box-shadow: 0 0 0 1px #d4af37, 0 4px 12px rgba(212, 175, 55, 0.4);
}

.gallery-thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-thumb:hover img {
    transform: scale(1.05);
}

/* === ANIMATIONS === */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.gallery-main-image {
    animation: fadeIn 0.3s ease;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .gallery-main-image {
        height: 500px;
    }
}

@media (max-width: 768px) {
    .gallery-main-image {
        height: 400px;
    }
    
    .gallery-thumbs {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 0.75rem;
    }
    
    .gallery-thumb {
        min-width: 60px;
    }
}

@media (max-width: 480px) {
    .gallery-main-image {
        height: 300px;
        border-radius: 8px;
    }
    
    .gallery-thumbs {
        display: flex;
        overflow-x: auto;
        gap: 0.5rem;
        scroll-snap-type: x mandatory;
    }
    
    .gallery-thumb {
        flex: 0 0 60px;
        scroll-snap-align: center;
    }
}

/* === ÉTAT DE CHARGEMENT === */
.gallery-main-image.loading {
    opacity: 0.5;
    pointer-events: none;
}

.gallery-main::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #d4af37;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    opacity: 0;
    pointer-events: none;
}

.gallery-main.loading::after {
    opacity: 1;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* === PLEIN ÉCRAN (BONUS) === */
.gallery-fullscreen-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.gallery-fullscreen-btn:hover {
    background: white;
    transform: scale(1.1);
}

.gallery-fullscreen-btn svg {
    width: 20px;
    height: 20px;
    color: #1a1a1a;
}

/* === ACCESSIBILITÉ === */
.gallery-arrow:focus,
.gallery-thumb:focus {
    outline: 3px solid #d4af37;
    outline-offset: 2px;
}

/* === MODE SOMBRE === */
@media (prefers-color-scheme: dark) {
    .gallery-main {
        background: #1a1a1a;
    }
    
    .gallery-main-image {
        background: #1a1a1a;
    }
    
    .gallery-arrow {
        background: rgba(30, 30, 30, 0.95);
    }
    
    .gallery-arrow svg {
        color: white;
    }
    
    .gallery-arrow:hover {
        background: #1a1a1a;
    }
    
    .gallery-thumbs::-webkit-scrollbar-track {
        background: #2a2a2a;
    }
}

/* === PERFORMANCE === */
.gallery-main-image,
.gallery-thumb img {
    will-change: transform, opacity;
}
