/* ==========================================================================
   VERDEKO V5.2 - STYLES COMPLETS (EDITEUR + CALEPINAGE)
   Modifications appliquées:
   - Zone édition réduite de 50px en bas
   - Toolbar repositionnée: top 30px, right 70px
   - Formes encadrées légèrement
   - Surface à commander en bleu
   - Bloc prix en bleu
   - Boutons orientation arrondis (pill)
   - Titre sans majuscules forcées
   - Lien "Retour" à gauche avec flèche
   ========================================================================== */

/* ==========================================================================
   1. VARIABLES GLOBALES
   ========================================================================== */

:root {
    /* Couleurs principales */
    --v-green-primary: #4f934f;
    --v-green-dark: #3d7a3d;
    --v-green-light: #e8f5e9;
    --v-blue-primary: #2f5c69;
    --v-blue-dark: #22434d;
    
    /* Textes */
    --v-text-dark: #333333;
    --v-text-grey: #666666;
    
    /* UI */
    --v-border-color: #e0e0e0;
    --v-white: #ffffff;
    --v-shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.08);
    --v-radius-card: 12px;
    --v-radius-btn: 8px;
}

#verdeko-app-root {
    font-family: 'Inter', 'Proxima Nova', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--v-white);
    margin: 20px 0;
    color: var(--v-text-dark);
    position: relative;
    line-height: 1.5;
}

#verdeko-app-root * { box-sizing: border-box; }

/* ==========================================================================
   2. MOBILE NOTICE & FOOTER
   ========================================================================== */
.v2-mobile-notice {
    display: none;
    background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%);
    border: 2px solid #ffc107;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.v2-mobile-notice-icon { 
    width: 48px; 
    height: 48px; 
    margin: 0 auto 12px; 
    color: #f57c00; 
}
.v2-mobile-notice-icon svg { 
    width: 100%; 
    height: 100%; 
}
.v2-mobile-notice-title { 
    font-size: 18px; 
    font-weight: 700; 
    color: #e65100; 
    margin-bottom: 8px; 
}
.v2-mobile-notice-text { 
    font-size: 14px; 
    color: #5d4037; 
    line-height: 1.5; 
}

.v2-mobile-footer { 
    display: none; 
    padding: 20px; 
    background: #f8f9fa; 
    border-top: 1px solid #e0e0e0; 
    margin-top: 20px; 
}
.v2-mobile-footer .v2-btn-next { 
    width: 100%; 
}

/* Classe pour masquer sur mobile */
.v2-hide-mobile { }

/* ==========================================================================
   3. HEADER : SELECTEUR DE FORMES - ENCADRÉ
   ========================================================================== */
.v2-shapes-container {
    display: flex; 
    justify-content: center; 
    gap: 30px;
    padding: 20px;
    margin-bottom: 40px; 
    flex-wrap: wrap;
    /* MODIF: Encadrement léger */
    background: #f8f9fa;
    border: 1px solid var(--v-border-color);
    border-radius: var(--v-radius-card);
}

.v2-shape-card {
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center;
    width: 120px; 
    height: 110px; 
    border-radius: var(--v-radius-card);
    cursor: pointer; 
    transition: all 0.25s; 
    border: 2px solid transparent;
    background: #fff; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

/* ICONES FORMES SVG */
#verdeko-app-root .v2-shape-card svg {
    width: 45px !important; 
    height: 45px !important;
    fill: var(--v-green-primary) !important; 
    stroke: none !important;
    margin-bottom: 12px; 
    display: block !important; 
    opacity: 1 !important;
}

.v2-shape-label { 
    font-size: 12px; 
    font-weight: 600; 
    color: var(--v-text-grey); 
    text-transform: uppercase; 
}

.v2-shape-card:hover { 
    background: #fafafa; 
    transform: translateY(-3px); 
    box-shadow: 0 4px 12px rgba(0,0,0,0.08); 
}
.v2-shape-card.active { 
    background-color: var(--v-green-light); 
    border-color: var(--v-green-primary); 
    box-shadow: 0 4px 12px rgba(79, 147, 79, 0.15); 
}
.v2-shape-card.active .v2-shape-label { 
    color: #2e7d32; 
}

/* ==========================================================================
   4. LAYOUT & CONTROLS
   ========================================================================== */
.v2-main-layout { 
    display: grid; 
    grid-template-columns: 340px 1fr; 
    gap: 40px; 
    align-items: start; 
    padding: 0 10px; 
}

/* --- GAUCHE --- */
.v2-controls-box {
    background: #fff; 
    border-right: 1px solid #f0f0f0; 
    padding-right: 20px;
    position: relative; 
    z-index: 10; 
    pointer-events: auto;
}

.v2-section-title { 
    font-size: 14px; 
    font-weight: 600; 
    color: #333; 
    margin-bottom: 10px; 
}

