/* prettier-ignore */
/* Variables CSS pour le thÃ¨me */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --dark-bg: #0f0f23;
    --card-bg: rgba(255, 255, 255, 0.05);
    --glass-bg: rgba(255, 255, 255, 0.1);
    --border-glass: rgba(255, 255, 255, 0.2);
    --text-primary: #ffffff;
    --text-secondary: #b8c5d6;
    --accent-color: #00d4ff;
    --lego-red: #d50000;
    --lego-yellow: #ffc107;
    --lego-blue: #2196f3;
    --lego-green: #4caf50;
}

/* Reset et configuration de base */
* {
    box-sizing: border-box;
}

body {
    background: var(--dark-bg);
    background-image:
            radial-gradient(circle at 25% 25%, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
            radial-gradient(circle at 75% 75%, rgba(103, 126, 234, 0.1) 0%, transparent 50%);
        color: var(--text-primary);
        font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
        min-height: 100vh;
        overflow-x: hidden;
    }
    
    .container-fluid {
        max-width: 1400px;
        margin: 0 auto;
    }
    
    /* Header avec effet glassmorphism */
    .header-section {
        background: var(--glass-bg);
        backdrop-filter: blur(20px);
        border: 1px solid var(--border-glass);
        border-radius: 20px;
        margin: 20px 0;
        padding: 20px;
        position: relative;
        overflow: hidden;
    }
    
    .header-section::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 2px;
        background: var(--primary-gradient);
    }
    
    .main-title {
        background: var(--primary-gradient);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        font-weight: 800;
        font-size: clamp(1.5rem, 4vw, 2.5rem);
    margin: 0;
    text-align: center;
    letter-spacing: -0.02em;
}

/* Cards avec effet glassmorphism */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow:
        0 16px 48px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Boutons modernisÃ©s */
.modern-btn {
    background: var(--primary-gradient);
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    padding: 12px 24px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
}

.modern-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.modern-btn:hover::before {
    left: 100%;
}

.modern-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(103, 126, 234, 0.4);
}

.modern-btn.btn-success {
    background: var(--success-gradient);
}

.modern-btn.btn-success:hover {
    box-shadow: 0 8px 25px rgba(0, 242, 254, 0.4);
}

.modern-btn.btn-secondary {
    background: var(--secondary-gradient);
}

/* Inputs modernisÃ©s */
.modern-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    color: var(--text-primary);
    padding: 12px 16px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.modern-input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.2);
    outline: none;
    transform: translateY(-1px);
}

.modern-input::placeholder {
    color: var(--text-secondary);
}

/* Labels avec animation */
.modern-label {
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 8px;
    display: block;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ContrÃ´les de zoom stylisÃ©s */
.zoom-controls {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid var(--border-glass);
}

.zoom-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-gradient);
    border: none;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(103, 126, 234, 0.4);
}

/* Range slider personnalisÃ© */
.modern-range {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

.modern-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 212, 255, 0.4);
    transition: all 0.3s ease;
}

.modern-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.6);
}

/* Preview area */
.preview-area {
    min-height: 400px;
    height: auto;
    max-height: 1200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
}

.preview-area img {
    max-width: 100%;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.preview-area img:hover {
    transform: scale(1.02);
}

/* Checkboxes personnalisÃ©es */
.modern-checkbox {
    position: relative;
    display: inline-block;
}

.modern-checkbox input[type="checkbox"] {
    opacity: 0;
    position: absolute;
}

.modern-checkbox .checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 20px;
    width: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--border-glass);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.modern-checkbox input:checked~.checkmark {
    background: var(--accent-color);
    border-color: var(--accent-color);
}

.modern-checkbox .checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.modern-checkbox input:checked~.checkmark:after {
    display: block;
}

/* Position controls overlay - Nouvelle version */
.position-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* ContrÃ´les de position - disposition sur les bords */
.position-controls {
    position: relative;
    width: 100%;
    height: 100%;
    pointer-events: auto;
}

