/* ═══════════════════════════════════════════════════════════
   MODAL MODERNE - Version Complète avec Zoom & Pan
   ═══════════════════════════════════════════════════════════ */

/* FOND DE LA MODAL */
.modal {
    display: none;
    position: fixed !important;
    z-index: 2147483647 !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0, 0, 0, 0.6);
    pointer-events: auto !important;
}

/* CONTENU DE LA MODAL */
.modal-content {
    position: absolute !important;
    background: #1a1a1a;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    pointer-events: auto !important;
}

/* HEADER */
.modal-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #3498db;
    cursor: move;
    user-select: none;
}

.modal-title {
    color: white;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

/* CONTRÔLES DU HEADER */
.modal-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.zoom-indicator {
    color: white;
    font-size: 14px;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    min-width: 50px;
    text-align: center;
    font-weight: bold;
}

.btn-reset {
    background: rgba(52, 152, 219, 0.8);
    border: 1px solid rgba(52, 152, 219, 1);
    color: white;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    padding: 5px 12px;
    border-radius: 5px;
    transition: all 0.2s ease;
}

.btn-reset:hover {
    background: rgba(41, 128, 185, 1);
    transform: translateY(-1px);
}

/* BOUTON FERMER */
.modal .close {
    background: rgba(231, 76, 60, 0.8);
    border: none;
    color: white;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    padding: 2px 10px;
    border-radius: 6px;
    line-height: 1;
    transition: all 0.2s ease;
}

.modal .close:hover {
    background: rgba(192, 57, 43, 1);
    transform: scale(1.1);
}

/* BODY - Zone de l'image */
.modal-body {
    background: #000;
    width: 100%;
    height: calc(100% - 48px);
    overflow: hidden;
    position: relative;
    cursor: grab;
}

.modal-body.panning {
    cursor: grabbing !important;
}

.modal-body img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transform-origin: center center;
    transition: transform 0.1s ease-out;
    user-select: none;
    pointer-events: none;
    max-width: none;
    max-height: none;
}

/* POIGNÉES DE REDIMENSIONNEMENT */
.resize-handle {
    position: absolute;
    background: rgba(52, 152, 219, 0.7);
    transition: background 0.2s ease;
    z-index: 10;
}

.resize-handle:hover {
    background: rgba(52, 152, 219, 1);
}

/* Coins */
.resize-nw {
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    cursor: nw-resize;
    border-top-left-radius: 12px;
}

.resize-ne {
    top: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: ne-resize;
    border-top-right-radius: 12px;
}

.resize-sw {
    bottom: 0;
    left: 0;
    width: 20px;
    height: 20px;
    cursor: sw-resize;
    border-bottom-left-radius: 12px;
}

.resize-se {
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: se-resize;
    border-bottom-right-radius: 12px;
}

/* Bords */
.resize-n {
    top: 0;
    left: 20px;
    right: 20px;
    height: 8px;
    cursor: n-resize;
}

.resize-s {
    bottom: 0;
    left: 20px;
    right: 20px;
    height: 8px;
    cursor: s-resize;
}

.resize-e {
    right: 0;
    top: 20px;
    bottom: 20px;
    width: 8px;
    cursor: e-resize;
}

.resize-w {
    left: 0;
    top: 20px;
    bottom: 20px;
    width: 8px;
    cursor: w-resize;
}

/* Responsive */
@media (max-width: 768px) {
    .modal-content {
        width: 95vw !important;
        height: 90vh !important;
        max-width: none !important;
    }
    
    .modal-title {
        font-size: 14px;
    }
    
    .zoom-indicator {
        font-size: 12px;
        padding: 3px 8px;
    }
    
    .btn-reset {
        font-size: 11px;
        padding: 3px 8px;
    }
    
    /* Coins plus grands sur mobile */
    .resize-nw, .resize-ne, .resize-sw, .resize-se {
        width: 30px !important;
        height: 30px !important;
    }
    
    /* Bords plus larges sur mobile */
    .resize-n, .resize-s {
        height: 15px !important;
    }
    
    .resize-e, .resize-w {
        width: 15px !important;
    }
}