/* Preview Schema */
.v2-schema-box {
    background: #fcfcfc; 
    border: 1px solid var(--v-border-color); 
    border-radius: var(--v-radius-card);
    height: 220px; 
    margin-bottom: 30px; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    padding: 10px;
}
.v2-schema-box svg { 
    width: 100%; 
    height: 100%; 
    overflow: visible; 
    display: block; 
}

/* Sliders */
.v2-slider-group { 
    margin-bottom: 25px; 
}
.v2-slider-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 10px; 
    font-size: 13px; 
    font-weight: 600; 
}
.v2-slider-val { 
    color: var(--v-green-primary); 
    font-weight: 700; 
    background: var(--v-green-light); 
    padding: 4px 8px; 
    border-radius: 4px; 
    min-width: 65px; 
    text-align: right; 
    font-family: monospace; 
}

/* Range inputs */
#verdeko-app-root input[type=range].v2-range {
    -webkit-appearance: none; 
    width: 100%; 
    background: transparent; 
    margin: 0; 
    height: 24px; 
    display: block;
    position: relative; 
    z-index: 100;
    pointer-events: auto !important; 
    cursor: pointer !important;
}

input[type=range].v2-range::-webkit-slider-runnable-track { 
    width: 100%; 
    height: 6px; 
    cursor: pointer; 
    background: #e0e0e0; 
    border-radius: 3px; 
}
input[type=range].v2-range::-webkit-slider-thumb { 
    -webkit-appearance: none; 
    height: 20px; 
    width: 20px; 
    border-radius: 50%; 
    background: var(--v-green-primary); 
    margin-top: -7px; 
    border: 3px solid #ffffff; 
    box-shadow: 0 2px 6px rgba(0,0,0,0.2); 
}
input[type=range].v2-range::-moz-range-track {
    width: 100%; 
    height: 6px; 
    cursor: pointer; 
    background: #e0e0e0; 
    border-radius: 3px;
}
input[type=range].v2-range::-moz-range-thumb { 
    width: 20px; 
    height: 20px; 
    background: var(--v-green-primary); 
    cursor: pointer; 
    border-radius: 50%; 
    border: 3px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Surface */
.v2-surface-block {
    background: linear-gradient(135deg, var(--v-blue-primary) 0%, var(--v-blue-dark) 100%);
    color: white;
    padding: 25px; 
    border-radius: var(--v-radius-card); 
    text-align: center;
    margin-top: 30px;
}
.v2-surface-label { 
    font-size: 0.8em; 
    font-weight: 600; 
    margin-bottom: 8px; 
    opacity: 0.9; 
    letter-spacing: 1px; 
}
.v2-surface-value { 
    font-size: 2.2em; 
    font-weight: bold; 
}

/* ==========================================================================
   5. COLONNE DROITE & CANVAS - RÉDUIT DE 50PX
   ========================================================================== */
.v2-canvas-wrapper {
    position: relative; 
    background: #ffffff; 
    border: 1px solid var(--v-border-color);
    border-radius: 12px; 
    overflow: hidden; 
    box-shadow: var(--v-shadow-soft);
    /* MODIF: Réduit de 50px */
    height: 700px; 
    display: flex; 
    flex-direction: column;
}

.v2-canvas-area {
    flex: 1; 
    background-color: #ffffff;
    background-image: linear-gradient(#f0f0f0 1px, transparent 1px), linear-gradient(90deg, #f0f0f0 1px, transparent 1px);
    background-size: 25px 25px; 
    width: 100%; 
    cursor: default;
    /* MODIF: Réduit de 50px */
    min-height: 550px;
}

/* ==========================================================================
   6. TOOLBAR - REPOSITIONNÉE
   ========================================================================== */
.v2-toolbar {
    position: absolute; 
    /* MODIF: Nouvelle position */
    top: 30px; 
    right: 70px; 
    display: flex; 
    gap: 12px; 
    z-index: 100; 
    pointer-events: auto;
    flex-wrap: wrap;
}
.v2-tool-group {
    background: #ffffff; 
    border-radius: 50px; 
    display: flex; 
    align-items: center;
    padding: 5px 8px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.1); 
    border: 1px solid #ebebeb;
    position: relative;
}
.v2-tool-sep { 
    width: 1px; 
    height: 20px; 
    background: #eeeeee; 
    margin: 0 6px; 
}
.v2-zoom-text { 
    font-size: 13px; 
    color: #555; 
    margin: 0 10px; 
    font-weight: 600; 
    min-width: 50px; 
    text-align: center; 
}

/* --- BOUTONS TOOLBAR --- */
#verdeko-app-root button.v2-tool-btn {
    width: 38px !important; 
    height: 38px !important; 
    border: none !important;
    background: transparent !important; 
    background-color: transparent !important; 
    background-image: none !important;
    border-radius: 50% !important; 
    display: flex !important; 
    align-items: center !important; 
    justify-content: center !important;
    cursor: pointer !important; 
    color: #555 !important; 
    padding: 0 !important; 
    margin: 0 !important;
    transition: all 0.2s;
    position: relative;
}

