﻿
/* =========================================================
   Shelvera Global Inventory Search
   Desktop: anchored search results panel.
   Mobile: branded full-width bottom sheet.
   ========================================================= */

.entity-global-search {
    position: relative;
    z-index: 30;
    width: 100%;
    margin: 0 0 1.35rem;
}

.entity-search-mobile-heading {
    display: none;
}

.entity-search-input-wrap {
    position: relative;
    display: block;
    width: 100%;
    margin: 0;
}

.entity-search-input-icon {
    position: absolute;
    top: 50%;
    left: 1rem;
    width: 1.15rem;
    height: 1.15rem;
    fill: var(--sv-text-muted);
    transform: translateY(-50%);
    pointer-events: none;
}

.entity-search-input-wrap input {
    width: 100%;
    min-height: 3rem;
    border: 1px solid var(--sv-border);
    border-radius: 999px;
    padding: .72rem 3rem .72rem 2.8rem;
    background: var(--sv-surface-soft);
    color: var(--sv-text);
    font: inherit;
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

    .entity-search-input-wrap input:focus {
        outline: none;
        border-color: rgba(75, 99, 255, .56);
        background: var(--sv-surface);
        box-shadow: 0 0 0 4px rgba(75, 99, 255, .11);
    }

    .entity-search-input-wrap input::-webkit-search-cancel-button,
    .entity-search-input-wrap input::-webkit-search-decoration {
        display: none;
        -webkit-appearance: none;
        appearance: none;
    }

    .entity-search-input-wrap input::-ms-clear,
    .entity-search-input-wrap input::-ms-reveal {
        display: none;
        width: 0;
        height: 0;
    }

.entity-search-clear,
.entity-search-mobile-close {
    display: grid;
    place-items: center;
    border: 0;
    background: transparent;
    color: var(--sv-text-soft);
    line-height: 1;
}

.entity-search-clear {
    position: absolute;
    top: 50%;
    right: .85rem;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    font-size: 1.3rem;
    transform: translateY(-50%);
}

    .entity-search-clear:hover,
    .entity-search-clear:focus-visible,
    .entity-search-mobile-close:hover,
    .entity-search-mobile-close:focus-visible {
        background: rgba(19, 37, 75, .07);
        color: var(--sv-text);
        outline: none;
    }

.entity-search-panel {
    position: absolute;
    top: calc(100% + .55rem);
    left: 0;
    right: 0;
    overflow: hidden;
    border: 1px solid rgba(19, 37, 75, .13);
    border-radius: 1.05rem;
    background: var(--sv-surface);
    box-shadow: 0 20px 48px rgba(19, 37, 75, .16);
}

    .entity-search-panel[hidden],
    .entity-search-backdrop[hidden] {
        display: none !important;
    }

.entity-search-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .85rem;
    padding: .82rem .9rem;
    border-bottom: 1px solid var(--sv-border);
}

.entity-search-scope {
    display: flex;
    align-items: center;
    gap: .38rem;
}

    .entity-search-scope > span {
        margin-right: .25rem;
        color: var(--sv-text-soft);
        font-size: .79rem;
        font-weight: 600;
    }

    .entity-search-scope button {
        min-width: 3.4rem;
        border: 1px solid var(--sv-border);
        border-radius: 999px;
        padding: .35rem .78rem;
        background: var(--sv-surface);
        color: var(--sv-text-soft);
        font-size: .82rem;
        font-weight: 600;
        transition: border-color .16s ease, background-color .16s ease, color .16s ease, box-shadow .16s ease;
    }

        .entity-search-scope button:hover,
        .entity-search-scope button:focus-visible {
            border-color: rgba(75, 99, 255, .35);
            outline: none;
        }

        .entity-search-scope button.is-selected {
            border-color: rgba(75, 99, 255, .42);
            background: rgba(75, 99, 255, .1);
            color: var(--sv-link);
            box-shadow: 0 0 0 2px rgba(75, 99, 255, .05);
        }

