/*
 * WooCommerce Ajax Search Bar Frontend CSS
 */

 

.wcasb-search-container {
    position: relative;
    width: 100%;
    max-width: 700px;
    /* Adjust as needed */
    margin: 1em auto;
}

.wcasb-search-form {
    display: flex;
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 8px;
    /* Rounded corners */
    overflow: hidden;
    /* To keep child elements rounded */
}

/* Category Dropdown */
.wcasb-search-category {
    display: flex;
    align-items: center;
    border-right: 1px solid #ddd;
    background-color: #f9f9f9;
}

#wcasb-category-select {
    padding: 0 15px;
    height: 48px;
    /* Match input/button height */
    border: none;
    background: transparent;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    font-size: 16px;
    color: #555;
    padding-right: 30px;
    /* Space for dropdown arrow */
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23555" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

/* Search Input Area */
.wcasb-search-input-wrap {
    flex-grow: 1;
    /* Takes up remaining space */
    position: relative;
}

.wcasb-search-field {
    width: 100%;
    height: 48px;
    /* Match button height */
    padding: 0 15px;
    border: none;
    font-size: 16px;
    box-sizing: border-box;
    /* Include padding in width */
    padding-right: 45px;
    /* Make space for loader */
}

.wcasb-search-field:focus {
    outline: none;
    box-shadow: none;
}

/* Loader Spinner */
.wcasb-loader {
    display: none;
    /* Hidden by default */
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 3px solid #eee;
    /* Light grey */
    border-top: 3px solid #000;
    /* Black to match button */
    border-radius: 50%;
    animation: wcasb-spin 1s linear infinite;
    z-index: 5;
}

.wcasb-search-input-wrap.is-loading .wcasb-loader {
    display: block;
    /* Show when loading */
}

@keyframes wcasb-spin {
    0% {
        transform: translateY(-50%) rotate(0deg);
    }

    100% {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* Search Button */
.wcasb-search-submit {
    height: 48px;
    /* Match input height */
    padding: 0 25px;
    border: none;
    background-color: #000;
    /* Black background */
    color: #fff;
    /* White text */
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.wcasb-search-submit:hover {
    background-color: #333;
    /* Darker grey on hover */
}


/* * FORCE VISIBILITY 
 * This new class will be added by JavaScript to override
 * any 'display: none' from the theme.
 */
#wcasb-search-results.is-visible {
    display: block !important;
}

#wcasb-search-results {
    position: absolute;
    top: 100%;
    /* Position right below the search bar */
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 99999;
    /* <-- INCREASED Z-INDEX */
    display: none;
    /* Hidden by default */
    max-height: 400px;
    /* Set max height for scrollbar */
    overflow-y: auto;
    overflow-x: hidden;
}

#wcasb-search-results.loading {
    display: block;
    padding: 15px;
    text-align: center;
    color: #888;
}

#wcasb-search-results ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

#wcasb-search-results li {
    padding: 10px;
    border-bottom: 1px solid #eee;
}

#wcasb-search-results li:last-child {
    border-bottom: none;
}

#wcasb-search-results li a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #333;
}

#wcasb-search-results li img {
    width: 50px;
    height: 50px;
    margin-right: 15px;
    object-fit: cover;
}

#wcasb-search-results .wcasb-result-info {
    display: flex;
    flex-direction: column;
}

#wcasb-search-results .wcasb-result-title {
    font-weight: bold;
    margin-bottom: 5px;
}

#wcasb-search-results .wcasb-no-results {
    padding: 15px;
    text-align: center;
    color: #888;
}

/* "See all results" Link */
.wcasb-view-all-results {
    display: block;
    text-align: center;
    padding: 12px;
    background: #f9f9f9;
    text-decoration: none;
    color: #337ab7;
    /* Blue link color */
    font-weight: bold;
    border-top: 1px solid #eee;
}

.wcasb-view-all-results:hover {
    background: #f1f1f1;
}

/* Price Styling */
#wcasb-search-results .wcasb-result-price {
    font-size: 1em;
    /* Make it more prominent */
    color: #d32f2f;
    /* Red color for price, matching screenshot */
}

#wcasb-search-results .wcasb-result-price del {
    color: #999;
    /* Grey for strikethrough price */
    font-weight: normal;
    font-size: 0.9em;
    margin-right: 5px;
}

#wcasb-search-results .wcasb-result-price ins {
    text-decoration: none;
    /* 'ins' tag often has underline */
    font-weight: bold;
}

/* Adjust price color if it's not a sale */
#wcasb-search-results .wcasb-result-price .woocommerce-Price-amount.amount {
    color: #d32f2f;
    font-weight: bold;
}

/* Ensure sale price is red and bold */
#wcasb-search-results .wcasb-result-price ins .woocommerce-Price-amount.amount {
    color: #d32f2f;
    font-weight: bold;
}