/* =========================================================================
   Satva Gold — Search popup + results redesign
   Scoped under .full-width-search so this file cannot bleed into other pages.
   All existing JS hooks (#search, #searchresult, .closesearch, .show class
   toggle, .serach-results .searchloader, form/search.php payload classes
   .search-view / .product_list / .category-searchview) are preserved.
   ========================================================================= */

:root {
    --srch-gold: #b58b44;
    --srch-gold-soft: #d4a84b;
    --srch-gold-deep: #8a6932;
    --srch-gold-tint: #faf6ed;
    --srch-cream: #fcfaf5;
    --srch-charcoal: #1a1a1a;
    --srch-ink: #2b2620;
    --srch-text: #4a4540;
    --srch-muted: #8c857c;
    --srch-border: #ece4d2;
    --srch-divider: #f1ebde;
    --srch-radius: 18px;
    --srch-radius-sm: 12px;
    --srch-radius-pill: 999px;
    --srch-shadow: 0 24px 60px rgba(20, 14, 4, 0.18);
}

/* ---- Overlay (the JS toggles .show) ----
   Beats legacy custom.css:2638+:
     .full-width-search { height: 0; background: #fff; overflow: hidden; z-index: 999999 }
     .full-width-search.show { height: 100% }
   by using opacity+visibility for hide/show and !important on layout props. */
