/* Universal Search Modal Styles - Matching Figma Design */
:root {
    --us-font-family-title: "spirits-soft", sans-serif;
    --us-font-family-body: "Fira Sans", sans-serif;
    --us-text-primary: #0A0A0A;
    --us-text-secondary: #737373;
    --us-text-light: #A0A09B;
    --us-bg-white: #FFFFFF;
    --us-bg-gray: #FAFAFA;
    --us-border-color: #E5E5E5;
    --us-border-dark: #0A0A0A;
}

/* Modal Overlay */
.universal-search-modal,
.universal-search-modal * {
    box-sizing: border-box;
}

.universal-search-modal {
    position: fixed;
    z-index: 2147483646;
    width: 100%;
    height: 100%;
    opacity: 0;
    left: 0;
    top: 0;
    background: rgba(0, 0, 0, 0.60);
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
}

.universal-search-modal.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* Modal Center Content */
.universal-search-content {
    position: absolute !important;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 40%;
    opacity: 0;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
    max-height: 90%;
    overflow-y: unset;
}

.universal-search-modal.active .universal-search-content {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Search Input Container */
.us-header {
    display: flex;
    padding: 16px 20px;
    align-items: center;
    gap: 12px;
    align-self: stretch;
    border-radius: 12px;
    border: 1px solid var(--us-border-color);
    background: var(--us-bg-gray);
}

.us-search-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.us-input {
    background: var(--us-bg-gray);
    width: 100%;
    height: auto;
    color: #0A0A0A;
    font-family: var(--us-font-family-body);
    font-size: 18px;
    font-style: normal;
    font-weight: 400;
    line-height: 28px;
    border: none;
}

.us-input::placeholder {
    color: #737373;
    font-family: var(--us-font-family-body);
    font-size: 16px;
    font-style: normal;
    font-weight: 300;
    line-height: 24px;
    opacity: 1;
}

.us-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 28px;
    color: var(--us-text-secondary);
    line-height: 1;
    padding: 0;
}

.us-close-btn:hover {
    color: var(--us-text-primary);
}

/* Results Container */
.us-results-container {
    display: flex;
    width: 100%;
    padding: 24px;
    flex-direction: column;
    align-items: flex-start;
    gap: 0px;
    border-radius: 12px;
    border: 1px solid #EAECF0;
    background: var(--us-bg-white);
    margin-top: 16px;
}

/* Tabs / Filter Chips */
.us-tabs {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding-bottom: 24px;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.us-tabs::-webkit-scrollbar {
    display: none;
}

.us-tab {
    display: flex;
    min-width: 84px;
    padding: 12px 16px;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    border-radius: 80px;
    border: 1px solid var(--us-border-color);
    background: var(--us-bg-gray);
    color: #262626;
    text-align: right;
    font-family: var(--us-font-family-body);
    font-size: 14px;
    font-style: normal;
    font-weight: 400;
    line-height: 100%;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.2s;
}

.us-tab.active {
    border-radius: 80px;
    border: 1px solid var(--us-border-dark);
    background: var(--us-bg-gray);
}

.us-tab:hover:not(.active) {
    border-color: #999;
}

/* Results Scrollable Area */
.us-results {
    width: 100%;
    overflow-y: auto;
    max-height: 400px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overscroll-behavior: contain;
}

.us-results::-webkit-scrollbar {
    width: 4px !important;
    border-radius: 1px;
    margin-right: 5px;
}

.us-results::-webkit-scrollbar-track {
    background: transparent !important;
}

.us-results::-webkit-scrollbar-thumb {
    border-radius: 4px;
    background: #D0D5DD;
}

/* Search Label */
.us-search-label {
    color: var(--us-text-secondary);
    font-family: var(--us-font-family-body);
    font-size: 14px;
    font-style: normal;
    font-weight: 300;
    line-height: 20px;
    padding: 0;
}

/* Group Title */
.us-group {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.us-group-title {
    color: var(--us-text-secondary);
    font-family: var(--us-font-family-body);
    font-size: 14px;
    font-style: normal;
    font-weight: 300;
    line-height: 20px;
    margin-bottom: unset;
    margin-top: 32px;
}

.us-group:first-child .us-group-title {
    margin-top: 0;
}

/* Result Items */
.us-item {
    display: block;
    width: 100%;
    cursor: pointer;
    text-decoration: none;
    color: var(--us-text-primary);
    font-family: var(--us-font-family-body);
    font-size: 16px;
    font-style: normal;
    font-weight: 400;
    line-height: 24px;
    border-bottom: 1px solid #E5E5E5;
    margin-top: 0;
    padding-bottom: 12px;
}

.us-item:last-child {
    border-bottom: none;
}

/* Last item in category section - no border */
.us-item.us-item-last {
    border-bottom: none;
}

.us-item>div {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    padding: 0;
}

.us-item-title {
    color: #171717;
    font-family: var(--us-font-family-body);
    font-size: 16px;
    font-style: normal;
    font-weight: 400;
    line-height: 25px;
}

.us-item-title span,
.us-item-title b {
    font-family: var(--us-font-family-body);
}

.us-item-title strong {
    color: #171717;
    font-weight: 400;
}

/* Highlight: make query text bold, rest light */
.us-item-title span {
    color: #262626;
    font-weight: 300;
}

.us-item-title strong {
    color: #171717;
    font-weight: 400;
}

/* Category Tag (for "All" tab) */
.us-category-tag {
    color: var(--us-text-secondary);
    text-align: right;
    font-family: var(--us-font-family-body);
    font-size: 14px;
    font-style: normal;
    font-weight: 300;
    line-height: normal;
}

/* No Results */
.us-no-results {
    color: #262626;
    font-family: var(--us-font-family-body);
    font-size: 16px;
    font-style: normal;
    font-weight: 300;
    line-height: 24px;
}

/* Loader - Dots animation */
.us-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 50px;
    gap: 10px;
}

.us-loader-dot {
    width: 6px;
    height: 6px;
    background-color: #d4d4cf;
    border-radius: 50%;
    margin: 0 5px;
    animation: us-zoom 1.4s infinite ease-in-out both;
}

.us-loader-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.us-loader-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes us-zoom {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(2.5);
    }

    100% {
        transform: scale(1);
    }
}