#verdeko-app-root button.v2-tool-btn svg {
    width: 20px !important; 
    height: 20px !important; 
    fill: none !important; 
    stroke: currentColor !important;
    stroke-width: 2px !important; 
    display: block !important; 
    opacity: 1 !important; 
    visibility: visible !important;
}

#verdeko-app-root button.v2-tool-btn:hover {
    background: #e8f5e9 !important;
    color: var(--v-green-primary) !important;
}

#verdeko-app-root button.v2-tool-btn.active,
#verdeko-app-root button.v2-tool-btn.active-grid { 
    background-color: var(--v-green-primary) !important; 
    color: #ffffff !important; 
}

#verdeko-app-root button.v2-tool-btn.danger:hover { 
    background: #ffebee !important; 
    color: #dc3545 !important; 
}

/* ==========================================================================
   7. TOOLTIPS (Harmonise: data-tip ET data-tooltip)
   ========================================================================== */
#verdeko-app-root .v2-tooltip,
#verdeko-app-root [data-tip],
#verdeko-app-root [data-tooltip] {
    position: relative;
    overflow: visible !important;
}

#verdeko-app-root .v2-tooltip::after,
#verdeko-app-root [data-tip]::after,
#verdeko-app-root [data-tooltip]::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--v-green-primary);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    font-weight: 600;
    pointer-events: none;
    z-index: 99999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    text-transform: none !important;
}

/* Support data-tooltip */
#verdeko-app-root [data-tooltip]::after {
    content: attr(data-tooltip);
}

#verdeko-app-root .v2-tooltip::before,
#verdeko-app-root [data-tip]::before,
#verdeko-app-root [data-tooltip]::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--v-green-primary);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 99999;
}

#verdeko-app-root .v2-tooltip:hover::after,
#verdeko-app-root .v2-tooltip:hover::before,
#verdeko-app-root [data-tip]:hover::after,
#verdeko-app-root [data-tip]:hover::before,
#verdeko-app-root [data-tooltip]:hover::after,
#verdeko-app-root [data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   8. DROPDOWNS
   ========================================================================== */
.v2-dropdown {
    position: absolute; 
    top: calc(100% + 10px); 
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    border-radius: 8px; 
    border: 1px solid #eee; 
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    min-width: 180px; 
    padding: 6px 0; 
    display: none; 
    flex-direction: column; 
    z-index: 200;
}

.v2-dropdown.show { 
    display: flex; 
}
.v2-drop-item {
    padding: 10px 16px; 
    font-size: 13px; 
    font-weight: 500; 
    color: #444; 
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}
.v2-drop-item:first-child { 
    border-radius: 7px 7px 0 0; 
}
.v2-drop-item:last-child { 
    border-radius: 0 0 7px 7px; 
}
.v2-drop-item:hover { 
    background-color: var(--v-green-light); 
    color: var(--v-green-primary); 
}

/* ==========================================================================
   9. FOOTER CANVAS
   ========================================================================== */
.v2-canvas-footer {
    background: #f9f9f9;
    border-top: 1px solid #e0e0e0;
    padding: 18px 30px;
    display: block; 
    justify-content: space-between; 
    align-items: center;
    min-height: 80px;
    border-radius: 0 0 12px 12px;
}

.v2-footer-info {
    font-size: 14px; 
    color: #666;
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-width: 65%;
    line-height: 1.5;
}

.v2-info-line { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
}
.v2-info-icon { 
    font-size: 18px; 
}

/* BOUTON PRINCIPAL */
#verdeko-app-root .v2-btn-next {
    background: linear-gradient(135deg, var(--v-green-primary) 0%, var(--v-green-dark) 100%) !important;
    color: #ffffff !important;
    border: none !important;
    padding: 16px 32px !important;
    border-radius: var(--v-radius-btn) !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    cursor: pointer !important;
    box-shadow: 0 4px 15px rgba(79, 147, 79, 0.3) !important;
    transition: all 0.2s !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
}

#verdeko-app-root .v2-btn-next:hover {
    background: linear-gradient(135deg, var(--v-green-dark) 0%, #2d5e2d 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 147, 79, 0.4) !important;
}

/* ==========================================================================
   10. RESPONSIVE - TABLETTE
   ========================================================================== */
