/* Breadcrumb v1 — PSP session 17, Apr 26 2026
 * Styles match design tokens used in .filter-popup / .psp-badge.
 * Renders only when scope is active (.breadcrumb-active class).
 */

#breadcrumb-root {
    /* Reserve no space at root — fully collapsed when no scope active */
}

#breadcrumb-root.breadcrumb-active {
    /* Inside .sticky-bars (Apr 26 2026 — see library.html note). Margins
       give it a comfortable gap above the filter bar and below the
       bulk action bar that may appear underneath. */
    margin: 8px 16px 4px;
}

.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(20, 20, 35, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* firefox */
}
.breadcrumb-nav::-webkit-scrollbar { display: none; }

.bc-segment {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background-color 0.12s ease, color 0.12s ease;
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.bc-segment:hover {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.95);
}

.bc-segment.bc-current {
    color: #fff;
    font-weight: 700;
    background: rgba(236, 72, 153, 0.18);
    border: 1px solid rgba(236, 72, 153, 0.32);
    padding: 4px 10px;
    box-shadow: 0 0 0 1px rgba(236, 72, 153, 0.10) inset;
    cursor: default;
}

.bc-segment.bc-current:hover {
    background: rgba(236, 72, 153, 0.18);
}

.bc-segment.bc-root {
    color: rgba(255, 255, 255, 0.55);
    font-size: 13px;
}

/* R2 (2026-05-17): tier-depth visual hierarchy. Library = boldest;
 * each child level softens. Roughy's direction: "font is a little
 * deeper you know as you move down the tiers." The data-depth attr
 * is set by breadcrumb.js _renderDesktop — 0 for Library, 1+ for
 * descendant tiers. Softens via opacity + size descent. */
.bc-segment[data-depth="0"] {
    color: rgba(255, 255, 255, 0.92);
    font-weight: 600;
    font-size: 14px;
}

.bc-segment[data-depth="1"] {
    color: rgba(255, 255, 255, 0.78);
    font-size: 13.5px;
}

.bc-segment[data-depth="2"] {
    color: rgba(255, 255, 255, 0.68);
    font-size: 13px;
}

.bc-segment[data-depth="3"],
.bc-segment[data-depth="4"],
.bc-segment[data-depth="5"] {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12.5px;
}

/* Trail ghost pills (2026-05-17): segments DEEPER than current scope,
 * carried from the user's recent traversal. Clickable to scope back
 * in. Visually dimmed so they read as "where you came from" rather
 * than current state. Hover lifts them to suggest they're tappable. */
.bc-segment.bc-ghost {
    color: rgba(255, 255, 255, 0.42);
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    padding: 3px 9px;
    border-radius: 6px;
    font-style: italic;
    font-weight: 400;
}

.bc-segment.bc-ghost:hover {
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.08);
    border-style: solid;
    font-style: normal;
}

/* Separator before a ghost pill matches the ghost's dim treatment so
 * the visual break between active chain and trail is subtle but real. */
.bc-sep.bc-sep-ghost {
    color: rgba(255, 255, 255, 0.18);
}

/* 🏠 home glyph — slightly muted, sized to match the segment. */
.bc-home-glyph {
    display: inline-block;
    margin-right: 4px;
    font-size: 0.95em;
    opacity: 0.85;
    vertical-align: -1px;
}

/* The dedicated Library-at-root pill — when the user is at root
 * scope and not scoped into anything. Has slightly more presence
 * than the bc-root link inside a deeper breadcrumb, because at
 * root it's the only thing on the bar. */
.bc-segment.bc-home {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 600;
    font-size: 14px;
    background: rgba(99, 102, 241, 0.10);
    padding: 5px 12px;
    border-radius: 14px;
    border: 1px solid rgba(99, 102, 241, 0.22);
    cursor: default;
}

.bc-segment.bc-home:hover {
    background: rgba(99, 102, 241, 0.10);
}

/* Special class on the nav when at root scope — lets us tweak
 * spacing or sub-layout for the home-only state without affecting
 * scoped breadcrumbs. */
.breadcrumb-nav.breadcrumb-at-root {
    padding-left: 2px;
}

.bc-sep {
    color: rgba(255, 255, 255, 0.3);
    font-size: 14px;
    user-select: none;
    flex-shrink: 0;
}

.bc-exit {
    margin-left: auto;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s ease;
    flex-shrink: 0;
    padding: 0;
}

.bc-exit:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: rgba(239, 68, 68, 0.9);
}

/* ↑ Up button — Apr 29 2026 — explicit "go up one level" affordance.
 * Sits between the breadcrumb chain and the × Exit button. Distinct
 * styling: emerald accent (matches Build tier color and the "↑ go up"
 * gesture used in container cards) so it's visually findable even
 * when chain segments are dense. Sits BEFORE bc-exit so margin-left:auto
 * on bc-exit pushes both to the right cluster. */
