/**
 * Styles pour la popup frontend
 * Fichier: assets/css/popup-frontend.css
 */

/* Overlay de la popup */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 999999; /* Z-index très élevé pour WordPress */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(2px); /* Effet de flou moderne */
}

.popup-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Container de la popup */
.popup-container {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 90vw;
    max-height: 90vh;
    transform: scale(0.8) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.popup-overlay.show .popup-container {
    transform: scale(1) translateY(0);
}

/* Image A5 - Dimensions optimisées */
.popup-image {
    width: 420px; /* Format A5 : 148mm ≈ 420px */
    height: 595px; /* Format A5 : 210mm ≈ 595px */
    object-fit: cover;
    border-radius: 12px;
    cursor: pointer;
    display: block;
    transition: transform 0.3s ease, filter 0.3s ease;
    user-select: none;
}

.popup-image:hover {
    transform: scale(1.02);
    filter: brightness(1.05);
}

.popup-image:active {
    transform: scale(0.98);
}

/* Bouton de fermeture amélioré */
.popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #ff4757, #ff3838);
    color: white;
    border: 3px solid white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.4);
    z-index: 1000000;
}

.popup-close:hover {
    background: linear-gradient(135deg, #ff3838, #ff2929);
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 6px 20px rgba(255, 71, 87, 0.6);
}

.popup-close:active {
    transform: scale(0.95);
}

.popup-close:focus {
    outline: 2px solid #ff4757;
    outline-offset: 2px;
}

/* Accessibilité - Classe pour masquer visuellement mais garder pour les lecteurs d'écran */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Animations d'entrée */
@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-100px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.popup-container.animate-slide {
    animation: slideInFromTop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.popup-container.animate-fade {
    animation: fadeInScale 0.4s ease-out;
}

/* Responsive Design optimisé */
@media screen and (max-width: 768px) {
    .popup-image {
        width: 300px;
        height: 425px;
    }
    
    .popup-container {
        margin: 20px;
        border-radius: 16px;
    }
    
    .popup-close {
        top: -8px;
        right: -8px;
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
}

@media screen and (max-width: 480px) {
    .popup-image {
        width: 250px;
        height: 354px;
    }
    
    .popup-container {
        margin: 15px;
        max-width: calc(100vw - 30px);
    }
    
    .popup-overlay {
        padding: 15px;
    }
}

@media screen and (max-width: 320px) {
    .popup-image {
        width: 210px;
        height: 297px;
    }
    
    .popup-container {
        margin: 10px;
    }
}

/* Écrans haute résolution (4K, Retina) */
@media screen and (min-width: 1920px) {
    .popup-image {
        width: 504px; /* 20% plus grand pour les écrans 4K */
        height: 714px;
    }
}

/* Mode sombre (si le thème WordPress le supporte) */
@media (prefers-color-scheme: dark) {
    .popup-container {
        background: #2d2d2d;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    }
}

/* Réduction de mouvement pour l'accessibilité */
@media (prefers-reduced-motion: reduce) {
    .popup-overlay,
    .popup-container,
    .popup-image,
    .popup-close {
        transition: none !important;
        animation: none !important;
    }
}

/* Amélioration du contraste pour l'accessibilité */
@media (prefers-contrast: high) {
    .popup-overlay {
        background-color: rgba(0, 0, 0, 0.9);
    }
    
    .popup-close {
        border-width: 4px;
        font-weight: 900;
    }
}

/* Styles pour les écrans tactiles */
@media (hover: none) and (pointer: coarse) {
    .popup-image:hover {
        transform: none;
        filter: none;
    }
    
    .popup-close:hover {
        transform: scale(1.1);
        background: linear-gradient(135deg, #ff3838, #ff2929);
    }
    
    /* Zone de touche plus grande sur mobile */
    .popup-close {
        width: 44px;
        height: 44px;
        top: -16px;
        right: -16px;
    }
}

/* Compatibilité avec les thèmes WordPress populaires */
.popup-overlay {
    font-family: inherit;
}

/* S'assurer que la popup reste au-dessus des éléments WordPress courants */
.popup-overlay {
    z-index: 999999;
}

/* Styles spécifiques pour éviter les conflits avec les thèmes */
.popup-overlay * {
    box-sizing: border-box;
}

.popup-container {
    line-height: 1;
    font-size: 16px;
}

/* Animation de sortie */
.popup-overlay.hiding {
    opacity: 0;
    visibility: hidden;
}

.popup-overlay.hiding .popup-container {
    transform: scale(0.8) translateY(20px);
}