/**
 * ThreeSliceGauge - Styles CSS
 * Jauges avec découpage en 3 zones (début, milieu répétable, fin)
 */

/* === CONTENEUR PRINCIPAL === */
.three-slice-gauge {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 3px;
}

/* === COUCHE DE REMPLISSAGE === */
.three-slice-gauge .tsg-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    z-index: 1;
    transition: width 0.3s ease-out, height 0.3s ease-out;
}

/* === COUCHE DU CADRE === */
.three-slice-gauge .tsg-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    display: flex;
    flex-direction: row;
    pointer-events: none;
}

/* Orientation verticale */
.three-slice-gauge.vertical .tsg-frame {
    flex-direction: column;
}

/* === ZONES DU CADRE === */
.three-slice-gauge .tsg-zone {
    background-repeat: no-repeat;
}

.three-slice-gauge .tsg-start {
    flex-shrink: 0;
}

.three-slice-gauge .tsg-middle {
    flex-grow: 1;
    flex-shrink: 1;
    min-width: 0;
    min-height: 0;
}

.three-slice-gauge .tsg-end {
    flex-shrink: 0;
}

/* === COUCHE DU TEXTE === */
.three-slice-gauge .tsg-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    font-size: 0.75rem;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

/* ================================ */
/* === STYLES POUR L'ÉDITEUR === */
/* ================================ */

/* Éditeur de découpe 3-slice */
.three-slice-editor {
    position: relative;
    background: #1a1a2e;
    border: 1px solid #4a4a6a;
    border-radius: 6px;
    padding: 12px;
    margin-top: 8px;
}

.three-slice-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.three-slice-editor-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #e0e0e0;
}

/* Canvas de preview pour l'éditeur */
.three-slice-canvas-container {
    position: relative;
    background: #0a0a14;
    border: 1px solid #3a3a5a;
    border-radius: 4px;
    overflow: hidden;
    min-height: 60px;
}

.three-slice-canvas {
    display: block;
    width: 100%;
    height: auto;
    max-height: 120px;
    object-fit: contain;
}

/* Lignes de découpe draggables */
.slice-line {
    position: absolute;
    background: rgba(255, 200, 0, 0.8);
    cursor: col-resize;
    z-index: 10;
    transition: background 0.15s;
}

.slice-line:hover,
.slice-line.dragging {
    background: rgba(255, 255, 0, 1);
}

.slice-line.horizontal {
    width: 3px;
    height: 100%;
    top: 0;
}

.slice-line.vertical {
    width: 100%;
    height: 3px;
    left: 0;
    cursor: row-resize;
}

.slice-line .slice-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #ffc800;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.slice-line.horizontal .slice-handle {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.slice-line.vertical .slice-handle {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Indicateurs de valeur sur les lignes */
.slice-line .slice-value {
    position: absolute;
    background: rgba(0,0,0,0.85);
    color: #ffc800;
    font-size: 0.65rem;
    padding: 2px 4px;
    border-radius: 3px;
    white-space: nowrap;
}

.slice-line.horizontal .slice-value {
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
}

.slice-line.vertical .slice-value {
    left: -30px;
    top: 50%;
    transform: translateY(-50%);
}

/* Zones colorées pour visualisation */
.zone-overlay {
    position: absolute;
    top: 0;
    height: 100%;
    pointer-events: none;
    opacity: 0.25;
    transition: opacity 0.2s;
}

.zone-overlay.start { background: #00ff00; }
.zone-overlay.middle { background: #ffff00; }
.zone-overlay.end { background: #ff0000; }

.zone-overlay.disabled { opacity: 0.05; }

/* Contrôles des zones */
.zone-controls {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.zone-control {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px;
    background: #252538;
    border-radius: 4px;
    border: 1px solid transparent;
    transition: border-color 0.2s;
}

.zone-control.active {
    border-color: #4a9eff;
}

.zone-control-label {
    font-size: 0.7rem;
    color: #aaa;
    margin-bottom: 4px;
}

.zone-control-toggle {
    cursor: pointer;
}

/* Inputs de valeur */
.slice-inputs {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.slice-input-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.slice-input-group label {
    font-size: 0.7rem;
    color: #888;
}

.slice-input-group input {
    width: 60px;
    background: #1a1a2e;
    border: 1px solid #3a3a5a;
    border-radius: 3px;
    color: #fff;
    padding: 3px 6px;
    font-size: 0.75rem;
}

.slice-input-group input:focus {
    border-color: #4a9eff;
    outline: none;
}

/* Sélecteur d'orientation */
.orientation-selector {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.orientation-btn {
    flex: 1;
    padding: 6px 12px;
    background: #252538;
    border: 1px solid #3a3a5a;
    border-radius: 4px;
    color: #aaa;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.orientation-btn:hover {
    background: #303048;
}

.orientation-btn.active {
    background: #4a9eff;
    border-color: #4a9eff;
    color: white;
}

/* ================================ */
/* === PREVIEW DANS L'ÉDITEUR === */
/* ================================ */

.tsg-preview-container {
    position: relative;
    background: #222;
    border-radius: 3px;
    overflow: hidden;
}

.tsg-preview-fill-layer {
    position: absolute;
    top: 0;
    left: 0;
    background: var(--fill-color, #4CAF50);
    transition: width 0.3s ease-out, height 0.3s ease-out;
    z-index: 1;
}

.tsg-preview-frame-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    display: flex;
    pointer-events: none;
}

.tsg-preview-frame-layer.horizontal {
    flex-direction: row;
}

.tsg-preview-frame-layer.vertical {
    flex-direction: column;
}

/* Zone indicators pour debug/preview */
.tsg-zone-indicator {
    position: absolute;
    font-size: 0.5rem;
    color: white;
    background: rgba(0,0,0,0.7);
    padding: 1px 3px;
    border-radius: 2px;
    z-index: 5;
}