.position-btn {
    position: absolute;
    background: rgba(0, 212, 255, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    color: white;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(15px);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    }
    
    .position-btn:hover {
        transform: scale(1.15);
        background: rgba(0, 212, 255, 1);
        box-shadow: 0 6px 25px rgba(0, 212, 255, 0.5);
        border-color: rgba(255, 255, 255, 0.6);
    }
    
    .position-btn:active {
        transform: scale(0.95);
    }
    
    /* Positionnement des boutons sur les bords */
    .pos-up {
        top: 10px;
        left: 50%;
        /* transform: translateX(-50%); */
    }
    
    .pos-down {
        bottom: 10px;
        left: 50%;
        /* transform: translateX(-50%); */
    }
    
    .pos-left {
        left: 10px;
        top: 50%;
        /* transform: translateY(-50%); */
    }
    
    .pos-right {
        right: 10px;
        top: 50%;
        /* transform: translateY(-50%); */
    }
    
    .pos-center {
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: rgba(255, 255, 255, 0.3);
        width: 40px;
        height: 40px;
    }
    
    .pos-center:hover {
        background: rgba(255, 255, 255, 0.5);
        transform: translate(-50%, -50%) scale(1.1);
        box-shadow: 0 4px 20px rgba(255, 255, 255, 0.3);
    }
    
                                                                                                                                /* Affichage des contrÃ´les */
    .preview-container:hover .position-overlay {
        opacity: 1;
    }
    
    .position-overlay {
        opacity: 0.7;
    }
    
                                                                                                                                /* Style pour le conteneur de prÃ©visualisation */
    .preview-container {
        position: relative;
        display: inline-block;
        max-width: 100%;
        border-radius: 15px;
        overflow: hidden;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    }
    
                                                                                                                                /* Conteneur principal pour l'aperÃ§u avec contrÃ´les */
    .preview-main-container {
        display: flex;
        flex-direction: column;
        align-items: center;
    width: 100%;
}

/* ContrÃ´les de zoom au-dessus de l'aperÃ§u */
.preview-zoom-controls {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-glass);
    border-radius: 25px;
    padding: 8px 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.preview-zoom-controls .zoom-btn {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--accent-color);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.preview-zoom-controls .zoom-btn:hover {
    transform: scale(1.1);
    background: rgba(0, 212, 255, 1);
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.5);
}

.preview-zoom-controls .zoom-btn:active {
    transform: scale(0.95);
}

.zoom-indicator {
    font-size: 14px;
    font-weight: 600;
    min-width: 60px;
    text-align: center;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.preview-container img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 15px;
}

