:root { 
    --primary: #2c3e50; 
    --accent: #0984e3; 
    --success: #2ecc71; 
    --bg: #1e293b; 
    --border: #cbd5e1; 
}

/* 1. Agrandissement de la zone de liste */
#defect-list-container {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

/* 2. Style de la barre de recherche */
.search-defect-input {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.search-defect-input:focus {
    border-color: #0984e3;
    outline: none;
}

/* 3. Style des boutons raccourcis (Favoris) */
.quick-defects-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.quick-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #475569;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 11px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
}

.quick-btn:hover {
    background: #0984e3;
    color: white;
    border-color: #0984e3;
}

/* --- STRUCTURE GLOBALE --- */

body { 
    font-family: 'Segoe UI', system-ui, sans-serif; 
    margin: 0; 
    padding: 0; 
    background: var(--bg); 
    color: #334155; 
    height: 100vh; 
    display: flex; 
    flex-direction: column; 
}

header { 
    background: var(--primary); 
    color: white; 
    padding: 12px 25px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
}

.btn { 
    padding: 8px 14px; 
    border: none; 
    border-radius: 4px; 
    font-weight: bold; 
    cursor: pointer; 
    font-size: 13px; 
    text-decoration: none; 
}

.main-layout { 
    display: grid; 
    grid-template-columns: 320px 1fr 350px; 
    flex: 1; 
    overflow: hidden; 
    background: #111827; 
}

.sidebar { 
    background: white; 
    border-right: 1px solid var(--border); 
    padding: 15px; 
    display: flex; 
    flex-direction: column; 
    gap: 15px; 
    overflow-y: auto; 
}

.workspace { 
    background: var(--bg); 
    position: relative; 
    flex: 1; 
    overflow: hidden; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
}

canvas { 
    display: block; 
    width: 100%; 
    height: 100%; 
    cursor: crosshair; 
}

.zoom-badge { 
    position: absolute; 
    top: 15px; 
    right: 15px; 
    background: rgba(15, 23, 42, 0.85); 
    color: #f8fafc; 
    padding: 6px 12px; 
    border-radius: 20px; 
    font-size: 12px; 
    font-weight: 600; 
    font-family: monospace; 
    z-index: 10; 
    border: 1px solid rgba(255,255,255,0.1); 
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.2); 
}

.measurement-config-box { 
    position: absolute; 
    top: 55px; 
    right: 15px; 
    width: 280px; 
    background: rgba(255, 251, 235, 0.95); 
    border: 1px solid #fde68a; 
    border-radius: 8px; 
    padding: 12px; 
    display: flex; 
    flex-direction: column; 
    gap: 8px; 
    z-index: 10; 
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3); 
}

canvas.panning-mode { 
    cursor: grabbing !important; 
}

.typo-grid { 
    display: grid; 
    grid-template-columns: 1fr; 
    gap: 6px; 
    max-height: 150px; 
    overflow-y: auto; 
    padding-right: 4px; 
}

.btn-typo { 
    padding: 10px; 
    border: 1px solid var(--border); 
    border-radius: 6px; 
    text-align: left; 
    background: white; 
    cursor: pointer; 
    font-weight: 500; 
    font-size: 12px; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    transition: all 0.2s; 
    color: #1e293b; 
}

.btn-typo:hover { 
    background: #f1f5f9; 
    transform: translateX(2px); 
}

.btn-typo.active { 
    border-color: #000; 
    box-shadow: inset 0 0 0 2px #000; 
    font-weight: bold; 
}

.color-dot { 
    width: 12px; 
    height: 12px; 
    border-radius: 50%; 
    display: inline-block; 
    border: 1px solid rgba(0,0,0,0.1); 
}