@media (max-width: 1024px) {
    .v2-main-layout { 
        grid-template-columns: 1fr; 
        gap: 30px; 
    }
    .v2-controls-box { 
        border-right: none; 
        padding-right: 0; 
        order: 1;
    }
    .v2-canvas-wrapper { 
        order: 2;
        height: auto;
    }
    .v2-canvas-area { 
        min-height: 450px; 
    }
    .v2-schema-box { 
        height: 180px; 
    }
    .v2-canvas-footer { 
        flex-direction: column; 
        gap: 15px; 
        text-align: center; 
    }
    .v2-footer-info { 
        order: 2; 
        font-size: 12px;
        max-width: 100%;
    }
    .v2-btn-next { 
        order: 1; 
        width: 100%; 
    }
    .v2-shapes-container {
        gap: 15px;
    }
    .v2-shape-card {
        width: 100px;
        height: 90px;
    }
    .v2-toolbar {
        right: 20px;
        top: 15px;
    }
}

/* ==========================================================================
   11. RESPONSIVE - MOBILE
   ========================================================================== */
@media (max-width: 767px) {
    #verdeko-app-root { 
        margin: 10px 0; 
    }
    
    /* Afficher notice et footer mobile */
    .v2-mobile-notice { 
        display: block; 
    }
    .v2-mobile-footer { 
        display: block; 
    }
    
    /* Masquer elements desktop */
    .v2-hide-mobile { 
        display: none !important; 
    }
    
    /* Grille de formes */
    .v2-shapes-container { 
        display: grid; 
        grid-template-columns: repeat(2, 1fr); 
        gap: 10px;
        padding: 15px;
        margin-bottom: 20px;
    }
    .v2-shape-card { 
        width: 100%;
        min-height: 70px; 
        height: auto;
        padding: 12px 8px; 
    }
    .v2-shape-card svg { 
        width: 28px !important; 
        height: 28px !important; 
        margin-bottom: 6px; 
    }
    .v2-shape-label { 
        font-size: 11px; 
    }
    
    /* Layout */
    .v2-main-layout { 
        display: flex;
        flex-direction: column; 
        gap: 0;
        padding: 0;
    }
    .v2-controls-box { 
        width: 100%; 
        padding: 15px; 
        border-radius: 8px;
        border: 1px solid var(--v-border-color);
    }
    .v2-schema-box { 
        height: 160px; 
        margin: 10px 0 20px; 
    }
    .v2-slider-group {
        margin-bottom: 18px;
    }
    
    /* Surface */
    .v2-surface-block { 
        padding: 15px; 
        margin-top: 15px; 
    }
    .v2-surface-label { 
        font-size: 0.75em; 
    }
    .v2-surface-value { 
        font-size: 1.8em; 
    }
    
    /* Bouton */
    .v2-btn-next { 
        padding: 14px 24px !important; 
        font-size: 13px !important; 
    }
}

/* ==========================================================================
   12. KONVA CONTAINER
   ========================================================================== */
#konva-container {
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    background-image: linear-gradient(#e0e0e0 1px, transparent 1px), linear-gradient(90deg, #e0e0e0 1px, transparent 1px);
    background-size: 25px 25px;
}

/* Grille desactivee */
#konva-container.no-grid {
    background-image: none;
}


/* ==========================================================================
   ==========================================================================
   CALEPINAGE - STYLES
   ==========================================================================
   ========================================================================== */

#verdeko-calepinage-ui {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.1);
    overflow: hidden;
    margin: 20px 0;
}

/* ==========================================================================
   13. CALEPINAGE - HEADER
   ========================================================================== */

.calep-header {
    background: linear-gradient(135deg, #43a047 0%, #2e7d32 100%);
    color: white;
    padding: 20px 28px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
}

/* MODIF: Titre sans majuscules forcées */
.calep-header-left h2 {
    margin: 0 0 10px 0;
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    text-transform: uppercase !important;
}

.calep-surface-info {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.calep-surface-value { 
    font-size: 32px; 
    font-weight: 800; 
    color: white; 
}

.calep-surface-label { 
    font-size: 15px; 
    color: rgba(255,255,255,0.9); 
}

.calep-obstacles-badge {
    background: rgba(255,255,255,0.25);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: white;
}

.calep-header-right { 
    text-align: right; 
}

/* ==========================================================================
   14. CALEPINAGE - ORIENTATION TOGGLE (PILL SHAPE)
   ========================================================================== */

.calep-orientation-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.calep-orientation-label {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255,255,255,0.85);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calep-toggle-group { 
    display: flex; 
    gap: 8px; 
}

/* MODIF: Boutons orientation arrondis (pill shape) */
.calep-orient-btn {
    padding: 10px 20px;
    border: 2px solid rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.15);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    font-size: 13px;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
}

.calep-orient-btn:hover {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.6);
}