/* Indicateur de position actuelle */
.position-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
        font-size: 12px;
        font-weight: 500;
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.2);
        z-index: 15;
    }
    
                                                                                                                                /* Animation de pulse pour indiquer l'interactivitÃ© */
    @keyframes positionPulse {
    
        0%,
        100% {
            opacity: 0.7;
        }
    
        50% {
            opacity: 1;
        }
    }
    
    .preview-container:not(:hover) .position-btn {
        /* animation: positionPulse 2s infinite; */
    }
    
    /* Colors section */
    .colors-section {
        background: rgba(255, 255, 255, 0.03);
        border-radius: 15px;
        border: 1px solid var(--border-glass);
        backdrop-filter: blur(10px);
    }
    
    .color-item {
        transition: all 0.3s ease;
        border-radius: 10px;
        position: relative;
        overflow: hidden;
    }
    
    .color-item:hover {
        transform: translateX(5px);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    }
    
                                                                                                                                /* Settings button avec effet nÃ©on */
    .settings-btn {
        background: transparent;
        border: 2px solid var(--accent-color);
        border-radius: 12px;
        color: var(--accent-color);
        padding: 12px;
        transition: all 0.3s ease;
        position: relative;
        overflow: hidden;
    }
    
    .settings-btn::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: var(--accent-color);
        transition: left 0.3s ease;
        z-index: -1;
    }
    
    .settings-btn:hover::before {
        left: 0;
    }
    
    .settings-btn:hover {
        color: var(--dark-bg);
        box-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
    }
    
                                                                                                                                /* Modal modernisÃ© */
    .modal-content {
        background: var(--glass-bg);
        backdrop-filter: blur(20px);
        border: 1px solid var(--border-glass);
        border-radius: 20px;
    }
    
    .modal-header {
        border-bottom: 1px solid var(--border-glass);
        background: linear-gradient(90deg, var(--accent-color), var(--primary-gradient));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    
    /* Animations */
    .fade-in {
        animation: fadeIn 0.6s ease-out;
    }
    
    @keyframes fadeIn {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
    
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    .floating {
        animation: floating 3s ease-in-out infinite;
    }
    
    @keyframes floating {
    
        0%,
        100% {
            transform: translateY(0px);
        }
    
        50% {
            transform: translateY(-10px);
        }
    }
    
    @keyframes spin {
        0% {
            transform: rotate(0deg);
        }
    
        100% {
            transform: rotate(360deg);
        }
}

@keyframes fadeInLoader {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                to {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    opacity: 1;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    transform: scale(1);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                }
}

/* Glow effects */
.glow {
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

/* Styles pour Ã©lÃ©ments existants prÃ©servÃ©s */
.star {
    position: absolute;
    top: 3px;
    right: 5px;
    font-size: 1.2em;
    line-height: 1;
    color: #e4ff00;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}

.btn-zoom {
    width: 30px;
    height: 30px;
}

#rangeValue {
    top: -15px;
}

.input-position {
    width: 60px;
}

/* Loader pour l'aperÃ§u */
/*  Styles sÃ©parÃ©s selon le contexte */
.preview-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 15px;
    animation: fadeInLoader 0.3s ease-out;
    background: rgba(15, 15, 35, 0.95);
    backdrop-filter: blur(10px);
}

/* Loader plein Ã©cran (premiÃ¨re fois) */
.preview-loader.fullscreen-loader {
    position: static;
    width: 100%;
    min-height: 400px;
    border-radius: 20px;
}

/* Loader en overlay (aperÃ§us suivants) */
.preview-loader.overlay-loader {
    position: absolute !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 15px;
    z-index: 1001;
    background: rgba(15, 15, 35, 0.5);
}

/* .preview-area .preview-loader {
    position: static;
    min-height: 400px;
    border-radius: 20px;
} */

.loader-content {
    text-align: center;
    color: var(--text-primary);
}

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(0, 212, 255, 0.2);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

.loader-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.loader-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Responsive design amÃ©liorÃ© */
@media (max-width: 768px) {
    .container-fluid {
        padding: 10px;
    }

    .glass-card {
        margin-bottom: 20px;
    }

    .main-title {
        font-size: 1.8rem;
    }

    .position-btn {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }

    .pos-center {
        width: 30px;
        height: 30px;
    }
}

/* ============================================
   RESPONSIVE STYLES - EDITOR & CANVAS
   ============================================ */

/* Canvas responsive wrapper */
.canvas-wrapper {
    overflow: auto;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 10px;
    max-width: 100%;
    max-height: calc(100vh - 300px);
}

.canvas-wrapper canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    max-width: 100%;
    height: auto !important;
    display: block;
    margin: 0 auto;
}

/* Preview area responsive */
.preview-area {
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

/* Tablettes et petits écrans (≤ 992px) */
@media (max-width: 992px) {


    /* Ajuster la taille du canvas */
    .canvas-wrapper {
        max-height: 60vh;
    }

    /* Logo plus petit */
    .logo {
        width: 140px !important;
    }

    /* Boutons header plus compacts */
    .px-4 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}

/* Mobile (≤ 768px) */
@media (max-width: 768px) {

    /* Navigation header en colonne */
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 1rem;
        align-items: center !important;
    }

    .text-start,
    .text-end {
        text-align: center !important;
        width: 100%;
        min-width: auto !important;
    }

    /* Logo centré */
    .flex-grow-1 {
        width: 100%;
    }

    .logo {
        width: 120px !important;
    }

    /* Nom du projet */
    #projectNameDisplay {
        margin-top: 0.5rem;
    }

    #projectNameBadge {
        font-size: 0.9rem !important;
    }

    /* Canvas adapté mobile */
    .canvas-wrapper {
        max-height: 50vh;
        padding: 5px;
    }

    .preview-area {
        min-height: 300px;
        padding: 1rem;
    }

    /* Formulaire plus compact */
    .glass-card {
        padding: 1.5rem !important;
    }

    /* Labels plus petits */
    .modern-label {
        font-size: 0.9rem;
    }

    /* Inputs plus compacts */
    .modern-input {
        font-size: 0.9rem;
        padding: 0.5rem;
    }

    /* Boutons zoom */
    .zoom-btn {
        width: 35px;
        height: 35px;
        font-size: 1.2rem;
    }

    /* Contrôles de position */
    .zoom-controls .row {
        gap: 0.5rem !important;
    }

    /* Boutons d'action en colonnes */
    .d-flex.gap-2.mb-4 {
        flex-direction: column;
    }

    .modern-btn {
        width: 100% !important;
    }

    /* Section couleurs utilisées */
    .colors-section {
        padding: 1rem !important;
    }

    #previewColorList {
        gap: 0.3rem !important;
    }

    /* Badges de couleur plus petits */
    .color-badge {
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
    }

    /* Modal couleurs */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem) !important;
    }

    .color-swatch {
        min-width: 45px;
        height: 45px;
        font-size: 0.85rem;
    }
}

