/* ProjectSelectorDropdown – shared project selection dropdown
   Uses CSS variables from colors.css (loaded by all apps).
   All classes prefixed with "shared-project-selector" to avoid collisions.
*/

/* ── Fused pill: project selector + app switcher as one unit ──────── */
.nav-switcher-pill {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--toolbar-border, #1e293b);
    border-radius: 7px;
    overflow: visible;
    height: 34px;
    background: var(--toolbar-button-bg, #0f172a);
}

.nav-switcher-pill > #projectSelectorContainer,
.nav-switcher-pill > #appSwitcherContainer {
    display: inline-flex;
    align-items: center;
    height: 100%;
}

/* Remove individual borders/radius — the pill provides them */
.nav-switcher-pill .shared-project-selector-btn,
.nav-switcher-pill .app-switcher-btn {
    border: none;
    border-radius: 0;
    height: 100%;
    background: transparent;
}

/* Left side (project) gets left radius */
.nav-switcher-pill
    > #projectSelectorContainer:first-child
    .shared-project-selector-btn {
    border-radius: 6px 0 0 6px;
}

/* Right side (app) gets right radius */
.nav-switcher-pill > #appSwitcherContainer:last-child .app-switcher-btn {
    border-radius: 0 6px 6px 0;
}

/* Thin divider between the two halves */
.nav-switcher-pill > #projectSelectorContainer + #appSwitcherContainer {
    border-left: 1px solid var(--toolbar-border, #1e293b);
}

/* Hover highlights just the hovered half */
.nav-switcher-pill .shared-project-selector-btn:hover,
.nav-switcher-pill .app-switcher-btn:hover {
    background: var(--toolbar-button-hover, #1e293b);
}

/* Pill border highlight when either dropdown is open */
.nav-switcher-pill:has(.shared-project-selector.open),
.nav-switcher-pill:has(.app-switcher.open) {
    border-color: var(--sidebar-active, #3b82f6);
}

/* ── Container ────────────────────────────────────────────────────── */
.shared-project-selector {
    position: relative;
    display: inline-block;
    height: 100%;
}

/* ── Trigger button ───────────────────────────────────────────────── */
.shared-project-selector-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 12px;
    background: var(--toolbar-button-bg, #0f172a);
    color: var(--toolbar-text, #e5e7eb);
    border: 1px solid var(--toolbar-border, #1e293b);
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    transition:
        background 0.15s,
        border-color 0.15s;
    max-width: 200px;
    white-space: nowrap;
}

.shared-project-selector-btn:hover {
    background: var(--toolbar-button-hover, #1e293b);
    border-color: var(--sidebar-active, #3b82f6);
}

.shared-project-selector-icon {
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
}

.shared-project-selector-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 130px;
}

.shared-project-selector-name--empty {
    opacity: 0.6;
    font-style: italic;
}

.shared-project-selector-chevron {
    font-size: 10px;
    opacity: 0.6;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.shared-project-selector.open .shared-project-selector-chevron {
    transform: rotate(180deg);
}

/* ── Dropdown panel ───────────────────────────────────────────────── */
.shared-project-selector-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: auto;
    min-width: 260px;
    max-height: 360px;
    background: var(--panel, var(--toolbar-bg, #0f172a));
    border: 1px solid var(--toolbar-border, #1e293b);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    z-index: 9999;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Invisible bridge so the pointer can travel from the trigger button to
   the dropdown panel without crossing a "dead" zone that would trigger
   mouseleave and close the menu on hover-to-open. */
.shared-project-selector.open .shared-project-selector-dropdown::before {
    content: "";
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    height: 8px;
    background: transparent;
}

.shared-project-selector-header {
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--toolbar-text, #8b949e);
    opacity: 0.6;
    border-bottom: 1px solid var(--toolbar-border, #1e293b);
    flex-shrink: 0;
}

.shared-project-selector-list {
    overflow-y: auto;
    padding: 4px 0;
    flex: 1;
}

/* ── Individual project item ──────────────────────────────────────── */
.shared-project-selector-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 14px;
    background: transparent;
    border: none;
    color: var(--toolbar-text, #e5e7eb);
    font-family: inherit;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s;
}

.shared-project-selector-item:hover,
.shared-project-selector-item.highlighted {
    background: var(--sidebar-hover, #1e293b);
}

.shared-project-selector-item.highlighted {
    outline: 2px solid var(--sidebar-active, #3b82f6);
    outline-offset: -2px;
}

.shared-project-selector-item.active {
    background: var(--sidebar-hover, #1e293b);
    font-weight: 600;
}

/* ── Search input inside dropdown ─────────────────────────────────── */
.shared-project-selector-search {
    position: relative;
    padding: 8px 10px;
    border-bottom: 1px solid var(--toolbar-border, #1e293b);
    flex-shrink: 0;
}

.shared-project-selector-search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: var(--toolbar-text, #8b949e);
    opacity: 0.5;
    pointer-events: none;
}

.shared-project-selector-search-input {
    width: 100%;
    height: 30px;
    padding: 0 10px 0 28px;
    background: var(--toolbar-button-bg, #0f172a);
    border: 1px solid var(--toolbar-border, #1e293b);
    border-radius: 5px;
    color: var(--toolbar-text, #e5e7eb);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.shared-project-selector-search-input:focus {
    border-color: var(--sidebar-active, #3b82f6);
}

.shared-project-selector-search-input::placeholder {
    color: var(--toolbar-text, #8b949e);
    opacity: 0.55;
}

.shared-project-selector-item-icon {
    font-size: 15px;
    flex-shrink: 0;
    line-height: 1;
}

.shared-project-selector-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shared-project-selector-item-check {
    color: var(--success-color, #10b981);
    font-size: 12px;
    flex-shrink: 0;
}

/* ── Footer with create button ────────────────────────────────────── */
.shared-project-selector-footer {
    border-top: 1px solid var(--toolbar-border, #1e293b);
    padding: 4px 0;
    flex-shrink: 0;
}

.shared-project-selector-create-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 14px;
    background: transparent;
    border: none;
    color: var(--sidebar-active, #3b82f6);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s;
}

.shared-project-selector-create-btn:hover {
    background: var(--sidebar-hover, #1e293b);
}

/* ── Scrollbar styling ────────────────────────────────────────────── */
.shared-project-selector-list::-webkit-scrollbar {
    width: 6px;
}

.shared-project-selector-list::-webkit-scrollbar-track {
    background: transparent;
}

.shared-project-selector-list::-webkit-scrollbar-thumb {
    background: var(--toolbar-border, #30363d);
    border-radius: 3px;
}

/* ── Empty state ──────────────────────────────────────────────────── */
.shared-project-selector-empty {
    padding: 16px 14px;
    text-align: center;
    color: var(--toolbar-text, #8b949e);
    opacity: 0.6;
    font-size: 13px;
    font-style: italic;
}