.entity-search-count {
    color: var(--sv-text-soft);
    font-size: .79rem;
    font-weight: 600;
    white-space: nowrap;
}

.entity-search-status {
    margin: 0;
    padding: .95rem 1rem;
    color: var(--sv-text-soft);
    font-size: .88rem;
}

.entity-search-results {
    display: grid;
    max-height: min(28rem, calc(100vh - 18rem));
    overflow-x: hidden;
    overflow-y: auto;
}

.entity-search-result {
    display: flex;
    align-items: center;
    gap: .78rem;
    border: 0;
    border-top: 1px solid rgba(19, 37, 75, .06);
    padding: .66rem .88rem;
    background: #fff;
    color: var(--sv-text);
    text-decoration: none;
    transition: background-color .15s ease;
}

    .entity-search-result:hover,
    .entity-search-result:focus-visible,
    .entity-search-result.is-active {
        background: rgba(75, 99, 255, .055);
        color: var(--sv-text);
        outline: none;
    }

.entity-search-result-thumbnail {
    position: relative;
    display: grid;
    place-items: center;
    width: 3.35rem;
    height: 3.35rem;
    flex: 0 0 auto;
    overflow: hidden;
    border: 1px solid rgba(19, 37, 75, .08);
    border-radius: .72rem;
    background: #eef1fb;
    color: var(--sv-accent);
}

.entity-search-result.is-folder .entity-search-result-thumbnail {
    border-radius: 999px;
}

.entity-search-result-thumbnail img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.entity-search-result-placeholder svg {
    width: 1.45rem;
    height: 1.45rem;
    fill: currentColor;
    opacity: .68;
}

.entity-search-result-copy {
    display: grid;
    flex: 1;
    gap: .18rem;
    min-width: 0;
}

.entity-search-result-title-row {
    display: flex;
    align-items: center;
    gap: .55rem;
    min-width: 0;
}