/* Mobile Styles - Full Screen Layout matching Next.js */
@media screen and (max-width: 768px) {
    .universal-search-modal {
        background: var(--us-bg-white);
    }

    .universal-search-modal.active {
        display: flex;
        flex-direction: column;
    }

    .universal-search-content {
        position: relative !important;
        top: 0;
        left: 0;
        transform: none !important;
        width: 100% !important;
        height: 100%;
        max-height: 100%;
        opacity: 1;
        display: flex;
        flex-direction: column;
    }

    .universal-search-modal.active .universal-search-content {
        transform: none;
    }

    /* Mobile Back Button */
    .us-mobile-back {
        display: flex;
        align-items: center;
        gap: 4px;
        padding: 20px 16px 10px 16px;
        color: var(--us-text-primary);
        font-family: var(--us-font-family-body);
        font-size: 14px;
        font-weight: 400;
        cursor: pointer;
        text-decoration: none;
        width: max-content;
    }


    .us-mobile-back svg {
        width: 16px;
        height: 16px;
    }

    /* Mobile Header - Search Input */
    .us-header {
        margin: 10px 16px 20px 16px;
        padding: 8px 16px;
        border-radius: 8px;
        border: 1px solid var(--us-border-dark);
        background: var(--us-bg-gray);
        height: 48px;
    }

    .us-close-btn {
        display: none;
        /* Hide X button on mobile, use back button instead */
    }

    .us-input {
        font-size: 16px;
        line-height: 100%;
    }

    .us-input::placeholder {
        font-size: 14px;
        line-height: 20px;
    }

    .us-search-icon {
        width: 20px;
        height: 20px;
    }

    /* Mobile Results Container */
    .us-results-container {
        padding: 0;
        margin-top: 8px;
        border: none;
        border-radius: 0;
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .us-search-label {
        padding: 0 24px;
    }

    .us-no-results {
        padding: 0 24px;
    }

    .us-item>div {
        padding: 0 24px;
    }

    /* Mobile Tabs - Horizontal Scroll with Dark Active State */
    .us-tabs {
        display: flex;
        gap: 8px;
        padding-bottom: 20px;
        overflow-x: auto;
        flex-shrink: 0;
        padding: 0px 24px;
        margin-bottom: 32px;
    }

    .us-tab {
        padding: 10px 16px;
        background: var(--us-bg-white);
        border: 1px solid var(--us-border-color);
        color: var(--neutral-gray-grey-800, #262626);
        text-align: right;
        font-family: var(--font-family-Body, "Fira Sans");
        font-size: 12px;
        font-style: normal;
        font-weight: 300;
        line-height: 18px;
        /* 150% */
    }

    .us-tab.active {
        background: var(--us-bg-white);
        border-color: var(--us-text-primary);
        color: var(--neutral-gray-grey-800, #262626);
        text-align: right;
        /* Text xs/Regular */
        font-family: var(--font-family-Body, "Fira Sans");
        font-size: 12px;
        font-style: normal;
        font-weight: 400;
        line-height: 18px;
        /* 150% */
    }

    /* Mobile Results Area */
    .us-results {
        flex: 1;
        overflow-y: auto;
        max-height: none;
        padding-bottom: 20px;
    }

    .us-search-label {
        margin-bottom: 2px;
    }

    .us-group-title {
        margin-top: 24px;
        padding-left: 24px;
    }

    .us-group:first-child .us-group-title {
        margin-top: 0;
    }

    /* .us-item {
        padding: 12px 0;
    } */

    .us-item-title {
        font-size: 14px;
    }

    .us-category-tag {
        font-size: 13px;
    }
}

/* Hide mobile back button on desktop */
@media screen and (min-width: 769px) {
    .us-mobile-back {
        display: none;
    }
}

/* Replaced Inline Styles */
.search-modal-trigger {
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 10px;
}

.search-modal-trigger svg {
    vertical-align: middle;
}

.us-body-locked {
    overflow: hidden !important;
}

.us-highlight-normal {
    color: #171717;
    font-weight: 300;
}

.us-highlight-match {
    color: #171717;
    font-weight: 400;
}

.us-highlight-nomatch {
    color: #A0A09B;
    font-weight: 300;
}