.calep-orient-btn.active {
    background: white;
    border-color: white;
    color: #2e7d32;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.calep-hint { 
    font-size: 13px; 
    min-height: 20px; 
    margin-top: 4px; 
}

.calep-hint .hint-good { 
    color: #c8e6c9; 
    font-weight: 600; 
}

.calep-hint .hint-tip { 
    color: #fff59d; 
    font-weight: 600; 
}

.calep-hint .hint-neutral { 
    color: rgba(255,255,255,0.75); 
}

/* ==========================================================================
   15. CALEPINAGE - MAIN LAYOUT
   ========================================================================== */

.calep-main {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 0;
}

/* ==========================================================================
   16. CALEPINAGE - SCHEMA (LEFT SIDE)
   ========================================================================== */

.calep-schema {
    padding: 20px;
    background: #f8f9fa;
    border-right: 1px solid var(--v-border-color);
}

.calep-schema-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 0 4px;
}

.calep-toggle-waste {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    color: #555;
    user-select: none;
    font-weight: 500;
}

.calep-toggle-waste input { 
    display: none; 
}

.calep-toggle-slider {
    width: 40px;
    height: 22px;
    background: #bdbdbd;
    border-radius: 11px;
    position: relative;
    transition: background 0.2s;
}

.calep-toggle-slider::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.calep-toggle-waste input:checked + .calep-toggle-slider { 
    background: #ef5350; 
}

.calep-toggle-waste input:checked + .calep-toggle-slider::after { 
    transform: translateX(18px); 
}

.calep-orientation-indicator {
    font-size: 13px;
    color: #555;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.calep-mode-badge {
    background: var(--v-green-light);
    color: #2e7d32;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.calep-svg-container {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--v-border-color);
    padding: 16px;
    min-height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calep-svg-container svg {
    width: 100%;
    height: auto;
    max-height: 500px;
}

.calep-schema-warning {
    margin-top: 12px;
}

/* ==========================================================================
   17. CALEPINAGE - DETAILS (RIGHT SIDE)
   ========================================================================== */

.calep-details {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.calep-section h3 {
    margin: 0 0 12px 0;
    font-size: 17px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #1a1a1a;
}

/* ==========================================================================
   18. CALEPINAGE - ROULEAUX LIST
   ========================================================================== */

.calep-rouleaux-list {
  
}

.calep-rouleau-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--v-border-color);
    background: white;
}

.calep-rouleau-item:last-child { 
    border-bottom: none; 
}

.calep-rouleau-qty {
    background: #43a047;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 13px;
    min-width: 40px;
    text-align: center;
}

.calep-rouleau-dims { 
    flex: 1; 
    font-size: 14px; 
    color: #1a1a1a; 
}

.calep-rouleau-refs { 
    color: #666; 
    font-size: 12px; 
    font-weight: 500; 
    margin-left: 6px; 
}

.calep-rouleau-surface { 
    font-size: 13px; 
    color: #444; 
    font-weight: 600; 
}

/* ==========================================================================
   19. CALEPINAGE - TOTAUX
   ========================================================================== */

.calep-totaux {
    background: #f5f5f5;
    border-radius: 10px;
    padding: 4px 0;
    border: 1px solid var(--v-border-color);
}

.calep-total-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    font-size: 14px;
    color: #333;
    background: white;
    border-bottom: 1px solid #e8e8e8;
}

.calep-total-row:last-child { 
    border-bottom: none; 
}

.calep-total-row strong { 
    color: #2f5c69; 
}



.calep-revente-hint {
    background: var(--v-green-light);
    padding: 12px 16px;
    font-size: 13px;
    color: #2e7d32;
    line-height: 1.5;
}

.calep-revente-amount {
    font-weight: 600;
    color: #1b5e20;
}

/* ==========================================================================
   20. CALEPINAGE - BLOC PRIX (Dégradé Bleu)
   ========================================================================== */

/* MODIF: Bloc prix en dégradé BLEU */
.calep-prix-block {
    background: linear-gradient(135deg, var(--v-blue-primary) 0%, var(--v-blue-dark) 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

.calep-prix-amount { 
    font-size: 28px; 
    font-weight: 700; 
}

.calep-prix-details { 
    font-size: 13px; 
    color: rgba(255,255,255,0.85); 
    margin-top: 6px; 
}

.calep-prix-na { 
    font-size: 14px; 
    color: rgba(255,255,255,0.7); 
    padding: 16px; 
}

/* ==========================================================================
   21. CALEPINAGE - ACTIONS (Bouton + Lien)
   ========================================================================== */

.calep-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: auto;
    padding-top: 10px;
}

/* MODIF: Lien Retour - À GAUCHE, visible, souligné avec flèche */
.calep-link-secondary {
    order: -1;
    color: var(--v-blue-primary);
    font-size: 14px;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
    background: none;
    border: none;
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}

.calep-link-secondary::before {
    content: '←';
    font-size: 16px;
    font-weight: 700;
}

.calep-link-secondary:hover {
    color: var(--v-green-primary);
}

/* Bouton Valider - Style identique à l'éditeur */
.calep-btn-primary {
    background: linear-gradient(135deg, var(--v-green-primary) 0%, var(--v-green-dark) 100%) !important;
    color: #ffffff !important;
    border: none !important;
    padding: 16px 22px !important;
    border-radius: var(--v-radius-btn) !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    cursor: pointer !important;
    box-shadow: 0 4px 15px rgba(79, 147, 79, 0.3) !important;
    transition: all 0.2s !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-shrink: 0;
}

.calep-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 147, 79, 0.4) !important;
}