.full-width-search {
    position: fixed !important;
    inset: 0 !important;
    height: 100vh !important;
    height: 100dvh !important;
    width: 100vw !important;
    z-index: 9999999 !important;
    background: rgba(20, 14, 4, 0.55) !important;
    background-color: rgba(20, 14, 4, 0.55) !important;
    backdrop-filter: saturate(140%) blur(8px);
    -webkit-backdrop-filter: saturate(140%) blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0s linear 0.25s;
    display: flex !important;
    align-items: flex-start;
    justify-content: center;
    padding: 60px 20px 40px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    font-family: 'Mulish', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

/* Body lock while search is open — JS sets position: fixed inline (see custom.js
   satvaLockBodyForSearch), this class is just a CSS hook for any side effects */
body.search-open {
    overflow: hidden;
}

/* Legacy used height to toggle visibility; my .show class flips opacity+visibility.
   Keep both in sync so closed-state stays hidden. */
.full-width-search:not(.show) {
    height: 0 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    padding: 0 !important;
}

.full-width-search.show {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s ease, visibility 0s;
}

@media (max-width: 600px) {
    .full-width-search {
        padding: 24px 12px 20px;
    }
}

/* ---- Inner container ----
   Beats legacy custom.css:2654:
     .full-width-search .inner-search-section { padding: 50px 50px; height: 100% } */
.full-width-search .inner-search-section {
    width: 100% !important;
    max-width: 80% !important;
    height: auto !important;
    max-height: calc(100vh - 100px);
    margin: 0 !important;
    background: #fff !important;
    background-color: #fff !important;
    border-radius: var(--srch-radius) !important;
    box-shadow: var(--srch-shadow);
    overflow: hidden;
    padding: 0 !important;
    transform: translateY(-12px);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex !important;
    flex-direction: column !important;
}

.full-width-search.show .inner-search-section {
    transform: translateY(0);
}

@media (max-width: 600px) {
    .full-width-search .inner-search-section {
        border-radius: 14px !important;
    }
}

/* ---- Search input row ---- */
.full-width-search .search-form-wrapper,
.full-width-search .search-form-wrapper-2 {
    display: flex !important;
    align-items: center;
    gap: 10px;
    padding: 18px 22px !important;
    background: linear-gradient(180deg, var(--srch-cream) 0%, #fff 100%);
    border-bottom: 1px solid var(--srch-divider);
    margin: 0 !important;
    position: relative;
}

.full-width-search .search-form-wrapper::before {
    content: "";
    position: absolute;
    left: 38px;
    top: 50%;
    width: 16px;
    height: 16px;
    transform: translateY(-50%);
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b58b44' stroke-width='2.2' stroke-linecap='round'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") no-repeat center/contain;
    pointer-events: none;
    z-index: 2;
}

.full-width-search input.search-form__input,
.full-width-search input#search {
    flex: 1 !important;
    width: auto !important;
    height: 52px !important;
    padding: 0 56px 0 50px !important;
    background: #fff !important;
    background-color: #fff !important;
    border: 1px solid var(--srch-border) !important;
    border-radius: var(--srch-radius-pill) !important;
    color: var(--srch-ink) !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    letter-spacing: 0.2px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: inset 0 1px 0 rgba(40, 30, 10, 0.02);
}

.full-width-search input.search-form__input::placeholder {
    color: var(--srch-muted) !important;
    font-weight: 500 !important;
}

.full-width-search input.search-form__input:focus {
    outline: none !important;
    border-color: var(--srch-gold) !important;
    box-shadow: 0 0 0 3px rgba(181, 139, 68, 0.12) !important;
}

/* Close button — top-right pill, neutral that pops on hover */
.full-width-search .closesearch,
.full-width-search button.closesearch.search-form__submit {
    position: relative !important;
    flex: 0 0 auto !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    border: 1px solid var(--srch-border) !important;
    border-radius: 50% !important;
    color: var(--srch-ink) !important;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
    box-shadow: 0 1px 3px rgba(40, 30, 10, 0.05);
}

.full-width-search .closesearch:hover {
    background: #fdecec !important;
    color: #b13a3a !important;
    border-color: #f4c4c4 !important;
    transform: rotate(90deg);
}

.full-width-search .closesearch .fa,
.full-width-search .closesearch i {
    font-size: 14px !important;
    color: inherit !important;
}

/* ---- Results body ----
   Beats legacy custom.css:2669: .inner-search-section .serach-results { margin-top: 35px }
   and the legacy max-height: 80vh. */
.full-width-search .serach-results {
    padding: 22px 24px 28px !important;
    margin: 0 !important;
    max-height: none !important;
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    border: none !important;
}

.full-width-search .serach-results::-webkit-scrollbar {
    width: 8px;
}

.full-width-search .serach-results::-webkit-scrollbar-thumb {
    background: var(--srch-border);
    border-radius: 999px;
}

@media (max-width: 600px) {
    .full-width-search .serach-results {
        padding: 18px 16px 22px !important;
    }
}

/* Loader */
.full-width-search .searchloader {
    display: none;
    text-align: center;
    padding: 24px 0;
}

.full-width-search .searchloader.show {
    display: block;
}

.full-width-search .searchloader p {
    margin: 0;
    color: var(--srch-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    position: relative;
    padding-left: 24px;
    display: inline-block;
}

.full-width-search .searchloader p::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 14px;
    height: 14px;
    margin-top: -7px;
    border: 2px solid var(--srch-divider);
    border-top-color: var(--srch-gold);
    border-radius: 50%;
    animation: srchSpin 0.8s linear infinite;
}

@keyframes srchSpin {
    to {
        transform: rotate(360deg);
    }
}

/* ---- Results grid override (PHP sends .col-md-3 / .col-md-12) ---- */
.full-width-search .productSearch {
    margin: 0 !important;
}

.full-width-search .productSearch .row,
.full-width-search #searchresult {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 14px !important;
    margin: 0 !important;
}

@media (max-width: 992px) {

    .full-width-search .productSearch .row,
    .full-width-search #searchresult {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 768px) {

    .full-width-search .productSearch .row,
    .full-width-search #searchresult {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
}

@media (max-width: 420px) {

    .full-width-search .productSearch .row,
    .full-width-search #searchresult {
        grid-template-columns: 1fr !important;
    }
}

/* Reset Bootstrap col widths so the grid takes over */
.full-width-search #searchresult>[class*="col-"] {
    width: auto !important;
    max-width: none !important;
    flex: none !important;
    padding: 0 !important;
}

/* ---- Categories section (col-md-12 wraps category list) ---- */
.full-width-search #searchresult>.col-md-12 {
    grid-column: 1 / -1 !important;
}

.full-width-search .category-searchview {
    background: var(--srch-cream);
    border: 1px solid var(--srch-divider);
    border-radius: var(--srch-radius-sm);
    padding: 14px 16px;
    margin-bottom: 6px;
}

