/* GENERAL - START */
.search-section {
    margin-bottom: 20px;
    padding: 0;
}
/* GENERAL - END */

/* SEARCH INFO - START */
#search-info .full-width-background {
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    width: 100vw;
    background: var(--surface-2);
}

.search-inner-container {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 20px 0;
}

.search-text-area {
    flex: 1;
    position: relative;
    z-index: 2;
    text-align: center;
}

.search-title {
    font-size: 28px;
    margin: 0;
    font-weight: 700;
    line-height: 1.2;
    color: var(--black);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .search-inner-container {
        padding: 20px 0;
    }
    
    .search-title {
        font-size: 22px;
    }
}
/* SEARCH INFO - END */

/* SEARCH RESULTS - START */
#search-results {
    min-height: 300px;
}

/* #search-results .no-products-message - Defined in product-grid.css */

/* Ensure product grid displays correctly */
#search-results .jk-product-grid {
    margin-top: 20px;
}
/* SEARCH RESULTS - END */

/* AUTOCOMPLETE SEARCH - START */
.jk-search-wrapper {
    position: relative;
    width: 100%;
}

.jk-search-autocomplete {
    position: fixed;
    top: 0;
    left: 0;
    transform: none;
    width: clamp(280px, 90vw, 340px);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    box-shadow: var(--dropdown-shadow);
    max-height: 70vh;
    overflow-y: scroll;
    overflow-x: hidden;
    z-index: 9999;
    display: none;
    padding: 8px 10px 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
    scrollbar-gutter: stable;
}

.jk-search-autocomplete::-webkit-scrollbar {
    width: 10px;
    -webkit-appearance: none;
}

.jk-search-autocomplete::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: var(--border-radius);
}

.jk-search-autocomplete::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--border-radius);
    min-height: 40px;
}

.jk-search-autocomplete::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* Loading state */
.jk-search-loading {
    padding: 20px;
    text-align: center;
    color: var(--text-grey);
    font-size: 14px;
}

/* No results */
.jk-search-no-results {
    padding: 20px;
    text-align: center;
    color: var(--text-grey);
    font-size: 14px;
}

/* Search header with close button and count */
.jk-search-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.jk-search-count {
    font-size: 13px;
    font-weight: 600;
}

/* Results container */
.jk-search-results {
    padding: 0 0 30px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Product card in autocomplete */
.jk-search-product-card {
    display: grid;
    grid-template-columns: 55px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 6px;
    border: none;
    background: var(--white);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: box-shadow 0.2s ease, background-color 0.2s ease;
}

.jk-search-product-card:hover,
.jk-search-product-card.selected {
    background-color: var(--white);
    box-shadow: var(--card-shadow-hover);
}

.jk-search-product-link {
    display: contents;
    text-decoration: none;
    color: inherit;
}

/* Product image */
.jk-search-product-image {
    position: relative;
    width: 55px;
    height: 55px;
    flex-shrink: 0;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--surface-3);
}

.jk-search-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.jk-search-sale-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    background: var(--secondary);
    color: var(--white);
    padding: 2px 6px;
    border-radius: var(--border-radius);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    display: none;
}

/* Product info */
.jk-search-product-info {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    gap: 0;
}

.jk-search-product-title {
    margin: 0;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--black);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.jk-search-product-price {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--black);
    white-space: nowrap;
}

.jk-search-product-price del {
    color: var(--text-grey);
    margin-right: 6px;
    font-weight: 400;
}

.jk-search-product-price ins {
    text-decoration: none;
    color: var(--cta);
}

/* Quantity controls in search */
.jk-search-qty-wrapper {
    margin-top: 0;
    padding-top: 0;
    display: flex;
    align-items: center;
    margin-left: auto;
}

.jk-search-qty-control {
    width: auto;
    position: relative;
    display: flex;
    align-items: center;
}

.jk-search-qty-control.updating {
    opacity: 0.6;
    pointer-events: none;
}

