/* ─── Viewer Left Panel ─────────────────────────────────────────
 * Dark glassmorphism overlay matching existing viewer panels.
 * Absolute positioned over the viewer content, never pushes it.
 */

.viewer-left-panel {
    position: absolute;
    top: 12px;
    left: 12px;
    bottom: 12px;
    width: 280px;
    z-index: 900;
    background: rgba(20, 20, 20, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.25s ease, opacity 0.25s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    color: #ccc;
}

/* ─── Minimized state ────────────────────────────────────────── */

.viewer-left-panel.minimized {
    width: 36px;
    cursor: pointer;
}

.viewer-left-panel.minimized .vlp-content {
    display: none;
}

.viewer-left-panel.minimized .vlp-toggle {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ─── Toggle button ──────────────────────────────────────────── */

.vlp-toggle {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #888;
    font-size: 12px;
    z-index: 2;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.vlp-toggle:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.viewer-left-panel.minimized .vlp-toggle {
    position: static;
    width: 100%;
    height: 100%;
    font-size: 14px;
}

/* ─── Content container ──────────────────────────────────────── */

.vlp-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    padding-top: 4px;
}

/* ─── Workspace selector ─────────────────────────────────────── */

.vlp-workspace {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.vlp-workspace select {
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ddd;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 12px;
    outline: none;
    cursor: pointer;
}

.vlp-workspace select:focus {
    border-color: rgba(0, 188, 212, 0.5);
}

.vlp-workspace select option {
    background: #222;
    color: #ddd;
}

/* ─── Read-only banner ───────────────────────────────────────── */

.vlp-readonly-banner {
    display: none;
    padding: 6px 12px;
    background: rgba(255, 152, 0, 0.15);
    border-bottom: 1px solid rgba(255, 152, 0, 0.25);
    color: #ffb74d;
    font-size: 11px;
    text-align: center;
}

.vlp-readonly-banner.visible {
    display: block;
}

/* ─── Tabs ───────────────────────────────────────────────────── */

.vlp-tabs {
    display: flex;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 0 8px;
}

.vlp-tabs::-webkit-scrollbar {
    height: 3px;
}

.vlp-tabs::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
}

.vlp-tab {
    flex-shrink: 0;
    padding: 8px 8px;
    text-align: center;
    font-size: 12px;
    color: #888;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    user-select: none;
}

.vlp-tab:hover {
    color: #bbb;
}

.vlp-tab.active {
    color: #00bcd4;
    border-bottom-color: #00bcd4;
}

/* ─── Tab content ────────────────────────────────────────────── */

.vlp-tab-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.vlp-tab-content::-webkit-scrollbar {
    width: 4px;
}

.vlp-tab-content::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
}

.vlp-tab-pane {
    display: none;
    padding: 8px 0;
}

.vlp-tab-pane.active {
    display: block;
}

/* ─── Data section dividers ──────────────────────────────────── */

.vlp-data-section-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    color: #8899aa;
    padding: 8px 12px 4px;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.vlp-data-count {
    font-size: 10px;
    color: #888;
    margin-left: 4px;
}

/* ─── Data Files rows ────────────────────────────────────────── */

.vlp-file-row {
    display: flex;
    align-items: center;
    padding: 7px 12px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.15s;
    gap: 8px;
    border-left: 3px solid transparent;
}

.vlp-file-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

.vlp-file-row.vlp-selected {
    border-left-color: #4fc3f7;
    background: rgba(79, 195, 247, 0.1);
}

.vlp-file-icon {
    width: 20px;
    text-align: center;
    font-size: 12px;
    color: #888;
    flex-shrink: 0;
}

.vlp-file-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
}

.vlp-file-visibility {
    flex-shrink: 0;
    margin: 0;
    cursor: pointer;
}

.vlp-file-zoom-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 11px;
    flex-shrink: 0;
    transition: color 0.15s;
}

.vlp-file-zoom-btn:hover {
    color: #00bcd4;
}

.vlp-eye-toggle {
    width: 20px;
    text-align: center;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.15s;
}

.vlp-eye-toggle:hover {
    color: #00bcd4;
}

.vlp-eye-toggle.vlp-hidden {
    color: #444;
}

/* ─── Layer group ────────────────────────────────────────────── */

.vlp-layer {
    margin-bottom: 2px;
}

.vlp-layer-header {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    cursor: pointer;
    transition: background 0.12s;
    gap: 6px;
    user-select: none;
}

.vlp-layer-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.vlp-drag-handle {
    width: 14px;
    text-align: center;
    font-size: 10px;
    color: #555;
    cursor: grab;
    flex-shrink: 0;
}

.vlp-drag-handle:active {
    cursor: grabbing;
}

