/* MapTrax v2.11.1.0 — Source File chip strip
   Pinned top-left over the map. Auto-hides when there's only one source
   so single-file workflows pay zero pixels. */

/* v2.11.1.1: position to the right of the Map Controls panel
   (controls is at left:10px, max-width:300px → right edge at 310px,
   add 10px gap = 320px). Slides to left:50px when the controls panel
   is collapsed (so it follows the sidebar in/out instead of getting
   stranded over empty space). Transition timing matches the controls'
   own 0.3s ease so they animate together. */
.source-chips-strip {
    position: absolute;
    top: 12px;
    left: 320px;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    max-width: calc(100% - 332px);
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #d4d4d4;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 12px;
    color: #222;
    pointer-events: auto;
    transition: left 0.3s ease, max-width 0.3s ease;
}

/* When the user collapses the Map Controls panel via the sidebar
   toggle, modeHandlers.toggleSidebar adds .sidebar-collapsed to <body>.
   Slide the chip strip left so it occupies the freed space and stays
   visible. */
body.sidebar-collapsed .source-chips-strip {
    left: 50px;
    max-width: calc(100% - 62px);
}

.source-chips-label {
    font-weight: 600;
    color: #555;
    margin-right: 2px;
}

.source-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border: 1px solid #b9b9b9;
    border-radius: 14px;
    background: #fff;
    color: #222;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, opacity 0.12s ease;
    max-width: 240px;
}

.source-chip:hover {
    background: #f0f6ff;
    border-color: #1976d2;
}

.source-chip-icon {
    font-size: 11px;
    line-height: 1;
}

.source-chip-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
}

.source-chip-count {
    font-variant-numeric: tabular-nums;
    color: #666;
    font-size: 11px;
    background: #f1f1f1;
    padding: 1px 6px;
    border-radius: 8px;
    min-width: 20px;
    text-align: center;
}

/* Hidden state — dimmer + strikethrough text so off-vs-on is obvious
   at a glance without needing to read the icon. */
.source-chip-hidden {
    opacity: 0.55;
    background: #f5f5f5;
    border-color: #ccc;
}

.source-chip-hidden .source-chip-text {
    text-decoration: line-through;
    color: #777;
}

.source-chip-hidden .source-chip-count {
    background: #e8e8e8;
    color: #888;
}

/* Right-click menu — same visual language as the chip strip */
.source-chips-menu {
    position: fixed;
    z-index: 9999;
    min-width: 220px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    padding: 4px 0;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 13px;
    color: #222;
}

.source-chips-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 14px;
    background: transparent;
    border: 0;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.source-chips-menu-item:hover {
    background: #f0f6ff;
    color: #1976d2;
}

.source-chips-menu-item-danger {
    color: #c62828;
}

.source-chips-menu-item-danger:hover {
    background: #fdecea;
    color: #c62828;
}