/* ==========================================================================
   22. CALEPINAGE - WARNINGS
   ========================================================================== */

.calep-rotated-warning {
    background: #F8F5D6;
    border: 1px solid #ECE290;
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.calep-warning-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.calep-warning-text {
    font-size: 13px;
    color: #A28243;
    line-height: 1.4;
}

.calep-empty { 
    padding: 20px; 
    text-align: center; 
    color: #888; 
}

/* ==========================================================================
   23. CALEPINAGE - RESPONSIVE TABLETTE
   ========================================================================== */

@media (max-width: 1024px) {
    .calep-main { 
        grid-template-columns: 1fr; 
    }
    
    .calep-header { 
        flex-direction: column; 
    }
    
    .calep-header-right { 
        text-align: left; 
        width: 100%; 
    }
    
    .calep-orientation-group { 
        align-items: flex-start; 
    }
    
    .calep-schema {
        border-right: none;
        border-bottom: 1px solid var(--v-border-color);
    }
    
    .calep-actions {
        flex-direction: column-reverse;
        gap: 15px;
    }
    
    .calep-btn-primary {
        width: 100%;
    }
    
    .calep-link-secondary {
        order: 0;
    }
}

/* ==========================================================================
   24. CALEPINAGE - RESPONSIVE MOBILE
   ========================================================================== */

@media (max-width: 767px) {
    #verdeko-calepinage-ui {
        margin: 10px 0;
        border-radius: 12px;
    }
    
    .calep-header {
        padding: 16px 20px;
    }
    
    .calep-header-left h2 {
        font-size: 18px;
    }
    
    .calep-surface-value {
        font-size: 26px;
    }
    
    .calep-toggle-group {
        flex-direction: column;
        width: 100%;
    }
    
    .calep-orient-btn {
        justify-content: center;
    }
    
    .calep-schema {
        padding: 15px;
    }
    
    .calep-details {
        padding-left: 10px;
    }
    
    .calep-prix-block {
        padding: 16px;
    }
    
    .calep-prix-amount {
        font-size: 24px;
    }
    
    .calep-btn-primary {
        padding: 14px 24px !important;
        font-size: 13px !important;
    }
}

/* ==========================================================================
   ==========================================================================
   V4: ÉCRAN DE CHOIX DESKTOP
   ==========================================================================
   ========================================================================== */

.v4-choice-screen {
    padding: 40px 20px;
    text-align: center;
    background: #fafafa;
    border-radius: 16px;
    margin-bottom: 20px;
}

.v4-choice-header {
    margin-bottom: 40px;
}

.v4-choice-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #4f934f 0%, #3d7a3d 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 4px 16px rgba(79, 147, 79, 0.3);
}

.v4-choice-icon svg {
    width: 32px;
    height: 32px;
    stroke: white;
    stroke-width: 2;
    fill: none;
}

.v4-choice-title {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 12px 0;
}

.v4-choice-subtitle {
    font-size: 16px;
    color: #666;
    margin: 0;
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.5;
}

.v4-choice-cards {
    display: flex;
    gap: 24px;
    justify-content: center;
    max-width: 800px;
    margin: 0 auto;
}

.v4-choice-card {
    flex: 1;
    max-width: 360px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 16px;
    padding: 32px 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.v4-choice-card:hover {
    border-color: #4f934f;
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(79, 147, 79, 0.15);
}

.v4-choice-card:hover .v4-card-icon {
    transform: scale(1.1);
}

.v4-choice-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #4f934f 0%, #3d7a3d 100%);
    color: #fff;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.v4-card-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: #f5f5f5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.v4-card-icon svg {
    width: 40px;
    height: 40px;
    stroke: #4f934f;
    stroke-width: 1.5;
    fill: none;
}

.v4-card-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 8px 0;
}

.v4-card-desc {
    font-size: 14px;
    color: #666;
    margin: 0 0 16px 0;
    line-height: 1.5;
}

.v4-card-features {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
}

