﻿/* ============================================
   LABEL DESIGNER - Version Minimaliste
   ============================================ */

* {
    box-sizing: border-box;
}

.label-designer {
    display: grid;
    grid-template-columns: 300px 1fr;
    height: calc(100vh - 100px);
    gap: 0;
    background: #f5f5f5;
}

/* ============================================
   TOOLBOX (Left Sidebar)
   ============================================ */

.toolbox {
    background: white;
    border-right: 2px solid #ddd;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 20px;
}

    .toolbox h3 {
        margin: 0 0 15px 0;
        font-size: 18px;
        font-weight: 600;
        color: #333;
    }

.elements-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 30px;
}

.element-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background: #f8f8f8;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

    .element-item:hover {
        background: #e3f2fd;
        border-color: #2196f3;
        transform: translateX(5px);
    }

.element-icon {
    font-size: 24px;
    font-weight: bold;
    color: #2196f3;
    width: 30px;
    text-align: center;
}

.element-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

/* Properties Panel */
.properties-panel {
    border-top: 2px solid #ddd;
    padding-top: 20px;
    margin-top: 20px;
}

    .properties-panel h3 {
        margin-bottom: 15px;
    }

.prop-group {
    margin-bottom: 15px;
}

    .prop-group label {
        display: block;
        font-size: 12px;
        font-weight: 600;
        color: #666;
        margin-bottom: 5px;
        text-transform: uppercase;
    }

    .prop-group input[type="text"],
    .prop-group input[type="number"],
    .prop-group select {
        width: 100%;
        padding: 8px 10px;
        border: 1px solid #ddd;
        border-radius: 4px;
        font-size: 14px;
    }

        .prop-group input:focus,
        .prop-group select:focus {
            outline: none;
            border-color: #2196f3;
            box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
        }

    .prop-group input[type="checkbox"] {
        margin-right: 8px;
        width: auto;
    }

/* Style Buttons (Titre 1, 2, 3) */
.style-buttons {
    display: flex;
    gap: 8px;
}