/* Très petits mobiles (≤ 480px) */
@media (max-width: 480px) {

    /* Header encore plus compact */
    .px-4 {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    .py-3 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }

    /* Logo */
    .logo {
        width: 100px !important;
    }

    /* Boutons header empilés */
    .btn-sm {
        font-size: 0.75rem;
        padding: 0.4rem 0.6rem;
    }

    /* Canvas très compact */
    .canvas-wrapper {
        max-height: 40vh;
        padding: 3px;
    }

    /* Formulaire très compact */
    .glass-card {
        padding: 1rem !important;
        border-radius: 15px;
    }

    /* Range slider */
    .modern-range {
        height: 4px;
    }

    /* Checkboxes */
    .modern-checkbox label {
        font-size: 0.85rem;
    }

    .checkmark {
        width: 18px;
        height: 18px;
    }


    /* Color swatches */
    .color-swatch {
        min-width: 40px;
        height: 40px;
        font-size: 0.8rem;
    }
}

/* Landscape mobile */
@media (max-width: 896px) and (orientation: landscape) {
    .canvas-wrapper {
        max-height: 70vh;
    }

    .preview-area {
        min-height: 250px;
    }
}

/* Mode éditeur responsive */
@media (max-width: 768px) {

    /* Palette de couleurs adaptée */
    #colorPaletteGrid {
        grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)) !important;
        gap: 0.3rem !important;
    }

    /* Contrôles éditeur */
    #editorControls {
        flex-direction: column;
        gap: 0.5rem;
    }

    #editorControls .btn-group {
        width: 100%;
    }

    #editorControls .btn {
        font-size: 0.85rem;
        padding: 0.5rem;
    }

    /* Sélection couleur */
    #selectedColorPreview {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
}

/* Impression */
@media print {

    .btn,
    .modern-btn,
    nav,
    .modal {
        display: none !important;
    }

    .canvas-wrapper {
        max-height: none;
        overflow: visible;
    }

    .glass-card {
        border: none;
        box-shadow: none;
    }
}

/* ============================================
   FIX CANVAS - Toujours visible en entier
   ============================================ */

/* Amélioration du wrapper canvas pour s'assurer qu'il soit toujours visible */
.canvas-wrapper {
    overflow: auto !important;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 10px;
    max-width: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.canvas-wrapper canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    display: block;
    margin: 0 auto;
}

