/* =========================================================
   FILE        :: /public/assets/css/modules/search/customer-search-widget.css
   MODULE      :: Search
   DOMAIN      :: Search
   LAYER       :: Presentation Asset
   PURPOSE     :: Deterministic customer search widget styling
   OWNER       :: Search Domain Authority
   VERSION     :: 8.0.0
   ========================================================= */

/*
|--------------------------------------------------------------------------
| SEARCH MODULE
|--------------------------------------------------------------------------
*/

.customer-search-module {
    position: relative;
    z-index: 5000;
}

.customer-search-module:focus-within {
    isolation: isolate;
}

/*
|--------------------------------------------------------------------------
| INPUT CONTAINER
|--------------------------------------------------------------------------
*/

.customer-search-input-container {
    position: relative;
    overflow: visible;
    z-index: 5001;
}

/*
|--------------------------------------------------------------------------
| RESULTS DROPDOWN
|--------------------------------------------------------------------------
*/

.customer-search-dropdown {
    position: absolute;

    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;

    width: 100%;

    z-index: 50000;

    display: none;

    max-height: min(420px, calc(100dvh - 18rem));
    overflow-y: auto;
    overscroll-behavior: contain;

    padding: 0.75rem;

    background:
        linear-gradient(180deg, rgba(255,255,255,0.98), rgba(244,253,255,0.96));

    border: 1px solid rgba(34, 211, 238, 0.22);
    border-radius: 0.85rem;

    box-shadow:
        0 24px 58px rgba(15, 23, 42, 0.18),
        0 1px 0 rgba(255,255,255,0.8) inset;

    isolation: isolate;

    scrollbar-gutter: stable;
}

.customer-search-dropdown.active {
    display: block;
}

/*
|--------------------------------------------------------------------------
| RESULT CARD
|--------------------------------------------------------------------------
*/

.customer-search-result {
    position: relative;

    display: block;

    width: 100%;

    margin-bottom: 0.75rem;

    padding: 0;

    border: 1px solid rgba(8, 145, 178, 0.16);
    border-radius: 0.75rem;

    background:
        linear-gradient(180deg, #ffffff, #f8fdff);

    overflow: hidden;

    box-sizing: border-box;

    transition:
        border-color 120ms ease,
        transform 120ms ease,
        box-shadow 120ms ease;
}

.customer-search-result:last-child {
    margin-bottom: 0;
}

.customer-search-result:hover {
    border-color: rgba(34, 211, 238, 0.34);
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

/*
|--------------------------------------------------------------------------
| ACTIVE RESULT
|--------------------------------------------------------------------------
*/

.customer-search-result.active {
    border-color: #0891b2;

    background:
        linear-gradient(
            135deg,
            rgba(14, 116, 144, 0.28) 0%,
            rgba(37, 99, 235, 0.12) 100%
        );

    box-shadow:
        0 0 0 3px rgba(8, 145, 178, 0.18),
        0 14px 28px rgba(8, 145, 178, 0.12);

    transform: translateY(-1px);
}

.customer-search-result.active::before {
    content: '';

    position: absolute;

    top: 0;
    left: 0;
    bottom: 0;

    width: 4px;

    background: linear-gradient(180deg, #155dfc, #0891b2);

    border-top-left-radius: 0.9rem;
    border-bottom-left-radius: 0.9rem;
}

.customer-search-result.active
.customer-search-name {
    color: #075985;
}

.customer-search-result.active
.customer-search-location {
    color: #102033;
}

.customer-search-name.active,
.customer-search-location.active {
    color: #0958d9;

    background:
        linear-gradient(
            135deg,
            #eff6ff 0%,
            #dbeafe 100%
        );

    border-radius: 0.65rem;

    box-shadow:
        0 0 0 3px rgba(22, 119, 255, 0.18);
}

.customer-search-location.active {
    padding: 0.35rem 0.5rem;

    transform: translateX(2px);
}

/*
|--------------------------------------------------------------------------
| RESULT BODY
|--------------------------------------------------------------------------
*/

.customer-search-result-body {
    display: flex;
    flex-direction: column;

    gap: 0.75rem;

    padding: 1rem;
}

/*
|--------------------------------------------------------------------------
| CUSTOMER NAME
|--------------------------------------------------------------------------
*/

.customer-search-name {
    display: inline-flex;
    align-items: center;

    width: fit-content;

    color: #0f172a;

    font-size: 1rem;
    font-weight: 700;

    text-decoration: none;

    transition: color 120ms ease;
}

.customer-search-name:hover {
    color: #075985;
    text-decoration: none;
}

/*
|--------------------------------------------------------------------------
| LOCATIONS
|--------------------------------------------------------------------------
*/

.customer-search-locations {
    position: relative;

    display: flex;
    flex-direction: column;

    gap: 0.45rem;

    margin-top: 0.25rem;

    padding-left: 0.85rem;
}

.customer-search-locations::before {
    content: '';

    position: absolute;

    top: 4px;
    left: 0;
    bottom: 4px;

    width: 2px;

    background:
        linear-gradient(180deg, #0891b2, #22c55e);

    border-radius: 999px;
}

/*
|--------------------------------------------------------------------------
| LOCATION LINK
|--------------------------------------------------------------------------
*/

.customer-search-location {
    display: inline-flex;
    align-items: center;

    gap: 0.5rem;

    min-height: 20px;

    width: fit-content;

    color: #5f7488;

    font-size: 0.92rem;

    line-height: 1.2;

    text-decoration: none;

    transition:
        color 120ms ease,
        transform 120ms ease;
}

.customer-search-location:empty {
    display: none;
}

.customer-search-location:hover {
    color: #075985;

    text-decoration: none;

    transform: translateX(2px);
}

/*
|--------------------------------------------------------------------------
| LOCATION ICON
|--------------------------------------------------------------------------
*/

.customer-search-location-icon {
    font-size: 0.85rem;
}

/*
|--------------------------------------------------------------------------
| EMPTY + LOADING
|--------------------------------------------------------------------------
*/

.customer-search-dropdown .text-muted {
    padding: 0.5rem;
}

/*
|--------------------------------------------------------------------------
| QUICK ACTIONS
|--------------------------------------------------------------------------
*/

.customer-search-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: center;
}

.customer-search-actions[hidden] {
    display: none !important;
}

.customer-search-action-select,
.customer-search-action-button {
    min-height: 44px;
}

.customer-search-action-button {
    min-width: 150px;
    font-weight: 700;
}

/*
|--------------------------------------------------------------------------
| SEARCH OVERLAY FIX
|--------------------------------------------------------------------------
*/

.searchhub-card:has(.customer-search-module) {
    overflow: visible;
    z-index: 5000;
}

/*
|--------------------------------------------------------------------------
| MOBILE
|--------------------------------------------------------------------------
*/

@media (max-width: 768px) {

    .customer-search-dropdown {
        max-height: 60vh;
        overflow-y: auto;
    }

    .customer-search-actions {
        grid-template-columns: 1fr;
    }

    .customer-search-action-button {
        width: 100%;
    }
}

/*
|--------------------------------------------------------------------------
| RUNTIME DISPLAY CONTROL
|--------------------------------------------------------------------------
*/

.customer-search-results {
    display: none;
}

.customer-search-results.active {
    display: block;
}
