/* ══════════════════════════════════════════ */
/*  CustomerStoreBar                          */
/*  Customer-facing, location-only working-   */
/*  store selector. Mirrors the ProAudit      */
/*  "company bar" idiom (StaffCompanyContext  */
/*  Bar.razor.css) and adds a search field.   */
/*  Class prefix: storebar-                    */
/* ══════════════════════════════════════════ */

.storebar {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 2rem;
    background: #ffffff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.storebar-left {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: rgba(0, 0, 0, 0.4);
}

.storebar-left > svg {
    width: 14px;
    height: 14px;
    color: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.storebar-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* ── Trigger pill ── */
.storebar-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font: inherit;
}

.storebar-trigger:hover {
    border-color: var(--pa-primary, #DD9142);
    background: rgba(221, 145, 66, 0.06);
}

.storebar-trigger:focus-visible {
    outline: 2px solid var(--pa-primary, #DD9142);
    outline-offset: 2px;
}

.storebar-trigger-name {
    font-weight: 600;
    font-size: 0.8125rem;
    color: #1a1a1a;
    white-space: nowrap;
}

.storebar-trigger-chevron {
    width: 14px;
    height: 14px;
    color: rgba(0, 0, 0, 0.4);
    transition: transform 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.storebar-trigger:hover .storebar-trigger-chevron {
    color: var(--pa-primary, #DD9142);
}

.storebar-trigger[aria-expanded="true"] .storebar-trigger-chevron {
    transform: rotate(180deg);
}

/* Note: no in-bar loading skeleton. The bar renders only once shop resolution
   completes (wrapped in @if (ShowUi)) to avoid a flash-then-vanish for users who
   turn out to have <2 active shops or no permission. Page-level loading is handled
   by the StoreContextReady cascade on the consumer pages. */

/* ── Outside-click catcher ── */
.storebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 499;
    cursor: default;
}

/* ── Dropdown card ── */
.storebar-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 300px;
    background: #ffffff;
    border: 1px solid #DDD9D3;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(26, 22, 18, 0.12);
    z-index: 500;
    overflow: hidden;
    animation: storebarIn 0.15s ease;
}

@keyframes storebarIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Search header ── */
.storebar-search {
    position: relative;
    padding: 0.625rem 0.625rem 0.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.storebar-search > svg {
    position: absolute;
    left: 1.25rem;
    top: calc(50% - 2px);
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.storebar-search-input {
    width: 100%;
    padding: 0.5rem 0.625rem 0.5rem 2rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 6px;
    font-size: 0.8125rem;
    outline: none;
    background: #fafaf8;
    transition: border-color 0.15s ease;
}

.storebar-search-input:focus {
    border-color: var(--pa-primary, #DD9142);
    background: #ffffff;
}

/* ── Option list ── */
.storebar-list {
    max-height: 320px;
    overflow-y: auto;
    padding: 4px 0;
}

.storebar-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 7px 12px;
    cursor: pointer;
    transition: background 0.1s ease;
    font: inherit;
    text-align: left;
    background: transparent;
    border: none;
}

.storebar-option:hover {
    background: #F0EEEA;
}

.storebar-option--active {
    background: rgba(221, 145, 66, 0.08);
}

.storebar-option.selected {
    background: rgba(0, 166, 156, 0.06);
}

.storebar-option:focus-visible {
    outline: 2px solid var(--pa-primary, #DD9142);
    outline-offset: -2px;
}

.storebar-option-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.storebar-option-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1A1612;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.storebar-option-meta {
    font-size: 0.6875rem;
    color: rgba(0, 0, 0, 0.45);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.storebar-check {
    width: 14px;
    height: 14px;
    color: #00A69C;
    flex-shrink: 0;
}

/* "All Locations" pinned row sits above a subtle divider */
.storebar-option--pinned {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    margin-bottom: 4px;
    padding-bottom: 9px;
}

/* ── Empty filter state ── */
.storebar-empty {
    padding: 1.25rem 1rem;
    text-align: center;
    font-size: 0.8125rem;
    color: rgba(0, 0, 0, 0.35);
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    .storebar-dropdown { animation: none; }
    .storebar-trigger,
    .storebar-trigger-chevron,
    .storebar-search-input { transition: none; }
}
