/* ============================================
   CORESYSTEM - MODALS.CSS
   ============================================
   Styles généraux pour toutes les modals
   Contient les styles de base, animations, particules
   et boutons de fermeture pour toutes les modals
   ============================================ */

:root {
    /* Thème par défaut (Vert Slaizen) */
    --theme-primary: #31b086;
    --theme-primary-rgb: 49, 176, 134;
    --theme-secondary: #749d91;
    --theme-secondary-rgb: 116, 157, 145;
    --theme-glow: rgba(var(--theme-primary-rgb), 0.3);
}

/* ============================================
   STYLES UNIFIÉS POUR TOUTES LES MODALS
   ============================================ */

/* Style de base unifié pour toutes les modals */
.modal-base,
.modal {
    display: none;
    position: fixed;
    z-index: 200000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    min-height: 100%;
    background-color: rgba(12, 12, 13, 0.95);
    background-image: 
        repeating-linear-gradient(0deg, transparent, transparent 49px, rgba(var(--theme-primary-rgb), 0.15) 49px, rgba(var(--theme-primary-rgb), 0.15) 50px),
        repeating-linear-gradient(90deg, transparent, transparent 49px, rgba(var(--theme-primary-rgb), 0.15) 49px, rgba(var(--theme-primary-rgb), 0.15) 50px);
    background-size: 50px 50px;
    background-position: 0 0;
    animation: gridMove 10s linear infinite;
    box-shadow: 
        0 0 100px rgba(var(--theme-primary-rgb), 0.15),
        inset 0 0 200px rgba(var(--theme-primary-rgb), 0.05);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

/* Modal image utilise flex-start pour l'alignement */
.modal-base.image-modal,
.modal.image-modal {
    align-items: flex-start;
    z-index: 200002;
}

/* Permettre des images plus grandes dans la modal d'image */
.modal.image-modal .modal-content {
    max-width: none;
    width: auto;
    /* Permettre au conteneur de s'adapter à la taille de l'image */
    min-width: auto;
    padding: 20px;
}

/* Modal profil utilise flex-start pour éviter l'overflow en haut */
.modal-base#profile-modal,
.modal#profile-modal {
    align-items: flex-start;
    z-index: 200005; /* Au-dessus de la modal d'image */
}

/* Modal commentaires du profil utilise flex-start pour éviter l'overflow en haut */
.modal-base#profile-comments-modal,
.modal#profile-comments-modal {
    align-items: flex-start;
    padding-top: 40px;
    z-index: 200015; /* Au-dessus du profil */
}


/* Modal téléchargements du profil utilise flex-start pour éviter l'overflow en haut */
.modal-base#profile-downloads-modal,
.modal#profile-downloads-modal {
    align-items: flex-start;
    padding-top: 40px;
    z-index: 200016; /* Au-dessus du profil */
}



/* Particules flottantes dans les modals */
.modal-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(var(--theme-primary-rgb), 0.6);
    border-radius: 50%;
    box-shadow: 
        0 0 4px rgba(var(--theme-primary-rgb), 0.8),
        0 0 8px rgba(var(--theme-primary-rgb), 0.4);
    animation: floatParticle linear infinite;
    opacity: 0;
}

@keyframes floatParticle {
    0% {
        opacity: 0;
        transform: translateY(100vh) translateX(0) scale(0);
    }
    10% {
        opacity: 1;
        transform: translateY(90vh) translateX(10px) scale(1);
    }
    90% {
        opacity: 1;
        transform: translateY(10vh) translateX(-10px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(0) translateX(0) scale(0);
    }
}

/* Animations unifiées pour toutes les modals */
.modal-base.active,
.modal-base.show,
.modal.active,
.modal.show {
    display: flex;
    pointer-events: auto;
    opacity: 1;
    animation: gridMove 10s linear infinite, modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

.modal-base.closing,
.modal.closing {
    display: flex;
    animation: modalFadeOut 0.3s ease-in forwards;
}

@keyframes modalFadeOut {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* Wrapper unifié pour le contenu des modals */
.modal-content {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
    max-width: 90%;
    width: auto;
    height: auto;
    min-width: 300px;
    max-height: none;
    background: linear-gradient(135deg, rgba(var(--theme-primary-rgb), 0.25) 0%, rgba(var(--theme-secondary-rgb), 0.2) 50%, rgba(var(--theme-primary-rgb), 0.25) 100%);
    border-radius: 10px;
    padding: 30px;
    margin: 20px auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    border: 2px solid var(--theme-primary);
    box-shadow: 
        0 0 30px rgba(var(--theme-primary-rgb), 0.3),
        0 0 60px rgba(var(--theme-secondary-rgb), 0.2),
        inset 0 0 30px rgba(var(--theme-primary-rgb), 0.1),
        inset 0 0 0 2px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    animation: hologramPulse 3s ease-in-out infinite, crtFlicker 0.15s infinite;
    overflow: visible;
    flex-shrink: 0;
}

.modal-base.active .modal-content,
.modal-base.show .modal-content,
.modal.active .modal-content,
.modal.show .modal-content {
    opacity: 1;
    transform: translateY(0) scale(1);
    animation: modalSlideIn 0.4s ease-out;
}

@keyframes modalSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-base.closing .modal-content,
.modal.closing .modal-content {
    animation: modalSlideOut 0.3s ease-in forwards;
}

@keyframes modalSlideOut {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
}

.modal-content::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(var(--theme-primary-rgb), 0.05) 2px,
        rgba(var(--theme-primary-rgb), 0.05) 4px
    );
    pointer-events: none;
    z-index: 0;
}

@keyframes gridMove {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 50px 50px;
    }
}

