#search-component {
    --search-bounce-duration: 0.08s;
    --search-bounce-scale: 0.97;
}

/* This is the full-width white frame, now designed to live inside another header */
.sticky-search-bar-frame {
    /* REMOVED: position: sticky, top, z-index */
    background-color: #ffffff; /* White frame */
    padding: 10px 20px;
    cursor: pointer;
    transition: transform var(--search-bounce-duration) ease-out;
    will-change: transform;
}

/* For pages without a main navbar, stick the frame to the very top */
body:not(:has(> .navbar, > .page-nav-bar)) .sticky-search-bar-frame {
    position: sticky;
    top: 0;
}

.sticky-search-bar-frame:active {
    transform: scale(var(--search-bounce-scale));
}

/* This is the centered, grey, clickable button inside the white frame */
.sticky-search-bar-button {
    width: 100%;
    max-width: var(--max-content-width, 960px);
    margin: 0 auto;
    height: 46px;
    background-color: var(--arrow-background-color, #F0F0F0);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center; /* Centers both icon and text together */
    gap: 10px; /* Creates space between icon and text */
    padding: 0 15px;
    overflow: hidden;
}

#lottie-search-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

#animated-hint-text {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 400;
    color: var(--tertiary-text-color, #808080);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.4s ease-in-out; /* For the new JS animation */
}

/* ==========================================================================
   PART 2: FULL SCREEN OVERLAY & VIEW MANAGEMENT
   ========================================================================== */

.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.3s ease-out, visibility 0.3s ease-out, transform 0.3s ease-out;
    display: flex;
    justify-content: center;
    overflow-y: auto;
}

.search-overlay.is-active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* When overlay is active, prevent the body from scrolling */
body.search-overlay-active {
    overflow: hidden;
}

body:not(:has(> .navbar, > .page-nav-bar)) .sticky-search-bar-placeholder {
    top: 0;
}

.search-view {
        display: none;
        width: 100%;
        min-height: 100%;
        max-width: var(--max-content-width, 960px);
        flex-direction: column;
}

.search-view.is-active {
    display: flex; /* Show the active view */
}

/* ==========================================================================
   PART 3: EXPLORE & SEARCH VIEW HEADERS
   ========================================================================== */

.search-view-header {
    height: 60px; /* CORRECTED: Match Flutter kNavBarHeight */
    flex-shrink: 0;
    display: none; /* Headers are hidden by default */
    align-items: center;
    padding: 0 20px; /* CORRECTED: Increased padding */
    gap: 10px;
    width: 100%;
    background-color: #ffffff;
}

/* Logic to show the correct header based on parent state */
#explore-view.is-active > .search-view-header,
#search-view.input-unfocused > #search-header-unfocused,
#search-view.input-focused > #search-header-focused {
    display: flex;
}

