/**
 * Bartleby Product Search - Styles
 */

.bartleby-product-search {
    margin: 20px auto;
    padding: 12px;
    position: relative;
    width: 100%;
    max-width: 640px;
    background: #fff;
    box-sizing: border-box;
}
.bartleby-product-search *,
.bartleby-product-search *::before,
.bartleby-product-search *::after {
    box-sizing: border-box;
}

.bartleby-product-search .bartleby-searchform {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.bartleby-product-search .bartleby-search-input,
.bartleby-product-search input[type="search"].bartleby-search-input {
    flex: 1 1 auto;
    display: block;
    width: 100%;
    min-width: 0;
    height: auto;
    margin: 0;
    padding: 12px 14px !important;
    border: 2px solid #ddd !important;
    border-radius: 0 !important;
    -webkit-appearance: none;
    appearance: none;
    background: #fff !important;
    color: #333 !important;
    font-size: 16px !important;
    line-height: 1.4;
    box-shadow: none;
}

.bartleby-product-search input[type="search"]:focus {
    outline: none;
    border-color: #999;
}

.bartleby-product-search .bartleby-search-submit {
    padding: 12px 18px;
    line-height: 1.4;
    background: #111;
    color: #fff;
    border: none;
    border-radius: 0;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s ease;
}

.bartleby-product-search .bartleby-search-submit:hover {
    background: #333;
}

/* Suggestions dropdown */
.bartleby-search-suggestions {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 1000;
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    max-height: 320px;
    overflow-y: auto;
}

.bartleby-search-suggestions li {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f1f1f1;
    font-size: 14px;
    transition: background 0.15s ease;
}

.bartleby-search-suggestions li:last-child {
    border-bottom: none;
}

.bartleby-search-suggestions li.selected,
.bartleby-search-suggestions li:hover {
    background: #f5f5f5;
}

.bartleby-search-suggestions li:active {
    background: #e8e8e8;
}

/* Screen reader only */
.screen-reader-text {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.bartleby-search-suggestions li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}
.bartleby-suggestion-price {
    white-space: nowrap;
    color: #666;
}

.bartleby-suggestion-title {
    min-width: 0;
    overflow-wrap: anywhere;
}
.bartleby-search-suggestions li.bartleby-suggestion-all {
    justify-content: center;
    font-weight: 600;
    color: #111;
    background: #fafafa;
}

/* Responsive */
@media (max-width: 768px) {
    .bartleby-product-search {
        max-width: 100%;
        padding: 8px;
        margin-bottom: 1rem;
    }
    .bartleby-search-suggestions {
        max-height: 60vh;
    }
    .bartleby-search-suggestions li {
        padding: 0.6rem 0.75rem;
        font-size: 14px;
    }
}
@media (max-width: 480px) {
    .bartleby-product-search .bartleby-searchform {
        flex-wrap: wrap;
    }
    .bartleby-product-search input[type="search"] {
        flex: 1 1 100%;
    }
    .bartleby-product-search .bartleby-search-submit {
        flex: 1 1 100%;
    }
    .bartleby-search-suggestions li {
        flex-direction: column;
        gap: 0.25rem;
    }
}

/* Hide the old core Search block left in the front-page content (replaced by this box). */
body.home form.wp-block-search[action] {
    display: none !important;
}