.jk-search-qty-row {
    display: flex;
    align-items: center;
    gap: 0;
    justify-content: flex-end;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.jk-search-qty-btn {
    padding: 0 8px;
    border: none;
    background: var(--white);
    color: var(--black);
    font-size: 13px;
    font-weight: 700;
    border-radius: 0;
    cursor: pointer;
    white-space: nowrap;
    height: 32px;
    min-width: 30px;
    line-height: 1;
}

.jk-search-qty-btn:hover {
    background: var(--black);
    color: var(--white);
}

.jk-search-qty-minus {
    border-radius: var(--border-radius) 0 0 var(--border-radius);
}

.jk-search-qty-plus {
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.jk-search-qty-add {
    background: var(--white);
    color: var(--black);
    border: 1px solid var(--border);
    margin-right: auto;
    min-width: 96px;
    height: 32px;
    border-radius: var(--border-radius);
}

.jk-search-qty-add:hover {
    background: var(--black);
    color: var(--white);
    border-color: var(--black);
}

/* Hide +/- controls when quantity is 0 */
.jk-search-qty-control.is-empty .jk-search-qty-minus,
.jk-search-qty-control.is-empty .jk-search-qty-plus,
.jk-search-qty-control.is-empty .jk-search-qty-input {
    display: none;
}

/* Show add button when quantity is 0 */
.jk-search-qty-control.is-empty .jk-search-qty-add {
    display: block;
}

/* Hide add button when quantity > 0 */
.jk-search-qty-control:not(.is-empty) .jk-search-qty-add {
    display: none;
}

/* Hide WooCommerce "View cart" link in search dropdown */
.jk-search-qty-wrapper .added_to_cart,
.jk-search-autocomplete .added_to_cart {
    display: none !important;
}

.jk-search-qty-input {
    width: 36px;
    padding: 0 4px;
    text-align: center;
    border: none;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    font-size: 13px;
    font-weight: 700;
    background: var(--white);
    color: var(--black);
    box-sizing: border-box;
    height: 32px;
}

/* Remove up/down arrows from number input */
.jk-search-qty-input::-webkit-outer-spin-button,
.jk-search-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.jk-search-qty-input[type=number] {
    -moz-appearance: textfield;
}

/* View all results link container */
.jk-search-footer {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    padding: 10px 0 0 0;
    margin: 0 0 -12px 0;
    border-top: 1px solid var(--border);
}

.jk-search-view-all {
    display: block;
    width: 100%;
    padding: 14px 12px;
    text-align: center;
    background: var(--black);
    color: var(--white);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border-radius: var(--border-radius);
    border: none;
    box-sizing: border-box;
}

.jk-search-view-all:hover {
    background: var(--secondary);
    color: var(--white);
}

.jk-search-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--black);
    color: var(--white);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.jk-search-close:hover {
    background: rgba(0, 0, 0, 0.85);
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .jk-search-autocomplete {
        position: fixed;
        width: calc(100vw - 32px);
        max-width: 360px;
        max-height: calc(100vh - 90px);
        top: 76px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: var(--border-radius);
        padding: 8px 8px 12px;
    }


    .jk-search-product-card {
        padding: 6px;
        gap: 8px;
    }

    .jk-search-product-image {
        width: 55px;
        height: 55px;
    }

    .jk-search-product-title {
        font-size: 11.5px;
    }

    .jk-search-product-price {
        font-size: 11.5px;
    }

    .jk-search-qty-btn {
        padding: 0 8px;
        font-size: 13px;
    }

    .jk-search-qty-input {
        width: 36px;
        padding: 0 4px;
        font-size: 13px;
        height: 32px;
    }

    .jk-search-qty-add {
        font-size: 12.5px;
        padding: 0 8px;
    }
}

/* Very small mobile screens */
@media (max-width: 480px) {
    .jk-search-product-link {
        gap: 8px;
    }

    .jk-search-product-image {
        width: 55px;
        height: 55px;
    }

    .jk-search-qty-row {
        gap: 0;
    }

    .jk-search-qty-btn {
        padding: 0 8px;
        font-size: 12px;
    }

    .jk-search-qty-input {
        width: 34px;
        padding: 0 3px;
        font-size: 12px;
        height: 32px;
    }
}

/* Tablet landscape and small desktop */
@media (min-width: 769px) and (max-width: 1024px) {
    .jk-search-autocomplete {
        max-height: 450px;
    }
}

/* Large desktop */
@media (min-width: 1200px) {
    .jk-search-autocomplete {
        max-height: 550px;
    }
}
/* AUTOCOMPLETE SEARCH - END */