/* Style for the fake input in the unfocused search header */
.search-bar-fake-input {
    flex-grow: 1;
    height: 46px;
    background-color: var(--arrow-background-color, #F0F0F0);
    border-radius: 12px;
    display: flex;
    align-items: center;
    padding: 0 15px;
    gap: 10px;
    cursor: pointer;
}
.search-bar-fake-input span {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color: var(--tertiary-text-color, #808080);
}

.search-nav-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform var(--search-bounce-duration) ease-out;
}
.search-nav-btn:active {
    transform: scale(var(--search-bounce-scale));
}

.search-icon-static {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Specific trigger bar for the Explore view */
.explore-search-bar-trigger {
    flex-grow: 1;
    height: 46px; /* Match kSearchInputHeight */
    background-color: var(--arrow-background-color, #F0F0F0);
    border-radius: 12px;
    display: flex;
    align-items: center;
    padding: 0 15px;
    gap: 10px;
    cursor: pointer;
    transition: transform var(--search-bounce-duration) ease-out;
}

.explore-search-bar-trigger:active {
    transform: scale(var(--search-bounce-scale));
}

.explore-search-bar-trigger span {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color: var(--tertiary-text-color, #808080);
}

/* Wrapper for the actual input in the Search view */
.search-input-wrapper {
    flex-grow: 1;
    display: flex;
    align-items: center;
    height: 46px;
    background-color: var(--arrow-background-color, #F0F0F0);
    border-radius: 12px;
    padding: 0 8px 0 15px;
}

#main-search-input {
    flex-grow: 1;
    height: 100%;
    border: none;
    background: none;
    outline: none;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color: var(--primary-text-color, #2C2C2C);
    padding: 0 8px;
}

#main-search-input::placeholder {
    color: var(--tertiary-text-color, #808080);
}

#main-search-input::-webkit-search-decoration,
#main-search-input::-webkit-search-cancel-button,
#main-search-input::-webkit-search-results-button,
#main-search-input::-webkit-search-results-decoration {
    -webkit-appearance: none;
    display: none;
}

.clear-search-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    display: none; /* Hidden by default, shown by JS */
}
.clear-search-btn.visible {
    display: block;
}


/* ==========================================================================
   PART 4: EXPLORE VIEW CONTENT & OPTION TILE
   ========================================================================== */

.explore-content {
        padding: 20px 0; /* CHANGED: No horizontal padding on the main container */
    }

.explore-content > .option-tile-card,
    .explore-content > #explore-featured-for-you-placeholder {
        margin-left: 20px;
        margin-right: 20px;
    }

.option-tile-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background-color: #ffffff;
    border: 1px solid var(--card-border-color, #D0D0D0);
    border-radius: 12px;
    text-decoration: none;
    color: var(--primary-text-color, #2C2C2C);
    margin-bottom: 25px; /* Space before next content block */
    transition: transform var(--search-bounce-duration) ease-out;
}
.option-tile-card:active {
    transform: scale(var(--search-bounce-scale));
}

.option-tile-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.option-tile-text {
    flex-grow: 1;
    font-family: 'Manrope', sans-serif;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.5;
}

.option-tile-arrow {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ==========================================================================
   PART 5: AUTOCOMPLETE & SEARCH RESULTS CONTAINER
   ========================================================================== */

.search-results-container {
        background-color: #ffffff;
    }

/* --- Autocomplete Styling --- */
#autocomplete-container {
    background-color: #ffffff;
    padding: 10px 0;
}

.autocomplete-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 20px;
    cursor: pointer;
}

.autocomplete-item .autocomplete-icon {
    width: 20px;
    height: 20px;
    fill: var(--secondary-text-color, #757575);
}

.autocomplete-item .autocomplete-text {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color: var(--primary-text-color, #2C2C2C);
}

/* Highlighted text within autocomplete suggestions */
.autocomplete-text em {
    font-weight: 600;
    font-style: normal;
}


/* --- Search Results Styling --- */
#results-container {
    display: none; /* Hidden until a search is performed */
    padding: 25px 0;
}

.results-section {
    margin-bottom: 30px;
}
.results-section:last-child {
    margin-bottom: 0;
}

.results-heading {
    font-family: 'Manrope', sans-serif;
    font-size: 17px;
    font-weight: 700;
    color: var(--primary-text-color, #2C2C2C);
    margin-bottom: 15px;
    padding: 0 20px;
}

/* Horizontal scroll container for shops/sellers */
.horizontal-scroll-container {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 5px 20px;
    /* Hide scrollbar for a cleaner look */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* IE and Edge */
}
.horizontal-scroll-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari, and Opera */
}

/* Vertical container for other results */
.vertical-list-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 20px;
}

.search-empty-state {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: var(--secondary-text-color, #757575);
    padding: 10px 20px;
}

/* ==========================================================================
   PART 6: INDIVIDUAL SEARCH RESULT CARD STYLES
   ========================================================================== */

/* --- Base styles for horizontal carousel cards (Shop/Creator) --- */
.search-carousel-card {
    display: block;
    flex-shrink: 0;
    width: 280px;
    padding: 15px;
    background-color: #ffffff;
    border-radius: 12px;
    border: 1px solid var(--card-border-color, #D0D0D0);
    text-decoration: none;
    transition: transform var(--search-bounce-duration) ease-out;
}
.search-carousel-card:active {
    transform: scale(var(--search-bounce-scale));
}

.scc-content {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 55px; /* Total card padding is 15px+15px, so 55+30 = 85px total height */
}

.scc-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0; /* Prevents text overflow from pushing out the icon */
}

.scc-title, .scc-subtitle {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scc-title {
    font-family: 'Manrope', sans-serif;
    font-size: 15px;
    font-weight: 500;
    color: var(--primary-text-color, #2C2C2C);
    line-height: 1.5;
}

/* For highlighted text from Algolia */
.scc-title em {
    font-weight: 600;
    font-style: normal;
}

.scc-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: var(--secondary-text-color, #757575);
    margin-top: 2px;
}

.scc-avatar-wrapper {
    flex-shrink: 0;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    overflow: hidden;
    background-color: var(--arrow-background-color, #F0F0F0);
}

.scc-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Standalone arrow for cards without an avatar */
.scc-arrow-standalone {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

/* --- Styles for vertical product cards --- */
.search-product-card {
    display: block;
    padding: 10px;
    background-color: #ffffff;
    border-radius: 12px;
    border: 1px solid var(--card-border-color, #D0D0D0);
    text-decoration: none;
    transition: transform var(--search-bounce-duration) ease-out;
}
.search-product-card:active {
    transform: scale(var(--search-bounce-scale));
}

.spc-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.spc-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.spc-title {
    font-family: 'Manrope', sans-serif;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--primary-text-color, #2C2C2C);
    /* For multi-line truncation */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}
.spc-title em {
    font-style: normal;
    font-weight: 600;
}

.spc-description {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    line-height: 1.5;
    color: var(--secondary-text-color, #757575);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
}
.spc-description em {
    font-style: normal;
    font-weight: 600;
}


.spc-price {
    font-family: 'Manrope', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--brand-green-color, #4CAF50);
}

.spc-sub-info {
    display: flex;
    align-items: center;
    gap: 6px;
}

.spc-sub-info-icon {
    width: 14px;
    height: 14px;
    fill: var(--secondary-text-color, #757575);
}

.spc-sub-info-text {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: var(--secondary-text-color, #757575);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spc-thumbnail-wrapper {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border-radius: 12px;
    overflow: hidden;
    background-color: var(--arrow-background-color, #F0F0F0);
}

.spc-thumbnail-wrapper img.spc-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.spc-thumbnail-wrapper .spc-arrow-icon-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spc-thumbnail-wrapper .spc-arrow-icon {
    width: 22px;
    height: 22px;
}

/* ==========================================================================
   PART 7: UTILITIES
   ========================================================================== */

.bounce-effect {
    transition: transform var(--search-bounce-duration) ease-out;
    will-change: transform;
}

.bounce-effect:active {
    transform: scale(var(--search-bounce-scale));
}