.vlp-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.vlp-layer-name {
    flex: 1;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vlp-layer-count {
    font-size: 11px;
    color: #666;
    flex-shrink: 0;
}

.vlp-expand-arrow {
    width: 16px;
    text-align: center;
    font-size: 10px;
    color: #666;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.vlp-layer.expanded .vlp-expand-arrow {
    transform: rotate(90deg);
}

/* ─── Active layer ──────────────────────────────────────────── */

.vlp-layer.vlp-active-layer > .vlp-layer-header {
    background: rgba(0, 188, 212, 0.08);
}

.vlp-layer.vlp-active-layer > .vlp-layer-header .vlp-color-dot {
    box-shadow: 0 0 0 2px rgba(0, 188, 212, 0.5);
}

.vlp-layer.vlp-active-layer > .vlp-layer-header .vlp-layer-name {
    color: #e0e0e0;
}

/* ─── Selected layer ─────────────────────────────────────────── */

.vlp-layer.vlp-layer-selected > .vlp-layer-header {
    background: rgba(0, 188, 212, 0.12);
    border-left: 3px solid #00bcd4;
}

.vlp-layer.vlp-layer-selected > .vlp-layer-header .vlp-layer-name {
    color: #e0e0e0;
}

/* ─── Layer elements ─────────────────────────────────────────── */

.vlp-layer-elements {
    display: none;
    padding-left: 18px;
}

.vlp-layer.expanded .vlp-layer-elements {
    display: block;
    min-height: 24px;
}

.vlp-element-row {
    display: flex;
    align-items: center;
    padding: 5px 12px;
    cursor: pointer;
    transition: background 0.12s;
    gap: 6px;
    border-left: 3px solid transparent;
}

.vlp-element-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.vlp-element-row.vlp-selected {
    border-left-color: #00bcd4;
    background: rgba(0, 188, 212, 0.08);
}

.vlp-element-icon {
    width: 16px;
    text-align: center;
    font-size: 11px;
    color: #888;
    flex-shrink: 0;
}

.vlp-element-name {
    flex: 1;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vlp-element-type {
    font-size: 10px;
    color: #555;
    flex-shrink: 0;
}

/* ─── Layer eye toggle ──────────────────────────────────────── */

.vlp-layer-eye {
    width: 20px;
    text-align: center;
    font-size: 11px;
    color: #666;
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.15s;
}

.vlp-layer-eye:hover {
    color: #00bcd4;
}

.vlp-layer-eye.vlp-hidden {
    color: #444;
}

/* ─── Element eye toggle ────────────────────────────────────── */

.vlp-element-eye {
    width: 18px;
    text-align: center;
    font-size: 10px;
    color: #666;
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.15s;
}

.vlp-element-eye:hover {
    color: #00bcd4;
}

.vlp-element-eye.vlp-hidden {
    color: #444;
}

/* ─── Element drag handle ───────────────────────────────────── */

.vlp-elem-drag-handle {
    width: 12px;
    text-align: center;
    font-size: 9px;
    color: #444;
    cursor: grab;
    flex-shrink: 0;
}

.vlp-elem-drag-handle:active {
    cursor: grabbing;
}

/* ─── Element drag state ────────────────────────────────────── */

.vlp-element-row.dragging {
    opacity: 0.5;
}

.vlp-element-row.drag-over-top {
    border-top: 2px solid #00bcd4;
}

.vlp-element-row.drag-over-bottom {
    border-bottom: 2px solid #00bcd4;
}

.vlp-layer-elements.drag-over-end {
    border-bottom: 2px solid #00bcd4;
}

.vlp-layer-header.drag-over-element-target {
    background: rgba(0, 188, 212, 0.12) !important;
}

/* ─── Add layer button ───────────────────────────────────────── */

.vlp-add-layer-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 8px 12px;
    padding: 7px;
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #888;
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.vlp-add-layer-btn:hover {
    border-color: rgba(0, 188, 212, 0.4);
    color: #00bcd4;
}

/* ─── Empty state ────────────────────────────────────────────── */

.vlp-empty {
    padding: 20px 12px;
    text-align: center;
    color: #555;
    font-size: 12px;
}

/* ─── Dragging state ─────────────────────────────────────────── */

.vlp-layer.dragging {
    opacity: 0.5;
}

.vlp-layer.drag-over {
    border-top: 2px solid #00bcd4;
}

.vlp-layer.drag-over-bottom {
    border-bottom: 2px solid #00bcd4;
}

/* ─── Anomalies Tab ──────────────────────────────────────────── */

.vlp-anomaly-count {
    font-size: 10px;
    color: #888;
    margin-left: 4px;
}

.vlp-anomalies-header {
    padding: 8px 12px;
    font-size: 11px;
    color: #888;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.vlp-anomaly-group {
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.vlp-anomaly-group-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    cursor: pointer;
    transition: background 0.12s;
}

.vlp-anomaly-group-header:hover {
    background: rgba(255,255,255,0.04);
}

.vlp-anomaly-group-icon {
    color: #666;
    font-size: 11px;
    width: 16px;
    text-align: center;
}

.vlp-anomaly-group-name {
    flex: 1;
    font-size: 12px;
    color: #bbb;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vlp-anomaly-group-count {
    font-size: 10px;
    color: #666;
    background: rgba(255,255,255,0.06);
    padding: 1px 6px;
    border-radius: 8px;
}

.vlp-anomaly-group-expand {
    color: #555;
    font-size: 10px;
    transition: transform 0.2s;
    width: 16px;
    text-align: center;
}

.vlp-anomaly-group.expanded .vlp-anomaly-group-expand {
    transform: rotate(90deg);
}

.vlp-anomaly-items {
    display: none;
    padding: 0 0 4px 0;
}

.vlp-anomaly-group.expanded .vlp-anomaly-items {
    display: block;
}

.vlp-anomaly-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px 4px 34px;
    cursor: pointer;
    transition: background 0.12s;
    border-left: 3px solid transparent;
}

.vlp-anomaly-row:hover {
    background: rgba(255,255,255,0.04);
}

.vlp-anomaly-color {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.vlp-anomaly-name {
    flex: 1;
    font-size: 11px;
    color: #bbb;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vlp-anomaly-severity {
    font-size: 9px;
    font-weight: 500;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(255,152,0,0.15);
    color: #ff9800;
}

.vlp-anomaly-row.severity-critical .vlp-anomaly-severity {
    background: rgba(244,67,54,0.15);
    color: #f44336;
}

.vlp-anomaly-row.severity-high .vlp-anomaly-severity {
    background: rgba(255,87,34,0.15);
    color: #ff5722;
}

.vlp-anomaly-row.severity-medium .vlp-anomaly-severity {
    background: rgba(255,152,0,0.15);
    color: #ff9800;
}

.vlp-anomaly-row.severity-low .vlp-anomaly-severity {
    background: rgba(255,193,7,0.15);
    color: #ffc107;
}

/* ─── Category Form ──────────────────────────────────────────── */

.vlp-anomaly-add-category {
    padding: 8px 12px;
}

.vlp-add-category-btn {
    background: rgba(255,255,255,0.05);
    border: 1px dashed rgba(255,255,255,0.15);
    color: #888;
    padding: 5px 10px;
    font-size: 11px;
    cursor: pointer;
    border-radius: 4px;
    width: 100%;
    text-align: center;
    transition: background 0.12s, color 0.12s;
}

.vlp-add-category-btn:hover {
    background: rgba(255,255,255,0.08);
    color: #bbb;
}

.vlp-category-form {
    display: flex;
    gap: 4px;
    padding: 6px 12px;
    align-items: center;
}

.vlp-cat-name {
    flex: 1;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: #ddd;
    padding: 4px 6px;
    font-size: 11px;
    border-radius: 3px;
}

.vlp-cat-name:focus {
    border-color: #00bcd4;
    outline: none;
}

.vlp-cat-color {
    width: 28px;
    height: 24px;
    padding: 0;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 3px;
    cursor: pointer;
    background: transparent;
}

.vlp-cat-save,
.vlp-cat-cancel {
    background: none;
    border: none;
    cursor: pointer;
    color: #888;
    font-size: 12px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: color 0.12s, background 0.12s;
}

.vlp-cat-save:hover { color: #4caf50; background: rgba(76,175,80,0.1); }
.vlp-cat-cancel:hover { color: #f44336; background: rgba(244,67,54,0.1); }

/* ─── Exports Tab ────────────────────────────────────────────── */

.vlp-export-count {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-left: 2px;
}

.vlp-export-count.vlp-export-notif {
    background: #e53935;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 8px;
    padding: 0 4px;
    display: inline-block;
}

.vlp-export-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    border-left: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}

.vlp-export-row:hover {
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
}

.vlp-export-row.vlp-selected {
    border-left-color: #4fc3f7;
    background: rgba(79, 195, 247, 0.12);
}

.vlp-export-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: rgba(79, 195, 247, 0.15);
    color: #4fc3f7;
    font-size: 13px;
}

.vlp-export-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.vlp-export-name {
    font-size: 12px;
    font-weight: 500;
    color: #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vlp-export-meta {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 2px;
}

.vlp-export-status {
    font-weight: 500;
}

.vlp-export-pending {
    color: #ffb74d;
}

.vlp-export-processing {
    color: #ffb74d;
}

.vlp-export-done {
    color: #81c784;
}

.vlp-export-error {
    color: #e57373;
}

.vlp-export-error-msg {
    font-size: 10px;
    color: #e57373;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vlp-export-actions {
    flex-shrink: 0;
    display: flex;
    gap: 4px;
    align-items: center;
}

.vlp-export-download-btn,
.vlp-export-delete-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 12px;
    transition: all 0.15s;
}

.vlp-export-download-btn:hover {
    color: #4fc3f7;
    background: rgba(79, 195, 247, 0.15);
}

.vlp-export-delete-btn:hover {
    color: #e57373;
    background: rgba(229, 115, 115, 0.15);
}

/* ─── Responsive ─────────────────────────────────────────────── */

@media (max-width: 768px) {
    .viewer-left-panel {
        width: 240px;
    }
}
