/* Style global de la fenêtre modale */
.pixelmosaic-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7); /* Fond noir plus doux */
    z-index: 9998;
}

.pixelmosaic-modal-content {
    position: fixed;
    top: 2.5%; left: 5%; width: 90%; height: 95%;
    background: #fff;
    z-index: 9999;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    overflow: hidden; /* Important pour le scroll intérieur */
    text-align: center;
    font-family: Arial, sans-serif;
    display: flex; /* Permet un layout intelligent */
    flex-direction: column;
}

/* Le titre de la modale */
.pixelmosaic-modal-content h2 {
    color: #2cb3ff;
    font-weight: bold;
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 1.6rem;
}

/* Le bouton fermer (X) */
.pixelmosaic-close {
    position: absolute;
    top: 15px; right: 20px;
    font-size: 30px;
    background: none; border: none; cursor: pointer;
    color: #333;
    z-index: 10000;
}

/* --- LA ZONE PRINCIPALE DE L'ATELIER (SCRollable) --- */
.pixelmosaic-atelier-area {
    flex: 1; /* Prend tout l'espace disponible */
    overflow-y: auto; /* Active le scroll intérieur vertical */
    padding-right: 15px; /* Petit espace pour la barre de scroll */
}

/* Zone interactive de recadrage - BLINDEE et PROPRE */
#cropper-container {
    display: none;
    width: 100%;
    height: 400px;
    min-height: 400px;
    max-height: 400px;
    margin-bottom: 20px;
    
    /* CORRECTION ICI : On enlève le fond noir cuadrillé ! */
    background-color: #fdfdfd; /* Fond blanc propre */
    background-image: none !important;
    
    border: 1px solid #ddd;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
}

/* On s'assure que Cropper n'applique plus de fond bizarre */
.cropper-modal {
    background-color: rgba(0, 0, 0, 0.5); /* L'overlay autour du cadre */
    opacity: 1;
}
.cropper-bg {
    background-image: none !important;
}

/* Les contrôles (taille et boutons) */
#pixelmosaic-controls {
    display: none;
    margin: 20px 0;
    padding: 15px;
    background: #eef8ff;
    border: 1px solid #c9ebff;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

#mosaic-size {
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 1.1em;
}

/* Résultat final */
#pixelmosaic-canvas-container {
    display: none;
    text-align: center;
    margin-top: 20px;
}

#pixelmosaic-canvas {
    max-width: 100%; height: auto;
    border: 4px solid #333;
    border-radius: 6px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

/* Zone interactive d'upload initiale */
.pixelmosaic-upload-zone {
    margin: 40px auto;
    padding: 60px;
    border: 4px dashed #ccc;
    background: #fdfdfd;
    border-radius: 15px;
    max-width: 600px;
}

/* --- LA ZONE D'INSTRUCTIONS (AVEC SCROLL) --- */
.pixelmosaic-instructions {
    margin-top: 30px;
    padding: 20px;
    background: #fdfdfd;
    border: 1px solid #f0f0f0;
    border-radius: 10px;
    text-align: left;
    display: block; /* On l'affiche par défaut en bas */
}

.pixelmosaic-instructions h3 {
    margin-top: 0;
    color: #2cb3ff;
    font-size: 1.2rem;
    border-bottom: 2px solid #eef8ff;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.pixelmosaic-instructions-content {
    /* CORRECTION ICI : Hauteur fixe et scroll ! */
    max-height: 200px; /* Adapte cette hauteur selon tes besoins */
    overflow-y: auto; /* Active le scroll vertical si le texte est long */
    font-size: 0.95em;
    color: #666;
    line-height: 1.6;
    padding-right: 10px;
}

/* --- LES RÉGLAGES DE L'IMAGE (Curseurs) --- */
.pixelmosaic-adjustments {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.pixelmosaic-slider-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 150px;
}

.pixelmosaic-slider-group label {
    font-weight: bold;
    color: #555;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.pixelmosaic-slider {
    width: 100%;
    cursor: pointer;
}

.pixelmosaic-radio-group {
    display: flex;
    gap: 15px;
    align-items: center;
    background: #f9f9f9;
    padding: 10px 20px;
    border-radius: 20px;
    border: 1px solid #eee;
}

.pixelmosaic-radio-group label {
    cursor: pointer;
    font-weight: bold;
    margin: 0;
}

/* --- ÉCRAN 3 : LES OPTIONS DE FINALISATION --- */
#pixelmosaic-options-screen {
    display: none;
    text-align: left;
    max-width: 600px;
    margin: 0 auto;
}

.pixelmosaic-option-box {
    background: #fdfdfd;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.3s;
}

.pixelmosaic-option-box:hover {
    border-color: #2cb3ff;
    box-shadow: 0 4px 15px rgba(44, 179, 255, 0.1);
}

.pixelmosaic-option-box h4 {
    margin-top: 0;
    color: #333;
    font-size: 1.2rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.pixelmosaic-radio-option {
    display: flex;
    align-items: center;
    margin: 10px 0;
    font-size: 1.1rem;
    cursor: pointer;
}

.pixelmosaic-radio-option input {
    margin-right: 10px;
    transform: scale(1.2);
}

.pixelmosaic-price-tag {
    margin-left: auto;
    font-weight: bold;
    color: #2cb3ff;
}