.v4-card-features li {
    font-size: 13px;
    color: #555;
    padding: 6px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.v4-card-features li::before {
    content: '✓';
    color: #4f934f;
    font-weight: 700;
}

.v4-choice-header h2 {
    margin: 0px 0px 15px 0px !important;
    font-size: 24px !important;
    font-weight: 700 !important;
    color: #2f5c69 !important;
}

.gform_wrapper.gravity-theme .gfield--type-choice.image-choices-field.ic-align--center .gfield_label {
    text-align: center;
margin: 0 0 8px 0;
    font-size: 28px;
    font-weight: 700;
    color: #2f5c69 !important;
}
.gfield_label .gform-field-label  {
    
}

/* ==========================================================================
   V4: HEADER V3 (avec bouton satellite)
   ========================================================================== */

.v3-header {
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, #4f934f 0%, #3d7a3d 100%);
    padding: 20px 24px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(79, 147, 79, 0.25);
}

.v3-header-title {
    flex: 1;
    font-size: 18px;
    font-weight: 700;
    color: white;
    margin: 0;
}

.v3-header-satellite {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.5);
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.v3-header-satellite svg {
    width: 20px;
    height: 20px;
}

.v3-header-satellite:hover {
    background: rgba(255,255,255,0.35);
    border-color: rgba(255,255,255,0.8);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.v3-header-satellite:active {
    transform: translateY(0);
}

/* ==========================================================================
   V4: RESPONSIVE
   ========================================================================== */

/* Desktop: masquer éléments réservés mobile */
@media (min-width: 768px) {
    .v2-mobile-only {
        display: none !important;
    }
    .v2-mobile-notice {
        display: none !important;
    }
    .v2-mobile-footer {
        display: none !important;
    }
    /* ✅ FIX: Mode LIBRE affiche les contrôles aussi */
    .v2-hide-desktop {
        display: none !important;
    }
    .v2-main-layout.v2-libre-mode .v2-hide-desktop {
        display: block !important;  /* ← Montrer contrôles en mode libre */
    }
    /* Mode LIBRE: garder colonne gauche + canvas */
    .v2-main-layout.v2-libre-mode {
        grid-template-columns: 340px 1fr !important;  /* ← Contrôles + Canvas côte à côte */
    }
    .v2-libre-mode .v2-canvas-wrapper {
        width: 100%;
    }
}

/* Mobile: masquer éléments desktop, afficher mobile */
@media (max-width: 767px) {
    .v3-header { 
        display: none !important; 
    }
    .v4-choice-screen { 
        display: none !important; 
    }
    .v2-hide-mobile {
        display: none !important;
    }
    .v2-mobile-only {
        display: block !important;
    }
    .v2-mobile-notice {
        display: block !important;
    }
    .v2-mobile-footer {
        display: block !important;
    }
    /* Mobile: afficher grille de formes */
    .v2-shapes-container.v2-mobile-only {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 15px;
        margin-bottom: 20px;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .v3-header { 
        flex-wrap: wrap; 
    }
    .v3-header-satellite { 
        width: 100%; 
        justify-content: center; 
        margin-top: 12px; 
    }
    .v4-choice-cards { 
        flex-direction: column; 
        align-items: center; 
    }
}

/* ==========================================================================
   CONTRÔLES DE FOND (Background controls) - AJOUTÉ
   ========================================================================== */

.vdk-bg-controls-section {
    padding: 16px 12px !important;
    margin-bottom: 20px !important;
    background: linear-gradient(135deg, #f0f9f0 0%, #f5faf5 100%) !important;
    border: 2px solid #d4edda !important;
    border-radius: 12px !important;
}

.vdk-bg-controls-header h3 {
    margin: 0 0 12px 0 !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #2e7d32 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.vdk-bg-control-item {
    margin-bottom: 12px !important;
    padding: 10px 12px !important;
    background: white !important;
    border-radius: 8px !important;
    border: 1px solid #e0e0e0 !important;
}

.vdk-bg-control-label {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 8px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #333 !important;
}

.vdk-bg-opacity-slider-container {
    display: flex !important;
    gap: 8px !important;
    align-items: center !important;
}

.vdk-bg-opacity-slider {
    flex: 1 !important;
    height: 4px !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    background: #e0e0e0 !important;
    border-radius: 2px !important;
    outline: none !important;
    cursor: pointer !important;
}

.vdk-bg-opacity-slider::-webkit-slider-thumb {
    -webkit-appearance: none !important;
    appearance: none !important;
    width: 14px !important;
    height: 14px !important;
    background: #4f934f !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
    transition: all 0.15s ease !important;
}

.vdk-bg-opacity-slider::-webkit-slider-thumb:hover {
    background: #3d7a3c !important;
    box-shadow: 0 2px 6px rgba(79, 147, 79, 0.3) !important;
    transform: scale(1.1) !important;
}

.vdk-bg-opacity-slider::-moz-range-thumb {
    width: 14px !important;
    height: 14px !important;
    background: #4f934f !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    border: none !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
}

.vdk-bg-remove-btn {
    width: 24px !important;
    height: 24px !important;
    padding: 0 !important;
    background: #ffebee !important;
    border: none !important;
    border-radius: 4px !important;
    color: #c62828 !important;
    font-size: 12px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.15s ease !important;
}

.vdk-bg-remove-btn:hover {
    background: #ffcdd2 !important;
    transform: scale(1.1) !important;
}

.vdk-bg-control-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    padding-top: 8px !important;
    border-top: 1px solid #e0e0e0 !important;
}

.vdk-bg-btn-recenter,
.vdk-bg-btn-align {
    padding: 8px 12px !important;
    background: #e8f5e9 !important;
    border: 1px solid #4f934f !important;
    border-radius: 6px !important;
    color: #2e7d32 !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
}

.vdk-bg-btn-recenter:hover,
.vdk-bg-btn-align:hover {
    background: #4f934f !important;
    color: white !important;
    box-shadow: 0 2px 6px rgba(79, 147, 79, 0.2) !important;
}

/* =====================================================================
   VERDEKO ALIGNMENT MODAL CSS
   Styles pour la modal d'alignement (Damier, Split, Opacity)
   ===================================================================== */

/* =====================================================================
   MODAL OVERLAY & CONTAINER
   ===================================================================== */

.vdk-align-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0.5) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10000 !important;
}

.vdk-align-modal {
    background: white !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2) !important;
    max-width: 800px !important;
    width: 90% !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    padding: 0 !important;
}