body { font-family: 'Segoe UI', system-ui, sans-serif; margin: 0; padding: 0; background: var(--bg); color: #334155; height: 100vh; display: flex; flex-direction: column; }

header { background: #2c3e50; color: white; padding: 12px 25px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.btn { padding: 8px 14px; border: none; border-radius: 4px; font-weight: bold; cursor: pointer; font-size: 13px; text-decoration: none; }

.main-layout { display: grid; grid-template-columns: 320px 1fr 350px; flex: 1; overflow: hidden; background: #111827; }
.sidebar { background: white; border-right: 1px solid var(--border); padding: 15px; display: flex; flex-direction: column; gap: 15px; overflow-y: auto; }

.workspace { background: #1e293b; position: relative; flex: 1; overflow: hidden; display: flex; justify-content: center; align-items: center; }
canvas { display: block; width: 100%; height: 100%; cursor: crosshair; }

.zoom-badge { position: absolute; top: 15px; right: 15px; background: rgba(15, 23, 42, 0.85); color: #f8fafc; padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; font-family: monospace; z-index: 10; border: 1px solid rgba(255,255,255,0.1); box-shadow: 0 4px 6px -1px rgba(0,0,0,0.2); }
.measurement-config-box { position: absolute; top: 55px; right: 15px; width: 280px; background: rgba(255, 251, 235, 0.95); border: 1px solid #fde68a; border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 8px; z-index: 10; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3); }

canvas.panning-mode { cursor: grabbing !important; }

.typo-grid { display: grid; grid-template-columns: 1fr; gap: 6px; max-height: 150px; overflow-y: auto; padding-right: 4px; }
.btn-typo { padding: 10px; border: 1px solid var(--border); border-radius: 6px; text-align: left; background: white; cursor: pointer; font-weight: 500; font-size: 12px; display: flex; align-items: center; gap: 8px; transition: all 0.2s; color: #1e293b; }
.btn-typo:hover { background: #f1f5f9; transform: translateX(2px); }
.btn-typo.active { border-color: #000; box-shadow: inset 0 0 0 2px #000; font-weight: bold; }
.color-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0,0,0,0.1); }

.img-list { display: flex; flex-direction: column; gap: 5px; overflow-y: auto; flex: 1; padding-right: 4px; }
.img-item { padding: 10px 12px; background: #f1f5f9; border-radius: 4px; cursor: pointer; font-size: 13px; font-family: monospace; border: 1px solid transparent; word-break: break-all; transition: all 0.15s ease; color: #334155; }
.img-item:hover { background: #e2e8f0; }
.img-item.active { background: #dbeafe !important; color: #1e40af !important; border-color: #bfdbfe !important; font-weight: bold; box-shadow: 0 0 0 1px #1e40af; }
.img-item.has-defect { font-weight: 600; background: #ffffff; border-left: 5px solid currentColor; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }

.defect-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; max-height: 220px; border-top: 1px solid var(--border); padding-top: 10px; }
.defect-card { display: flex; align-items: center; gap: 10px; padding: 8px; background: #ffffff; border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); cursor: pointer; transition: transform 0.1s; }
.defect-card:hover { transform: scale(1.01); border-color: #94a3b8; }
.defect-thumb { width: 55px; height: 55px; object-fit: cover; border-radius: 4px; border: 1px solid #cbd5e1; background: #e2e8f0; }
.defect-info { flex: 1; font-size: 12px; color: #334155; line-height: 1.4; overflow: hidden; }
.defect-info b { color: #1e293b; font-size: 13px; display: block; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.defect-info span { font-size: 11px; color: #64748b; font-family: monospace; display: block; }
.btn-delete-defect { background: #fee2e2; color: #ef4444; border: none; padding: 6px; border-radius: 4px; cursor: pointer; display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; }
.btn-delete-defect:hover { background: #ef4444; color: white; }

.turbine-info-box { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.turbine-info-box label { font-size: 11px; font-weight: bold; color: #64748b; }
.turbine-info-box input { width: 100%; padding: 5px; border: 1px solid #cbd5e1; border-radius: 4px; font-size: 12px; box-sizing: border-box; }

.vortex-helper { background: #eff6ff; border: 1px dashed #3b82f6; border-radius: 6px; padding: 8px; font-size: 11px; color: #1e40af; margin-top: 5px; display: none; line-height: 1.4; }

.tool-selector-group { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.btn-tool { background: #f1f5f9; border: 1px solid var(--border); padding: 8px; border-radius: 4px; cursor: pointer; font-weight: 600; font-size: 11px; color: #475569; display: flex; align-items: center; justify-content: center; gap: 5px; transition: all 0.15s; }
.btn-tool:hover { background: #e2e8f0; }
.btn-tool.active { background: #3b82f6; color: white; border-color: #2563eb; box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3); }

#loupe-container { position: absolute; width: 140px; height: 140px; border: 3px solid #1e293b; border-radius: 50%; overflow: hidden; pointer-events: none; display: none; box-shadow: 0 8px 16px rgba(0,0,0,0.3), inset 0 0 8px rgba(0,0,0,0.2); z-index: 1000; background: #000; }
#loupe-canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.loupe-crosshair { position: absolute; top: 50%; left: 50%; width: 10px; height: 10px; transform: translate(-50%, -50%); pointer-events: none; }
.loupe-crosshair::before { content: ''; position: absolute; top: 4px; left: -5px; width: 20px; height: 2px; background: #ef4444; }
.loupe-crosshair::after { content: ''; position: absolute; top: -5px; left: 4px; width: 2px; height: 20px; background: #ef4444; }