/* ==========================================================================
   ECOPHOT - SYSTÈME DE MODALES ET OVERLAYS UNIFIÉ
   Fichier: 03-components/modals.css
   ========================================================================== */

/* ==========================================================================
   MODAL DE BASE
   ========================================================================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 10px;
    padding: 30px;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Bouton de fermeture */
.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #666;
    font-size: 28px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 5px;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-modal:hover {
    background: #f0f0f0;
    color: #333;
    transform: scale(1.1);
}

/* ==========================================================================
   MODAL CSS PERSONNALISÉE
   ========================================================================== */

.css-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.css-modal.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.css-modal-content {
    background: white;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    transform: scale(0.8);
    transition: transform 0.3s ease;
}


.css-modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-radius: 10px 10px 0 0;
}

.css-modal-header h3 {
    margin: 0;
    color: var(--primary);
    font-size: 1.3rem;
}

.css-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.css-modal-close:hover {
    color: #333;
    background: #e0e0e0;
}

.css-modal-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.css-modal-footer {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    background: #f8f9fa;
    border-radius: 0 0 10px 10px;
}

/* ==========================================================================
   LIGHTBOX POUR IMAGES
   ========================================================================== */

.image-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 9999;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-lightbox.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 1;
}

.image-lightbox img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    cursor: default;
    animation: imageZoomIn 0.3s ease;
}

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

.close-lightbox {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    cursor: pointer;
    background: rgba(0,0,0,0.5);
    border: none;
    padding: 10px;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-lightbox:hover {
    background: rgba(0,0,0,0.8);
    transform: scale(1.1);
}

/* Navigation dans lightbox */

.modal-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    padding: 20px;
    font-size: 30px;
    cursor: pointer;
    border-radius: 5px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    right: 20px;

}

.modal-prev:hover,
.modal-next:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-50%) scale(1.1);
}

.modal-prev {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    left: 10px;
    padding: 15px;
    font-size: 24px;
}


.modal-caption {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    text-align: center;
    background: rgba(0,0,0,0.7);
    padding: 15px 25px;
    border-radius: 25px;
    font-size: 1.1rem;
    max-width: 80%;
    backdrop-filter: blur(10px);
}

/* ==========================================================================
   OVERLAY GÉNÉRAL
   ========================================================================== */

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Overlay pour galeries */
.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: inherit;
    opacity: 1;
}

.gallery-image:hover ,
.gallery-item:hover  {
    opacity: 1;
}

.overlay-content {
    text-align: center;
    color: white;
    padding: 20px;
}

.overlay-content h3 {
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.overlay-content p {
    margin-bottom: 15px;
    opacity: 0.9;
}

.view-btn {
    background: var(--primary);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.3s ease;
}

.view-btn:hover {
    background: #0d5bbc;
    transform: translateY(-2px);
}

/* ==========================================================================
   MODAL OVERLAY SPÉCIALISÉ
   ========================================================================== */

.model-overlay,
.project-view-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: inherit;
    opacity: 1;
    animation: overlayFadeIn 0.3s ease;
}
.project-view-overlay {
    opacity: 1;
    animation: overlayFadeIn 0.3s ease;
}

/* ==========================================================================
   CONFIG OVERLAY
   ========================================================================== */

#config-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.config-overlay-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease;
}

.config-overlay-content h3 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.config-overlay-content p {
    margin: 10px 0;
    color: #555;
    line-height: 1.6;
}

/* ==========================================================================
   MODAL PLEIN ÉCRAN
   ========================================================================== */

.fullscreen-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 10000;
    display: none;
    flex-direction: column;
}

.fullscreen-modal.active {
    display: flex;
}