.bc-up {
    margin-left: auto;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: rgba(110, 231, 183, 0.95);
    height: 28px;
    border-radius: 14px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0 12px;
    transition: all 0.12s ease;
    flex-shrink: 0;
}

.bc-up:hover {
    background: rgba(16, 185, 129, 0.22);
    border-color: rgba(16, 185, 129, 0.55);
    color: #fff;
}

/* 🎬 Open Cut editor — present when scoped into a Reel. Mirrors
 * bc-up's shape but uses the BTO accent color (purple) so the user
 * sees the editor affordance distinctly from the Up navigation.
 * Added 2026-05-16 per Roughy. */
.bc-bto {
    margin-left: auto;
    background: rgba(139, 92, 246, 0.14);
    border: 1px solid rgba(139, 92, 246, 0.40);
    color: rgba(196, 181, 253, 0.95);
    height: 28px;
    border-radius: 14px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0 12px;
    transition: all 0.12s ease;
    flex-shrink: 0;
}

.bc-bto:hover {
    background: rgba(139, 92, 246, 0.26);
    border-color: rgba(139, 92, 246, 0.65);
    color: #fff;
}

/* When 🎬 BTO is present, the ↑ Up should not also use margin-left:auto
 * (BTO takes that role of pushing right). Reset it. */
.bc-bto ~ .bc-up {
    margin-left: 6px;
}

/* When ↑ Up is present, the × Exit shouldn't have margin-left:auto
 * (Up already takes that role of pushing right). Reset it.  */
.bc-up + .bc-exit {
    margin-left: 6px;
}

/* Mobile back-arrow style */
.breadcrumb-mobile {
    padding: 6px 10px;
    gap: 8px;
}

.bc-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 22px;
    line-height: 1;
    transition: background-color 0.12s ease;
    flex-shrink: 0;
}
.bc-back:hover {
    background: rgba(255, 255, 255, 0.08);
}

.breadcrumb-mobile .bc-segment.bc-current {
    flex: 1;
    min-width: 0;
    background: transparent;
    color: #fff;
    font-weight: 500;
    font-size: 15px;
}

/* When breadcrumb is active on Library page, hide the ProjectPicker
 * via the body class added in library.html. ProjectPicker remains
 * loaded and functional under the hood (other pages still use it),
 * but its UI is suppressed here per the deprecation path.
 *
 * Also hide the #scope-toggle button in the filter bar — that pill
 * shows "📂 Collection Name" when scoped, which is redundant with
 * the breadcrumb. Breadcrumb is the single visible scope UI.
 */
body.lib-breadcrumb-mode #project-picker-container,
body.lib-breadcrumb-mode .nav-project-picker,
body.lib-breadcrumb-mode .project-picker-host,
body.lib-breadcrumb-mode #scope-toggle {
    display: none !important;
}

@media (max-width: 768px) {
    #breadcrumb-root.breadcrumb-active {
        margin: 6px 8px 0;
    }
    .bc-segment {
        max-width: 160px;
    }
}

/* ─────────────────────────────────────────────────────────────────
 * DRAG-TO-BREADCRUMB (DESIGN-DRAG-DROP-V1 Phase B, May 11 2026)
 *
 * Drag an asset card → all breadcrumb segments grow slightly so they
 * become generously hittable. Drop on a segment moves the asset to
 * that container (or to root for the Library segment). The size
 * increase is internal padding only; the .unibar row height (52px)
 * is unchanged so the bar doesn't reflow.
 *
 * body.dragging-asset class is added by breadcrumb.js on any dragstart
 * carrying the application/x-psp-assets MIME type, and removed on
 * dragend / drop.
 * ───────────────────────────────────────────────────────────────── */

body.dragging-asset .bc-segment[data-scope],
body.dragging-asset .bc-up {
    /* Grow padding + visual prominence so segments register as drop
       targets. Background tint signals the segment is interactive. */
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    outline: 1px dashed rgba(102, 126, 234, 0.3);
    outline-offset: 1px;
    transition: padding 0.12s ease, background 0.12s ease, outline-color 0.12s ease;
}

/* Hover-while-dragging — accent the segment the cursor is over. */
.bc-segment.bc-drop-target,
.bc-up.bc-drop-target {
    background: rgba(102, 126, 234, 0.25) !important;
    outline: 2px solid rgba(102, 126, 234, 0.8) !important;
    outline-offset: 1px;
    color: #fff !important;
}

/* Drop-success flash — 400ms green pulse on the segment that
   received the drop, before the toast confirms completion. */
@keyframes bc-drop-flash-anim {
    0%   { background: rgba(29, 158, 117, 0.55); }
    100% { background: transparent; }
}
.bc-segment.bc-drop-flash,
.bc-up.bc-drop-flash {
    animation: bc-drop-flash-anim 0.4s ease-out;
}