.full-width-search .category-searchview .titlecat {
    margin: 0 0 10px !important;
    font-size: 10.5px !important;
    font-weight: 800 !important;
    color: var(--srch-gold-deep) !important;
    letter-spacing: 1.8px !important;
    text-transform: uppercase !important;
}

.full-width-search .category-searchview ul {
    display: inline-flex !important;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
    width: 100%;
}

.full-width-search .category-searchview ul li {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.full-width-search .category-searchview ul li .details {
    margin: 0;
}

.full-width-search .category-searchview ul li .pname,
.full-width-search .category-searchview ul li .purity {
    margin: 0 !important;
    display: inline;
}

.full-width-search .category-searchview ul li .pname a {
    display: inline-flex;
    align-items: center;
    padding: 7px 14px;
    background: #fff;
    border: 1px solid var(--srch-border);
    border-radius: var(--srch-radius-pill);
    color: var(--srch-ink);
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-decoration: none !important;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.full-width-search .category-searchview ul li .pname a:hover {
    background: var(--srch-charcoal);
    color: #fff;
    border-color: var(--srch-charcoal);
    transform: translateY(-1px);
}

.full-width-search .category-searchview ul li .purity {
    display: none;
}

/* ---- Product card (.search-view .product_list) ----
   Beats legacy custom.css:2673+:
     .search-view .product_list { display: flex; padding: 15px; background:#f5f5f5 }
     .search-view .product_list .imagesearch { width: 34% }
     .search-view .product_list .product-details { padding-left:20px; width:66% }
   by chaining .full-width-search up front + !important on layout props. */

.full-width-search .search-view {
    background: transparent !important;
    margin: 0 !important;
    padding: 0 !important;
}

.full-width-search .search-view .product_list {
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
    background-color: #fff !important;
    border: 1px solid var(--srch-border) !important;
    border-radius: var(--srch-radius-sm) !important;
    overflow: hidden;
    transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
    height: 100%;
    box-shadow: none !important;
}

.full-width-search .search-view .product_list:hover {
    transform: translateY(-3px);
    border-color: rgba(181, 139, 68, 0.40) !important;
    box-shadow: 0 14px 32px rgba(40, 30, 10, 0.10) !important;
}

/* Image area — full-width hero at top of card.  Legacy "34%" width is
   blown away by !important here. */
.full-width-search .search-view .product_list .imagesearch {
    position: relative !important;
    width: 100% !important;
    max-width: none !important;
    aspect-ratio: 1 / 1 !important;
    background: #f4f4f0 !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
    flex: 0 0 auto !important;
}

.full-width-search .search-view .product_list .imagesearch a {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
}

.full-width-search .search-view .product_list .imagesearch img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: cover !important;
    border-radius: 0 !important;
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.full-width-search .search-view .product_list:hover .imagesearch img {
    transform: scale(1.06);
}

/* Details area — full width below image (legacy made it 66% side-by-side) */
.full-width-search .search-view .product_list .product-details {
    width: 100% !important;
    padding: 14px 14px 16px !important;
    display: flex !important;
    flex-direction: column;
    gap: 4px;
    background: #fff !important;
    text-align: left;
}

.full-width-search .search-view .product-details .details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.full-width-search .search-view .pname {
    margin: 0 !important;
    line-height: 1.35;
    /* clamp to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.7em;
}

.full-width-search .search-view .pname a {
    color: var(--srch-ink) !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    text-transform: capitalize;
    transition: color 0.15s ease;
}

.full-width-search .search-view .pname a:hover {
    color: var(--srch-gold-deep) !important;
}

.full-width-search .search-view .purity {
    margin: 0 !important;
    display: inline-block;
    align-self: flex-start;
    font-size: 10.5px !important;
    font-weight: 800 !important;
    color: var(--srch-gold-deep) !important;
    letter-spacing: 1.2px !important;
    text-transform: uppercase !important;
}

.full-width-search .search-view .weight {
    margin: 0 !important;
    font-size: 11.5px !important;
    color: var(--srch-muted) !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.full-width-search .search-view .weight b {
    color: var(--srch-text) !important;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
}

.full-width-search .search-view .price {
    margin: 6px 0 0 !important;
    padding-top: 8px;
    border-top: 1px solid var(--srch-divider);
    font-size: 11px !important;
    color: var(--srch-muted) !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.full-width-search .search-view .price b {
    display: block;
    color: var(--srch-charcoal) !important;
    font-size: 17px !important;
    font-weight: 800 !important;
    letter-spacing: -0.2px;
    margin-top: 2px;
}

/* ---- Empty / no-results message ---- */
.full-width-search #searchresult>.col-md-4.mx-auto.text-center {
    grid-column: 1 / -1 !important;
    padding: 50px 20px !important;
    text-align: center !important;
    background: var(--srch-cream);
    border: 1px solid var(--srch-divider);
    border-radius: var(--srch-radius-sm);
}

.full-width-search #searchresult>.col-md-4.mx-auto.text-center p {
    margin: 0 !important;
    color: var(--srch-muted) !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    letter-spacing: 0.4px;
}

.full-width-search #searchresult>.col-md-4.mx-auto.text-center p b {
    display: block;
    margin-bottom: 4px;
    color: var(--srch-ink);
    font-size: 16px;
    font-weight: 800;
}