/* Preview area avec scroll si nécessaire */
.preview-area {
    min-height: 400px;
    max-height: 1200px;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

/* Styles pour les ajustements d'image */
.image-adjustments {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.adjustment-control .badge {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.75rem;
    min-width: 42px;
    text-align: center;
    background: rgba(103, 126, 234, 0.3) !important;
    border: 1px solid rgba(103, 126, 234, 0.4);
}

.adjustment-control .form-range::-webkit-slider-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(103, 126, 234, 0.4);
}

.image-adjustments .btn-outline-light:hover i {
    transform: rotate(-180deg);
}
/* ============================================
   BOUTONS TÉLÉCHARGER & GUIDE D'ASSEMBLAGE
   ============================================ */
#links-section {
    margin-top: 24px;
    padding: 20px;
    /* background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border: 1px solid var(--border-glass); */
}

#links-section p {
    margin: 0;
}

.action-buttons-container {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    border: none;
}

.action-btn-download {
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    color: white;
}

.action-btn-download:hover {
    color: white;
    text-decoration: none;
}

.action-btn-guide {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.action-btn-guide:hover {
    color: white;
    text-decoration: none;
}

.action-btn i {
    font-size: 1.1rem;
}
/* Desktop - Formulaire à gauche, Canvas à droite (ordre par défaut) */
@media (min-width: 993px) {


    .preview-area {
        /* max-height: calc(100vh - 250px); */
        max-height: 1200px;
    }

    .canvas-wrapper {
        max-height: calc(100vh - 280px);
    }
}

/* Ajustements pour que le canvas soit toujours proportionné */
@media (max-width: 992px) {
    .preview-area {
        max-height: 70vh;
    }

    .canvas-wrapper {
        max-height: 65vh;
    }
}

@media (max-width: 768px) {
    .preview-area {
        max-height: 60vh;
    }

    .canvas-wrapper {
        max-height: 55vh;
    }
}

@media (max-width: 480px) {
    .preview-area {
        max-height: 50vh;
    }

    .canvas-wrapper {
        max-height: 45vh;
    }
}

/* ============================================
   ORDRE DES COLONNES - Formulaire toujours en premier visuellement
   ============================================ */

/* Sur desktop, les colonnes s'affichent côte à côte avec formulaire à gauche */
@media (min-width: 993px) {
    .row.g-4 {
        display: flex;
        flex-direction: row;
    }

    .order-1 {
        order: 1 !important;
    }

    .order-2 {
        order: 2 !important;
    }
}

/* Sur tablette et mobile, formulaire en haut, canvas en bas */
@media (max-width: 992px) {
    .row.g-4 {
        display: flex;
        flex-direction: column;
    }

    .order-1 {
        order: 1 !important;
    }

    .order-2 {
        order: 2 !important;
    }

    /* Formulaire prend toute la largeur */
    .col-lg-3,
    .col-md-4 {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Canvas aussi */
    .col-lg-9,
    .col-md-8 {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* ============================================
   FIX FINAL - Canvas ne doit JAMAIS déborder
   ============================================ */

/* Forcer le canvas à respecter les limites du wrapper */
.canvas-wrapper {
    position: relative;
    overflow: hidden !important;
    /* Pas de scroll, le canvas doit rentrer */
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 20px;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

.canvas-wrapper canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    max-width: calc(100% - 40px) !important;
    /* Respecter le padding */
        max-height: calc(100% - 40px) !important;
        width: auto !important;
        height: auto !important;
        display: block;
        margin: 0 auto;
        object-fit: contain;
    }
    
    /* Preview area doit avoir une hauteur définie */
    .preview-area {
        position: relative;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Hauteurs fixes par breakpoint pour éviter les débordements */
    @media (min-width: 993px) {
        .preview-area {
            /* height: calc(100vh - 250px); */
            min-height: 400px;
        }
    
        .canvas-wrapper {
            height: 100%;
            max-height: calc(100vh - 280px);
        }
    }
    
    @media (max-width: 992px) {
        .preview-area {
            height: 70vh;
            min-height: 300px;
        }
    
        .canvas-wrapper {
            height: 100%;
            max-height: 65vh;
        }
    }
    
    @media (max-width: 768px) {
        .preview-area {
            height: 60vh;
            min-height: 250px;
        }
    
        .canvas-wrapper {
            height: 100%;
            max-height: 55vh;
        }
    }
    
    @media (max-width: 480px) {
        .preview-area {
            height: 50vh;
            min-height: 200px;
        }
    
        .canvas-wrapper {
            height: 100%;
            max-height: 45vh;
        }
    }
    
    
.colors-section {
    transition: all 0.3s ease;
}
.color-section-header {
    cursor: pointer;
    user-select: none;
    padding: 5px;
    border-radius: 8px;
    transition: background 0.2s;
    flex-direction: row !important;
}
.color-section-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.toggle-btn {
    border: none !important;
    padding: 4px 8px !important;
    background: transparent !important;
    transition: transform 0.3s ease;
}

.toggle-btn i {
    font-size: 1rem;
    transition: transform 0.3s ease;
}

.toggle-btn.collapsed i {
    transform: rotate(180deg);
}

.color-list-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    transition: all 0.3s ease;
    overflow: hidden;
    max-height: 2000px;
}

.color-list-wrapper.collapsed {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
}

/* Badges de couleur - Design amélioré */
.color-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    font-size: 0.85rem;
        transition: all 0.2s;
        flex: 1 1 auto;
        min-width: 120px;
    }
    
    .color-badge:hover {
        background: rgba(255, 255, 255, 0.15);
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    }
    
    .color-badge-swatch {
        width: 24px;
        height: 24px;
        border-radius: 4px;
        border: 2px solid rgba(255, 255, 255, 0.3);
        flex-shrink: 0;
    }
    
    .color-badge-info {
        display: flex;
        flex-direction: column;
        gap: 2px;
        flex: 1;
    }
    
    .color-badge-id {
        font-weight: bold;
        font-size: 0.9rem;
    }

.color-badge-count {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Desktop - 1 colonne */
@media (min-width: 769px) {
    .color-list-wrapper {
        flex-direction: column;
    }

        .color-badge {
            width: 100%;
        }
        }
        
                /* Mobile - 2 colonnes */
@media (max-width: 768px) {
    .color-list-wrapper {
        /* display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 6px;
                */
        }
        
        .color-badge {
            flex-direction: column;
            text-align: center;
            padding: 10px 6px;
            min-width: auto;
            gap: 6px;
        }
        
        .color-badge-swatch {
            width: 32px;
            height: 32px;
            margin: 0 auto;
        }
        
        .color-badge-info {
            align-items: center;
            gap: 2px;
        }
        
        .color-badge-id {
            font-size: 0.85rem;
        }
        
        .color-badge-count {
            font-size: 0.7rem;
        }
        
        /* Section repliée par défaut sur mobile */
        .colors-section.mobile-collapsed .color-list-wrapper {
            max-height: 0;
            opacity: 0;
        }
        
        .colors-section.mobile-collapsed .toggle-btn i {
            transform: rotate(180deg);
        }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                }
.color-badge {
    animation: fadeInUp 0.3s ease;
}

/* Stagger l'animation des badges */
.color-badge:nth-child(1) {
    animation-delay: 0s;
}

.color-badge:nth-child(2) {
    animation-delay: 0.05s;
}

.color-badge:nth-child(3) {
    animation-delay: 0.1s;
}

.color-badge:nth-child(4) {
    animation-delay: 0.15s;
}

.color-badge:nth-child(5) {
    animation-delay: 0.2s;
}

.color-badge:nth-child(n+6) {
    animation-delay: 0.25s;
}
/* Très petit mobile - Badges encore plus compacts */
@media (max-width: 480px) {
    .color-badge {
        padding: 8px 4px;
    }

    .color-badge-swatch {
        width: 28px;
        height: 28px;
    }

    .color-badge-id {
        font-size: 0.8rem;
    }

    .color-badge-count {
        font-size: 0.65rem;
    }
}
/* prettier-ignore */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
/* prettier-ignore */
to {
    opacity: 1;
    transform: translateY(0);
}
    
}