.btn-style {
    flex: 1;
    padding: 8px 10px;
    background: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

    .btn-style:hover {
        background: #e3f2fd;
        border-color: #2196f3;
        color: #2196f3;
    }

/* Align Buttons */
.align-buttons {
    display: flex;
    gap: 8px;
}

.btn-align {
    flex: 1;
    padding: 8px 10px;
    background: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

    .btn-align:hover {
        background: #e3f2fd;
        border-color: #2196f3;
    }

    .btn-align.active {
        background: #2196f3;
        border-color: #2196f3;
        color: white;
    }

/* Format Buttons (Bold, Italic) */
.format-buttons {
    display: flex;
    gap: 8px;
}

.btn-format {
    flex: 1;
    padding: 8px 10px;
    background: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

    .btn-format:hover {
        background: #e3f2fd;
        border-color: #2196f3;
    }

    .btn-format.active {
        background: #2196f3;
        border-color: #2196f3;
        color: white;
    }

.btn-delete {
    width: 100%;
    padding: 10px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

    .btn-delete:hover {
        background: #d32f2f;
    }

/* ============================================
   CANVAS AREA (Center)
   ============================================ */

.canvas-area {
    display: flex;
    flex-direction: column;
    background: #e8e8e8;
    overflow: hidden;
    position: relative;
}

.canvas-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background: white;
    border-bottom: 2px solid #ddd;
    z-index: 10;
}

/* Wrapper avec scroll */
.canvas-wrapper {
    flex: 1;
    overflow: auto;
    position: relative;
}

.canvas-controls button {
    width: 36px;
    height: 36px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 6px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

    .canvas-controls button:hover {
        background: #2196f3;
        color: white;
        border-color: #2196f3;
    }

.canvas-controls .btn-toggle {
    min-width: 80px;
    font-size: 14px;
    margin-left: 10px;
}

.canvas-controls span {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    min-width: 60px;
    text-align: center;
}

.canvas-container {
    min-height: 100%;
    min-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    transition: transform 0.2s ease;
}

.canvas-content {
    position: relative;
}

.label-canvas {
    background: white;
    border: 3px solid #333;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    position: relative;
    cursor: default;
}

/* ============================================
   ZONES (Antenna, Recto, Verso)
   ============================================ */

.zone-antenna {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 40.95%; /* 4.3cm / 10.5cm */
    height: 9.09%; /* 0.2cm / 2.2cm */
    background: rgba(255, 0, 0, 0.15);
    border: 2px solid rgba(255, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 1;
}

    .zone-antenna span {
        font-size: 8px;
        font-weight: bold;
        color: #d32f2f;
        padding: 2px 6px;
        border-radius: 3px;
    }

.zone-recto {
    position: absolute;
    left: 40.95%;
    top: 50%;
    transform: translateY(-50%);
    width: 24.76%; /* 2.6cm / 10.5cm */
    height: 54.54%; /* 1.2cm / 2.2cm */
    background: rgba(33, 150, 243, 0.1);
    border: 2px dashed rgba(33, 150, 243, 0.5);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 3px;
    pointer-events: none;
    z-index: 0;
}

    .zone-recto span {
        font-size: 9px;
        font-weight: bold;
        color: #2196f3;
        padding: 2px 6px;
        border-radius: 3px;
    }

.zone-verso {
    position: absolute;
    left: 65.71%;
    top: 50%;
    transform: translateY(-50%);
    width: 24.76%;
    height: 54.54%;
    background: rgba(76, 175, 80, 0.1);
    border: 2px dashed rgba(76, 175, 80, 0.5);
    border-radius: 0 3px 3px 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 3px;
    pointer-events: none;
    z-index: 0;
}

    .zone-verso span {
        font-size: 9px;
        font-weight: bold;
        color: #4caf50;
        padding: 2px 6px;
        border-radius: 3px;
    }

/* ============================================
   CANVAS ELEMENTS
   ============================================ */

.canvas-element {
    position: absolute;
    cursor: move;
    border: 2px solid transparent;
    transition: border-color 0.15s;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-sizing: border-box;
}

    .canvas-element:hover {
        border-color: rgba(33, 150, 243, 0.5);
    }

    .canvas-element.selected {
        border-color: #4caf50;
        z-index: 100;
    }

/* Text */
.text-preview {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px 4px;
    font-family: Arial, sans-serif;
    word-break: break-word;
    overflow: hidden;
}

/* Resize Handle */
.resize-handle {
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 10px;
    height: 10px;
    background: #4caf50;
    border: 2px solid white;
    border-radius: 50%;
    cursor: se-resize;
    z-index: 101;
}

/* ============================================
   CANVAS INFO
   ============================================ */

.canvas-info {
    padding: 12px 20px;
    background: white;
    border-top: 2px solid #ddd;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

    .canvas-info div {
        font-size: 12px;
        color: #666;
    }

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .label-designer {
        grid-template-columns: 250px 1fr;
    }
}

/* Boutons Save/Load */
.btn-save, .btn-load {
    padding: 8px 15px;
    background: #4caf50;
    color: white;
    border: 2px solid #4caf50;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

    .btn-save:hover, .btn-load:hover {
        background: #45a049;
        border-color: #45a049;
        transform: translateY(-1px);
    }

@media (max-width: 768px) {
    .label-designer {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .toolbox {
        max-height: 300px;
        border-right: none;
        border-bottom: 2px solid #ddd;
    }
}
/* ============================================
   MODEL SELECTOR SECTION
   ============================================ */

.model-selector-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
}

.btn-select-model {
    width: 100%;
    padding: 12px 15px;
    background: linear-gradient(135deg, #2196f3, #21cbf3);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

    .btn-select-model:hover {
        background: linear-gradient(135deg, #1976d2, #00bcd4);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
    }

    .btn-select-model svg {
        stroke: white;
    }

.selected-model-info {
    margin-top: 15px;
    padding: 12px;
    background: linear-gradient(135deg, #e3f2fd, #f1f8e9);
    border: 2px solid #2196f3;
    border-radius: 8px;
}

.model-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 12px;
    border-bottom: 1px solid rgba(33, 150, 243, 0.2);
}

    .model-info-row:last-child {
        border-bottom: none;
    }

    .model-info-row strong {
        color: #1976d2;
        font-weight: 600;
        text-transform: uppercase;
        font-size: 11px;
    }

    .model-info-row span {
        color: #333;
        font-weight: 500;
        text-align: right;
    }

.available-properties {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 2px dashed #2196f3;
}

    .available-properties strong {
        display: block;
        margin-bottom: 8px;
        color: #1976d2;
        font-size: 12px;
        text-transform: uppercase;
    }

    .available-properties ul {
        list-style: none;
        padding: 0;
        margin: 0;
        max-height: 200px;
        overflow-y: auto;
    }

    .available-properties li {
        padding: 6px 8px;
        background: white;
        border: 1px solid #e0e0e0;
        border-radius: 4px;
        margin-bottom: 4px;
        font-size: 11px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .available-properties code {
        font-family: 'Courier New', monospace;
        color: #d32f2f;
        font-weight: 600;
        font-size: 11px;
    }

    .available-properties .prop-type {
        color: #666;
        font-size: 10px;
        font-style: italic;
    }

.btn-clear-model {
    width: 100%;
    padding: 8px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

    .btn-clear-model:hover {
        background: #d32f2f;
    }

    .btn-clear-model svg {
        stroke: white;
    }

.divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, #ddd, transparent);
    margin: 20px 0;
}

/* Property group small text */
.prop-group small {
    display: block;
    margin-top: 4px;
    font-size: 10px;
    color: #666;
    font-style: italic;
}