@keyframes gridZoomInfinite {
    0% {
        background-size: 50px 50px;
        background-position: center center;
    }
    100% {
        background-size: 500px 500px;
        background-position: center center;
    }
}

@keyframes crtFlicker {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.98;
    }
}

@keyframes hologramPulse {
    0%, 100% {
        box-shadow: 
            0 0 30px rgba(var(--theme-primary-rgb), 0.3),
            0 0 60px rgba(var(--theme-secondary-rgb), 0.2),
            inset 0 0 30px rgba(var(--theme-primary-rgb), 0.1),
            inset 0 0 0 2px rgba(0, 0, 0, 0.3);
        border-color: var(--theme-primary);
    }
    50% {
        box-shadow: 
            0 0 40px rgba(var(--theme-primary-rgb), 0.5),
            0 0 80px rgba(var(--theme-secondary-rgb), 0.3),
            inset 0 0 40px rgba(var(--theme-primary-rgb), 0.15),
            inset 0 0 0 2px rgba(0, 0, 0, 0.3);
        border-color: rgba(var(--theme-primary-rgb), 0.8);
    }
}

/* Bouton de fermeture unifié pour toutes les modals */
.modal-close,
.close-btn,
.close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 32px;
    font-weight: bold;
    color: rgba(var(--theme-primary-rgb), 0.9);
    cursor: pointer;
    z-index: 10001;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--theme-primary);
    box-shadow: 0 0 15px rgba(var(--theme-primary-rgb), 0.3);
    transition: all 0.3s;
}

.modal-close:hover,
.close-btn:hover,
.close:hover {
    background: rgba(var(--theme-primary-rgb), 0.2);
    color: var(--theme-primary);
    box-shadow: 0 0 25px rgba(var(--theme-primary-rgb), 0.6);
    border-color: rgba(var(--theme-primary-rgb), 0.9);
    transform: scale(1.1);
}

/* Modal image simple dédiée aux commentaires */
.modal.simple-image-modal {
    z-index: 200010;
    background-color: rgba(0, 0, 0, 0.85) !important; /* Fond plus sombre pour focus sur l'image */
    backdrop-filter: blur(8px);
}

.modal.simple-image-modal .modal-content {
    animation: simpleModalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes simpleModalPop {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@media (max-width: 768px) {
    .modal.simple-image-modal .modal-content {
        width: 95% !important;
        padding: 5px !important;
    }
    
    #close-simple-image-modal {
        top: -45px !important;
        right: 0 !important;
        width: 30px !important;
        height: 30px !important;
    }
}

/* Bouton de fermeture spécifique pour la modal d'image (Look Cinématique) */
.image-modal-close-fixed {
    position: fixed !important;
    top: 30px !important;
    right: 40px !important;
    width: 50px !important;
    height: 50px !important;
    font-size: 30px !important;
    font-weight: 300 !important;
    color: var(--theme-primary) !important;
    background: rgba(0, 0, 0, 0.7) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border: 2px solid var(--theme-primary) !important;
    border-radius: 50% !important;
    z-index: 2100000 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer !important;
    box-shadow: 0 0 20px rgba(var(--theme-primary-rgb), 0.4) !important;
    text-shadow: 0 0 10px rgba(var(--theme-primary-rgb), 0.8) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    line-height: 0.8 !important; /* Ajusté pour le caractère &times; */
    padding: 0 !important;
}

.image-modal-close-fixed:hover {
    background: rgba(var(--theme-primary-rgb), 0.3) !important;
    color: var(--theme-primary) !important;
    box-shadow: 0 0 40px rgba(var(--theme-primary-rgb), 0.9),
                inset 0 0 15px rgba(var(--theme-primary-rgb), 0.4) !important;
    transform: scale(1.1) rotate(90deg) !important;
}

@media (max-width: 768px) {
    .image-modal-close-fixed {
        top: 20px !important;
        right: 20px !important;
        width: 50px !important;
        height: 50px !important;
        font-size: 35px !important;
    }
}


