/* assets/css/wooson.css */

/* Container: all controls in one row, wrapping on narrow screens */
.wooson-search-widget {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-family: sans-serif;
    margin-bottom: 0.1em;
}

/* Scope dropdown container */
.wooson-filters {
    flex: 0 0 auto;
    display: none; /* TODO: make this configurable */
}

/* Search-input area: grows to fill and positions the icon */
.wooson-search-input {
    flex: 1 1 auto;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Font Awesome search icon inside the input */
.wooson-search-icon {
    position: absolute;
    left: 12px;
    top: 18px;
    transform: translateY(-50%);
    color: #aaa;
    pointer-events: none;
    font-size: 16px;
}

/* Uniform sizing for selects, text inputs, and checkbox label */
.wooson-search-widget select,
.wooson-search-widget input[type="text"],
.wooson-search-widget label {
    height: 36px;
    font-size: 14px;
    box-sizing: border-box;
    padding: 0 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: #fff;
}

/* Make room for the icon */
#wooson-search-field {
    flex: 1 1 auto;
    min-width: 0;
    padding-left: 36px;
}

/* Scope dropdown itself */
#wooson_scope {
    min-width: 120px;
}

/* Available checkbox label */
.wooson-search-widget label {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Category dropdown */
#wooson_category {
    min-width: 140px;
}

/* Live preview wrapper: floats below input */
.wooson-live-results-wrapper {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1000;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 3px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    display: none;
}
.wooson-live-results-wrapper.has-results {
    display: block;
}

/* Preview total text */
.wooson-total {
    margin: 8px;
    font-weight: bold;
}

/* Preview list */
.wooson-live-results-wrapper ul.products {
    max-height: 300px;
    overflow-y: auto;
    padding: 0;
    margin: 0;
    list-style: none;
}

/* Preview items */
.wooson-item {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-bottom: 1px solid #eee;
    background: #fff;
}
.wooson-item img {
    margin-right: 8px;
}
.wooson-item a {
    font-weight: bold;
    margin-right: 6px;
    color: #0073aa;
    text-decoration: none;
}
.wooson-item a:hover {
    text-decoration: underline;
}
.wooson-item .found-in {
    font-size: 12px;
    color: #555;
}

/* WebKit scrollbar */
.wooson-live-results-wrapper::-webkit-scrollbar {
    width: 8px;
}
.wooson-live-results-wrapper::-webkit-scrollbar-track {
    background: transparent;
}
.wooson-live-results-wrapper::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 4px;
}

/* Full-page results list */
.wooson-results-header {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.wooson-full-total {
    margin: 0;
}
#wooson_orderby {
    margin: 0;
}
ul.wooson-full-list {
    clear: both;
    list-style: none;
    padding: 0;
    margin: 0;
}
ul.wooson-full-list li.product {
    margin-bottom: 1em;
}

/* Loading indicator */
.wooson-loading {
    text-align: center;
    padding: 1em;
    font-style: italic;
    color: #666;
}

/* ensure spinner appears above content */
.wooson-live-results-wrapper,
.wooson-full-list {
    position: relative;
}


/* Responsive: stack under 600px */
@media (max-width: 600px) {
    .wooson-search-widget {
        flex-direction: column;
        align-items: stretch;
    }
    .wooson-search-input {
        align-items: stretch;
        flex-wrap: wrap;
        gap: 0;
    }

    .wooson-search-widget input[type="text"] {
        width: 100%;
        margin-bottom: 8px;
    }
    select#wooson_category {
        width: 70%
    }
    .wooson-results-header {
        flex-direction: column;
        align-items: stretch;
    }
    #wooson_orderby {
        width: 100%;
        margin-top: 8px;
    }
    .wooson-search-widget label {
        width: 30%;
    }
}