/* =====================================================================
   MODAL HEADER
   ===================================================================== */

.vdk-align-modal-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 20px 24px !important;
    border-bottom: 2px solid #f0f0f0 !important;
    background: linear-gradient(135deg, #f9faf8 0%, #f5faf5 100%) !important;
}

.vdk-align-modal-header h2 {
    margin: 0 !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #2e7d32 !important;
}

.vdk-align-close {
    background: none !important;
    border: none !important;
    font-size: 24px !important;
    color: #999 !important;
    cursor: pointer !important;
    padding: 0 !important;
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 4px !important;
    transition: all 0.2s !important;
}

.vdk-align-close:hover {
    background: rgba(0, 0, 0, 0.05) !important;
    color: #333 !important;
    transform: rotate(90deg) !important;
}

/* =====================================================================
   MODAL CONTENT
   ===================================================================== */

.vdk-align-modal-content {
    padding: 24px !important;
}

/* Mode selector buttons */
.vdk-align-modes {
    display: grid !important;
    grid-template-columns: 1fr 1fr 1fr !important;
    gap: 12px !important;
    margin-bottom: 24px !important;
}

.vdk-align-mode-btn {
    padding: 12px 16px !important;
    background: #f5f5f5 !important;
    border: 2px solid #e0e0e0 !important;
    border-radius: 8px !important;
    color: #333 !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    line-height: 1.4 !important;
}

.vdk-align-mode-btn:hover {
    border-color: #4f934f !important;
    background: #f9faf8 !important;
}

.vdk-align-mode-btn.active {
    background: #4f934f !important;
    border-color: #2e7d32 !important;
    color: white !important;
}

/* Mode content (tab-like) */
.vdk-align-mode-content {
    display: none !important;
}

.vdk-align-mode-content.active {
    display: block !important;
    animation: fadeIn 0.3s !important;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Canvas container */
#vdk-damier-canvas {
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    background: #f9f9f9 !important;
    width: 100% !important;
    min-height: 400px !important;
}

/* =====================================================================
   MODAL FOOTER
   ===================================================================== */

.vdk-align-modal-footer {
    display: flex !important;
    justify-content: flex-end !important;
    gap: 12px !important;
    padding: 16px 24px !important;
    border-top: 1px solid #f0f0f0 !important;
    background: #fafafa !important;
}

.vdk-align-btn-apply,
.vdk-align-btn-cancel {
    padding: 10px 20px !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    border: none !important;
}

.vdk-align-btn-apply {
    background: #4f934f !important;
    color: white !important;
}

.vdk-align-btn-apply:hover {
    background: #2e7d32 !important;
    box-shadow: 0 2px 8px rgba(79, 147, 79, 0.2) !important;
}

.vdk-align-btn-cancel {
    background: #e8e8e8 !important;
    color: #333 !important;
}

.vdk-align-btn-cancel:hover {
    background: #d8d8d8 !important;
}

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

@media (max-width: 600px) {
    .vdk-align-modes {
        grid-template-columns: 1fr !important;
    }
    
    .vdk-align-modal {
        max-height: 80vh !important;
        width: 95% !important;
    }
}