.entity-search-result-title {
    overflow: hidden;
    color: var(--sv-text);
    font-family: "Montserrat", sans-serif;
    font-size: .92rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.entity-search-result-kind {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: .18rem .46rem;
    background: rgba(19, 37, 75, .06);
    color: var(--sv-text-soft);
    font-size: .7rem;
    font-weight: 650;
}

.entity-search-result.is-folder .entity-search-result-kind {
    background: rgba(75, 99, 255, .09);
    color: var(--sv-link);
}

.entity-search-result-path {
    overflow: hidden;
    margin: 0;
    color: var(--sv-text-soft);
    font-size: .79rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.entity-search-result-quantity {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: .26rem .48rem;
    background: rgba(19, 37, 75, .06);
    color: var(--sv-text-soft);
    font-size: .73rem;
    font-weight: 600;
    white-space: nowrap;
}

.entity-search-mark {
    border-radius: .18rem;
    padding: 0 .04rem;
    background: rgba(250, 204, 21, .45);
    color: inherit;
}

.entity-search-more {
    margin: 0;
    border-top: 1px solid var(--sv-border);
    padding: .78rem 1rem;
    color: var(--sv-text-soft);
    font-size: .83rem;
}

.entity-search-backdrop {
    display: none;
}

@media (max-width: 767.98px) {
    body.entity-search-mobile-open {
        overflow: hidden;
    }

    .entity-global-search {
        width: 100%;
        margin-bottom: 1.15rem;
    }

        .entity-global-search.is-mobile-open {
            position: fixed;
            z-index: 1061;
            right: 0;
            bottom: 0;
            left: 0;
            width: 100%;
            max-height: min(92vh, 48rem);
            margin: 0;
            overflow: hidden;
            border-radius: 1.25rem 1.25rem 0 0;
            padding: 1rem .95rem max(1rem, env(safe-area-inset-bottom));
            background: var(--sv-surface);
            box-shadow: 0 -1.1rem 3rem rgba(15, 23, 42, .18);
        }

            .entity-global-search.is-mobile-open .entity-search-mobile-heading {
                display: flex;
                align-items: center;
                justify-content: space-between;
                gap: 1rem;
                margin-bottom: .85rem;
            }

    .entity-search-mobile-heading h3 {
        margin: 0;
        font-size: 1.12rem;
        font-weight: 700;
    }

    .entity-search-mobile-close {
        width: 2rem;
        height: 2rem;
        border-radius: 999px;
        font-size: 1.55rem;
    }

    .entity-global-search.is-mobile-open .entity-search-panel {
        position: static;
        display: block;
        margin-top: .75rem;
        overflow: hidden;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .entity-global-search.is-mobile-open .entity-search-panel-header {
        padding: .2rem 0 .82rem;
    }

    .entity-global-search.is-mobile-open .entity-search-status {
        padding: .9rem .1rem;
    }

    .entity-global-search.is-mobile-open .entity-search-results {
        max-height: calc(min(92vh, 48rem) - 12.4rem);
        margin: 0 -.2rem;
    }

    .entity-global-search.is-mobile-open .entity-search-result {
        padding-right: .2rem;
        padding-left: .2rem;
    }

    .entity-search-backdrop:not([hidden]) {
        position: fixed;
        z-index: 1060;
        inset: 0;
        display: block;
        background: rgba(15, 23, 42, .38);
    }
}


/* =========================================================
   Inventory Branch Progressive Loading
   ========================================================= */

.entities-load-more-footer {
    display: grid;
    justify-items: center;
    gap: .68rem;
    margin-top: 1.15rem;
    padding: 1rem .75rem .2rem;
    border-top: 1px solid rgba(19, 37, 75, .07);
}

    .entities-load-more-footer p {
        margin: 0;
        color: var(--sv-text-soft);
        font-size: .84rem;
    }

        .entities-load-more-footer p strong {
            color: var(--sv-text);
            font-weight: 650;
        }

.entities-load-more-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: .78rem 1.05rem;
}

.entities-load-more-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 12rem;
    min-height: 2.65rem;
    border: 1px solid rgba(75, 99, 255, .25);
    border-radius: 999px;
    padding: .58rem 1.2rem;
    background: rgba(75, 99, 255, .07);
    color: var(--sv-link);
    font-size: .88rem;
    font-weight: 650;
    text-decoration: none;
    transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.entity-card#folders-new-results-start,
.entity-card#items-new-results-start {
    scroll-margin-top: 7rem;
}

.entities-shell-root .entity-card#folders-new-results-start,
.entities-shell-root .entity-card#items-new-results-start {
    scroll-margin-top: 19rem;
}

.entities-show-all-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.65rem;
    border: 0;
    border-radius: 999px;
    padding: .58rem .82rem;
    background: transparent;
    color: var(--sv-link);
    font-size: .87rem;
    font-weight: 620;
    text-decoration: none;
    transition: background-color .16s ease, color .16s ease;
}

    .entities-show-all-button:hover,
    .entities-show-all-button:focus-visible {
        background: rgba(75, 99, 255, .07);
        color: var(--sv-link);
        outline: none;
    }

.entities-load-more-button:hover,
.entities-load-more-button:focus-visible {
    border-color: rgba(75, 99, 255, .42);
    background: rgba(75, 99, 255, .12);
    color: var(--sv-link);
    box-shadow: 0 .4rem 1rem rgba(75, 99, 255, .1);
    outline: none;
    transform: translateY(-1px);
}

@media (max-width: 767.98px) {
    .entities-load-more-actions {
        width: 100%;
        flex-direction: column;
    }

    .entities-load-more-button {
        width: min(100%, 20rem);
    }

    /*
     * Intentionally keep very large section expansion as progressive loading
     * on phone-size layouts. Desktop users may deliberately load all siblings.
     */
    .entities-show-all-button {
        display: none;
    }
}