.fullscreen-header {
    background: var(--primary);
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.fullscreen-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.fullscreen-close {
    background: rgba(255,255,255,0.1);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.fullscreen-close:hover {
    background: rgba(255,255,255,0.2);
}

.fullscreen-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* ==========================================================================
   NOTIFICATIONS
   ========================================================================== */

.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: white;
    padding: 15px 25px;
    border-radius: 25px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    z-index: 10001;
    opacity: 0;
    transition: all 0.3s ease;
    font-weight: 500;
    min-width: 200px;
    text-align: center;
}

.notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.notification-success {
    border-left: 4px solid #28a745;
    color: #155724;
}

.notification-error {
    border-left: 4px solid #dc3545;
    color: #721c24;
}

.notification-info {
    border-left: 4px solid #17a2b8;
    color: #0c5460;
}

.notification-warning {
    border-left: 4px solid #ffc107;
    color: #856404;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 768px) {
    .modal-content {
        margin: 10px;
        max-width: calc(100% - 20px);
        max-height: calc(100% - 20px);
        padding: 20px;
    }

    .css-modal-content {
        width: 95%;
        max-height: 90vh;
        margin: 10px;
    }

    .css-modal-header,
    .css-modal-footer {
        padding: 15px;
    }

    .css-modal-body {
        padding: 15px;
    }

    #annotation-config-panel {
        width: calc(100% - 40px);
        right: 20px;
        left: 20px;
        top: 20px;
        max-height: 70vh;
    }

    .config-content {
        max-height: 300px;
    }

    .close-lightbox {
        top: 10px;
        right: 15px;
        font-size: 30px;
        width: 50px;
        height: 50px;
    }

    .modal-next {
        padding: 15px;
        font-size: 24px;
    }

    .modal-next {
        right: 10px;
    }

    .modal-caption {
        bottom: 10px;
        max-width: 90%;
        font-size: 1rem;
        padding: 10px 15px;
    }

    .notification {
        width: 90%;
        max-width: 300px;
        left: 50%;
        transform: translateX(-50%) translateY(-80px);
        padding: 12px 20px;
        font-size: 0.9rem;
    }

    .notification.show {
        transform: translateX(-50%) translateY(0);
    }
}

@media (max-width: 480px) {
    .modal-content {
        padding: 15px;
        margin: 5px;
        max-width: calc(100% - 10px);
        max-height: calc(100% - 10px);
    }

    .css-modal-content {
        width: 98%;
        height: 95vh;
    }

    .close-modal {
        top: 10px;
        right: 10px;
        font-size: 24px;
        width: 30px;
        height: 30px;
    }

    .fullscreen-header {
        padding: 15px 20px;
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

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

    .fullscreen-content {
        padding: 10px;
    }

    .config-header {
        padding: 12px 15px;
    }

    .config-content {
        padding: 15px;
        max-height: 250px;
    }
}

/* ==========================================================================
   ANIMATIONS SUPPLÉMENTAIRES
   ========================================================================== */

/* Animation de fade pour les overlays */
@keyframes overlayFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.gallery-overlay {
    animation: overlayFadeIn 0.3s ease;
}

/* Animation de glissement pour les notifications */
@keyframes notificationSlide {
    from {
        transform: translateX(-50%) translateY(-100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Animation de rotation pour le bouton de fermeture */
@keyframes rotateClose {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(180deg);
    }
}

.close-modal:hover,
.css-modal-close:hover,
.close-lightbox:hover {
    animation: rotateClose 0.3s ease;
}

/* ==========================================================================
   ACCESSIBILITÉ
   ========================================================================== */

/* Focus visible pour les éléments interactifs */
.close-modal:focus,
.css-modal-close:focus,
.close-lightbox:focus,
.modal-prev:focus,
.modal-next:focus,
.view-btn:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Réduction des animations pour les utilisateurs sensibles */
@media (prefers-reduced-motion: reduce) {
    .modal,
    .css-modal,
    .image-lightbox,
    .notification {
        transition: none;
    }
    
    .modal-content,
    .css-modal-content,
    .image-lightbox img {
        animation: none;
    }
    
    @keyframes modalSlideIn,
    @keyframes imageZoomIn,
    @keyframes overlayFadeIn,
    @keyframes notificationSlide,
    @keyframes rotateClose {
        from, to {
            transform: none;
            opacity: 1;
        }
    }
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
    .modal,
    .css-modal,
    .image-lightbox,
    .overlay,
    .notification,
    #annotation-config-panel {
        display: none !important;
    }
}