/* ---- Empty state (default — no search yet) ---- */
.full-width-search #searchresult:empty::after {
    content: "Start typing to search jewellery…";
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px 50px;
    color: var(--srch-muted);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* =========================================================================
   MOBILE — full-screen overlay with sticky search bar + close icon
   ≤ 768px: popup fills the entire viewport (no backdrop, no rounded card).
   The search input row is sticky so the close icon stays reachable while
   the user scrolls through long result lists.
   ========================================================================= */
@media (max-width: 768px) {
    .full-width-search {
        padding: 0 !important;
        background: #fff !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        align-items: stretch;
        overflow: hidden;
    }

    .full-width-search .inner-search-section {
        max-width: 100% !important;
        width: 100% !important;
        height: 100vh !important;
        height: 100dvh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        transform: none !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden;
    }

    .full-width-search.show .inner-search-section { transform: none !important; }

    /* Sticky header — search input + close button always reachable */
    .full-width-search .search-form-wrapper,
    .full-width-search .search-form-wrapper-2 {
        position: sticky !important;
        top: 0;
        z-index: 5;
        padding: 12px 14px !important;
        gap: 8px;
        background: #fff !important;
        border-bottom: 1px solid var(--srch-divider) !important;
        box-shadow: 0 2px 8px rgba(40, 30, 10, 0.04);
        flex: 0 0 auto;
    }

    /* Move the gold magnifier icon to align with the smaller padded input */
    .full-width-search .search-form-wrapper::before {
        left: 30px;
        width: 14px;
        height: 14px;
    }

    .full-width-search input.search-form__input,
    .full-width-search input#search {
        height: 44px !important;
        padding: 0 14px 0 42px !important;
        font-size: 15px !important;
    }

    /* Close button — slightly smaller, no rotation (less playful on mobile) */
    .full-width-search .closesearch,
    .full-width-search button.closesearch.search-form__submit {
        width: 38px !important;
        height: 38px !important;
        background: var(--srch-cream) !important;
    }

    .full-width-search .closesearch:hover { transform: none; }

    /* Results take the remaining viewport height and scroll */
    .full-width-search .serach-results {
        flex: 1 1 auto !important;
        max-height: none !important;
        padding: 16px 14px 24px !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Grid on mobile: 2 cols, single col below 420 (already set earlier) */
    .full-width-search .productSearch .row,
    .full-width-search #searchresult {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
}

@media (max-width: 420px) {
    .full-width-search .productSearch .row,
    .full-width-search #searchresult {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .full-width-search .search-view .product_list .product-details {
        padding: 10px 10px 12px !important;
        gap: 3px;
    }

    .full-width-search .search-view .pname a {
        font-size: 12px !important;
    }

    .full-width-search .search-view .price b {
        font-size: 14px !important;
    }

    .full-width-search .search-view .purity,
    .full-width-search .search-view .weight,
    .full-width-search .search-view .price {
        font-size: 10px !important;
    }
}