/* ============================================================
   Collecte panel — 3-column layout (tree / grid / map)
   ============================================================ */

.collecte-panel {
    padding: 10px;
    background: #fff;
}

.collecte-panel.collecte-locked .collecte-toolbar button,
.collecte-panel.collecte-locked .collecte-grid-container .grid-item {
    opacity: 0.6;
    pointer-events: none;
}

.collecte-lock-banner {
    margin-bottom: 10px;
}

.collecte-lock-banner .fas {
    margin-right: 6px;
}

/* ---- Header ---- */
.collecte-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 8px;
}

.collecte-stats .label {
    margin-right: 6px;
    font-weight: normal;
}

.collecte-stats .label .fas {
    margin-right: 3px;
}

.collecte-actions .btn {
    margin-left: 4px;
}

/* ---- Toolbar (bulk reclassify buttons, P3.6) ---- */
.collecte-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 4px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 8px;
    min-height: 36px;
}

.collecte-toolbar-selection {
    display: flex;
    align-items: center;
    gap: 8px;
}

.collecte-toolbar-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    background: #f0f0f0;
    border-radius: 3px;
    min-width: 80px;
}

.collecte-toolbar-count .collecte-sel-count {
    font-weight: bold;
    color: #2a6496;
}

.collecte-toolbar-bulk {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.collecte-toolbar-label {
    margin-right: 2px;
}

.collecte-bulk-btn[disabled],
.collecte-bulk-btn.disabled,
.collecte-bulk-trash[disabled],
.collecte-bulk-trash.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.collecte-bulk-trash {
    margin-left: 4px;
}

/* Remove visible focus ring on panel — keyboard shortcuts still work via tabindex */
.collecte-panel:focus {
    outline: none;
}

/* ---- Body (3 columns) ---- */
.collecte-body {
    display: flex;
    flex-direction: row;
    gap: 8px;
    min-height: 420px;
}

.collecte-column {
    display: flex;
    flex-direction: column;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    background: #fafafa;
}

.collecte-column-tree {
    flex: 0 0 240px;
}

.collecte-column-grid {
    flex: 1 1 auto;
    min-width: 0;
}

.collecte-column-map {
    flex: 0 0 320px;
}

.collecte-column-header {
    padding: 6px 10px;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
    font-weight: bold;
    font-size: 12px;
    color: #555;
}

.collecte-column-header .fas {
    margin-right: 4px;
}

.collecte-column-content {
    flex: 1 1 auto;
    overflow: auto;
    padding: 8px;
}

/* ---- Tree column (P3.4) ---- */
.collecte-tree-container {
    font-size: 12px;
    padding: 4px 0;
}

.collecte-tree-ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.collecte-tree-li {
    line-height: 22px;
}

.collecte-tree-row {
    display: flex;
    align-items: center;
    cursor: default;
    user-select: none;
    border-radius: 2px;
    padding-right: 6px;
}

.collecte-tree-row:hover {
    background: #eef5fa;
}

.collecte-tree-li.active > .collecte-tree-row {
    background: #d6e9f8;
    font-weight: bold;
}

.collecte-tree-toggle {
    display: inline-block;
    width: 14px;
    text-align: center;
    cursor: pointer;
    color: #666;
    flex: 0 0 auto;
}

.collecte-tree-toggle:hover {
    color: #000;
}

.collecte-tree-toggle-spacer {
    display: inline-block;
    width: 14px;
    flex: 0 0 auto;
}

.collecte-tree-label {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    cursor: pointer;
    overflow: hidden;
    padding: 0 4px;
}

.collecte-tree-icon {
    color: #f0c14b;
    margin-right: 4px;
    flex: 0 0 auto;
}

.collecte-tree-name {
    flex: 1 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.collecte-tree-count {
    flex: 0 0 auto;
    color: #888;
    font-size: 10px;
    margin-left: 6px;
    background: #f0f0f0;
    border-radius: 8px;
    padding: 1px 6px;
}

.collecte-tree-li.active > .collecte-tree-row .collecte-tree-count {
    background: #fff;
    color: #2a6496;
}

/* ---- Grid column (P3.5) ---- */
.collecte-grid-container {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 6px;
}

.collecte-grid-empty {
    padding: 16px;
    width: 100%;
    text-align: center;
    color: #888;
}

.collecte-grid-item {
    width: 130px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #fff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    user-select: none;
    overflow: hidden;
    transition: border-color 0.1s, box-shadow 0.1s;
}

.collecte-grid-item:hover {
    border-color: #2a6496;
}

.collecte-grid-item:focus {
    outline: none;
    border-color: #2a6496;
}

.collecte-grid-item.selected {
    border-color: #2a6496;
    background: #d6e9f8;
    box-shadow: 0 0 0 2px #2a6496 inset;
}

.collecte-grid-item.is-trash {
    opacity: 0.5;
    background: #f5f5f5;
}

.collecte-grid-item.is-trash .collecte-grid-thumb img {
    filter: grayscale(80%);
}

.collecte-grid-thumb {
    width: 100%;
    height: 100px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.collecte-grid-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    width: 100%;
    height: 100%;
}

.collecte-grid-icon-fallback {
    font-size: 36px;
    color: #999;
}

.collecte-grid-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 3px 4px;
    background: #fafafa;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    min-height: 20px;
}

.collecte-badge {
    display: inline-flex;
    align-items: center;
    font-size: 9px;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 2px;
    background: #e7e7e7;
    color: #444;
    white-space: nowrap;
}

.collecte-badge .fas {
    font-size: 9px;
}

.collecte-badge-gps {
    background: #ddd;
    color: #999;
}

.collecte-badge-gps.on {
    background: #5cb85c;
    color: #fff;
}

.collecte-badge-purpose {
    background: #6c757d;
    color: #fff;
    font-weight: bold;
}

.collecte-purpose-Photogrammetry { background: #007bff; }
.collecte-purpose-Oblique { background: #17a2b8; }
.collecte-purpose-Thermal { background: #dc3545; }
.collecte-purpose-LiDAR { background: #6610f2; }
.collecte-purpose-RTK { background: #e83e8c; }
.collecte-purpose-Video { background: #fd7e14; }
.collecte-purpose-Illustration { background: #20c997; }
.collecte-purpose-Trash { background: #6c757d; }

.collecte-badge-category {
    background: #f0ad4e;
    color: #fff;
}

.collecte-badge-time {
    background: #ececec;
    color: #555;
}

.collecte-badge-time .fas {
    margin-right: 2px;
}

.collecte-grid-name {
    padding: 3px 5px;
    font-size: 10px;
    line-height: 1.3;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.collecte-grid-count {
    background: #e7e7e7;
    color: #555;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 4px;
}

/* ---- Map column (P3.7) ---- */
.collecte-map-container {
    padding: 0;
    position: relative;
    height: 100%;
    min-height: 380px;
}

.collecte-map-container.collecte-map-ready {
    background: #eef2f6;
}

/* Leaflet fixes inside a bottom panel with tight space */
.collecte-map-container .leaflet-container {
    height: 100%;
    width: 100%;
    font-size: 11px;
}

/* Avoid Leaflet zoom control stealing focus outline from keyboard */
.collecte-map-container .leaflet-control-zoom a {
    outline: none;
}

/* ---- Range chronologique (P3.8) ---- */
.collecte-range {
    margin-top: 8px;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    background: #fafafa;
}

.collecte-range-header {
    font-size: 11px;
    font-weight: bold;
    color: #555;
    padding-bottom: 4px;
    border-bottom: 1px solid #eee;
    margin-bottom: 6px;
}

.collecte-range-header .fas {
    margin-right: 4px;
    color: #2a6496;
}

.collecte-range-body {
    min-height: 40px;
}

.collecte-range-empty {
    padding: 8px;
    text-align: center;
}

.collecte-range-empty .fas {
    margin-right: 4px;
}

.collecte-range-wrap {
    padding: 2px 0;
}

.collecte-range-labels {
    font-size: 11px;
    color: #555;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.collecte-range-labels .collecte-range-label-low,
.collecte-range-labels .collecte-range-label-high {
    font-weight: bold;
    color: #2a6496;
}

.collecte-range-labels .collecte-range-label-sep {
    color: #999;
}

.collecte-range-labels .collecte-range-label-count {
    margin-left: auto;
    font-size: 10px;
}

/* 2-handle slider (dual overlapped <input type="range">) */
.collecte-range-slider {
    position: relative;
    height: 28px;
    margin: 6px 0 4px 0;
}

.collecte-range-track {
    position: absolute;
    top: 12px;
    left: 0;
    right: 0;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
}

.collecte-range-selected {
    position: absolute;
    top: 12px;
    height: 4px;
    background: #2a6496;
    border-radius: 2px;
    pointer-events: none;
}

.collecte-range-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 28px;
    background: none;
    pointer-events: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    margin: 0;
    padding: 0;
    outline: none;
}

.collecte-range-low {
    z-index: 2;
}

.collecte-range-high {
    z-index: 1;
}

.collecte-range-input::-webkit-slider-runnable-track {
    background: transparent;
    border: none;
}

.collecte-range-input::-moz-range-track {
    background: transparent;
    border: none;
}

.collecte-range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    pointer-events: auto;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #2a6496;
    border: 2px solid #fff;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    margin-top: -6px;
}

.collecte-range-input::-moz-range-thumb {
    pointer-events: auto;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #2a6496;
    border: 2px solid #fff;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

.collecte-range-input:disabled::-webkit-slider-thumb {
    background: #bbb;
    cursor: not-allowed;
}

.collecte-range-input:disabled::-moz-range-thumb {
    background: #bbb;
    cursor: not-allowed;
}

.collecte-range-actions {
    text-align: right;
    margin-top: 2px;
}

.collecte-range-reset[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Lock timeline interactions when collecte is validated */
.collecte-panel.collecte-locked .collecte-range-input,
.collecte-panel.collecte-locked .collecte-range-reset {
    pointer-events: none;
    opacity: 0.5;
}

/* ---- Summary panel (bottom panel on detail view) ---- */
.collecte-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}

.collecte-summary-loading {
    padding: 12px 0;
}

.collecte-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 10px;
    flex-wrap: wrap;
}

.collecte-summary-stats {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.collecte-summary-stats .label {
    font-weight: normal;
}

.collecte-summary-stats .label .fas {
    margin-right: 2px;
}

.collecte-purpose-badge {
    font-size: 11px;
}

.collecte-summary-action {
    flex: 0 0 auto;
}

/* ---- Loading / error ---- */
.collecte-loading,
.collecte-error {
    padding: 20px;
}

/* ---- Responsive ---- */
@media (max-width: 1200px) {
    .collecte-body {
        flex-wrap: wrap;
    }
    .collecte-column-tree {
        flex: 1 1 100%;
        min-height: 150px;
    }
    .collecte-column-grid,
    .collecte-column-map {
        flex: 1 1 45%;
        min-width: 300px;
    }
}

@media (max-width: 800px) {
    .collecte-column-grid,
    .collecte-column-map {
        flex: 1 1 100%;
        min-height: 300px;
    }
}
