:root {
    /* Primary Colors */
    --primary-burgundy: #573d3d;
    /* The main brand color from your sidebar */
    --primary-dark: #1A1A1A;
    /* Deep charcoal for text and logo elements */
    --accent-gold: #C5A059;
    /* Optional: For highlighting premium parts or badges */
    --red: #db2920;
    --black: #1f1a17;

    /* Backgrounds & Surfaces */
    --bg-main: #FFFFFF;
    /* Clean white background */
    --bg-subtle: #F8F9FA;
    /* Very light gray for section backgrounds */
    --surface-border: #E0E0E0;
    /* Light borders for product cards */

    /* Functional Colors */
    --sale-red: #E74C3C;
    /* For the 'Sale!' badge seen in your screenshot */
    --text-main: #333333;
    /* Primary body text */
    --text-muted: #757575;
    /* Secondary/meta text */

    /* Hover & Interaction States */
    --hover-burgundy: #4A3332;
    /* Darker shade for button hovers */
    --hover-overlay: rgba(0, 0, 0, 0.05);

    /* Shadows & Radius */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --radius-main: 4px;
    /* Keeps the professional, sharp look */
}


/* Main search container */
.awps-search-container {
    position: relative;
}

.awps-search-input {
    height: 44;
    font-size: 16px;
    border-color: var(--primary-burgundy) !important;
}

.awps-search-input:focus {
    border-color: var(--hover-burgundy) !important;
    box-shadow: 0 0 0 0.25rem rgba(87, 61, 61, 0.25) !important;
}

/* Search button */
.btn-dark {
    background-color: var(--primary-burgundy) !important;
    border-color: var(--primary-burgundy) !important;
}

.btn-dark:hover {
    background-color: var(--hover-burgundy) !important;
    border-color: var(--hover-burgundy) !important;
}

/* Autocomplete container - FIXED POSITION */
.awps-autocomplete-container {
    display: none;
    position: absolute;
    top: 100% !important;
    left: 0;
    right: 0;
    background: var(--bg-main);
    border: 1px solid var(--primary-burgundy);
    border-radius: 0 0 0.375rem 0.375rem;
    box-shadow: var(--shadow-md);
    z-index: 9999;
    margin-top: 5px;
    max-height: 70vh;
    /* Limit height to 70% of viewport */
    overflow-y: auto;
    /* Allow scrolling if needed, but view all should be visible */
}

/* Ensure dropdown stays within viewport */
.awps-autocomplete-container {
    max-height: min(500px, 70vh);
    /* Max 500px or 70vh, whichever is smaller */
}

/* Results list */
.awps-results-list {
    padding: 0.5rem;
    max-height: calc(100% - 70px);
    /* Reserve space for view all button */
    overflow-y: auto;
}

/* Individual result item */
.awps-result-item {
    display: flex;
    padding: 0.75rem;
    border-bottom: 1px solid var(--surface-border);
    text-decoration: none;
    color: var(--text-main);
    transition: all 0.2s ease;
    cursor: pointer;
}

.awps-result-item:last-child {
    border-bottom: none;
}

.awps-result-item:hover,
.awps-result-item.active {
    background-color: var(--bg-subtle);
    color: var(--text-main);
}

/* Result image */
.awps-result-image {
    flex: 0 0 60px;
    margin-right: 1rem;
    display: flex;
    align-items: center;
}

.awps-result-image img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-main);
    border: 1px solid var(--surface-border);
}

/* Result content */
.awps-result-content {
    flex: 1;
    min-width: 0;
    /* Prevent text overflow */
}

.awps-result-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
    line-height: 1.3;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    /* Limit to 2 lines */
    -webkit-box-orient: vertical;
}

.awps-result-sku {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.awps-result-price {
    font-weight: 700;
    color: var(--red);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.awps-result-price .woocommerce-Price-amount {
    font-weight: inherit;
}

.awps-result-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    /* Limit to 2 lines */
    -webkit-box-orient: vertical;
}

/* Loading state */
.awps-loading {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background-color: var(--bg-subtle);
    border-radius: 0 0 0.375rem 0.375rem;
}

.awps-no-results,
.awps-error {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    background-color: var(--bg-subtle);
    border-radius: 0 0 0.375rem 0.375rem;
}

/* Spinner */
.spinner-border {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
    border-color: var(--primary-burgundy) transparent var(--primary-burgundy) transparent;
}

/* View All button styles - FIXED POSITION AT BOTTOM */
.awps-view-all-container {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    border-top: 2px solid var(--primary-burgundy);
    padding: 0.75rem;
    background-color: var(--bg-main);
    z-index: 2;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
}

.awps-view-all {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background-color: var(--primary-burgundy);
    border-radius: var(--radius-main);
    transition: all 0.2s ease;
    text-decoration: none;
    color: white;
}

.awps-view-all:hover,
.awps-view-all.active {
    background-color: var(--hover-burgundy);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
    color: white;
    text-decoration: none;
}

.awps-view-all-icon {
    flex: 0 0 40px;
    text-align: center;
    color: white;
    font-size: 1.1rem;
}

.awps-view-all-arrow {
    flex: 0 0 24px;
    text-align: center;
    color: white;
    font-size: 0.9rem;
    opacity: 0.8;
    transition: transform 0.2s ease;
}

.awps-view-all:hover .awps-view-all-arrow {
    transform: translateX(3px);
    opacity: 1;
}

.awps-view-all .awps-result-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.awps-view-all .awps-result-title {
    color: white;
    font-weight: 600;
    margin: 0;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Product count badge */
.awps-results-count {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Custom scrollbar */
.awps-autocomplete-container::-webkit-scrollbar {
    width: 8px;
}

.awps-autocomplete-container::-webkit-scrollbar-track {
    background: var(--bg-subtle);
    border-radius: 4px;
}

.awps-autocomplete-container::-webkit-scrollbar-thumb {
    background: var(--primary-burgundy);
    border-radius: 4px;
}

.awps-results-list::-webkit-scrollbar {
    width: 6px;
}

.awps-results-list::-webkit-scrollbar-track {
    background: transparent;
}

.awps-results-list::-webkit-scrollbar-thumb {
    background: var(--surface-border);
    border-radius: 3px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .awps-autocomplete-container {
        position: fixed;
        top: auto !important;
        left: 10px;
        right: 10px;
        bottom: 10px;
        max-height: 80vh;
        border-radius: 0.375rem;
    }

    .awps-result-item {
        padding: 0.5rem;
    }

    .awps-result-image {
        flex: 0 0 50px;
        margin-right: 0.75rem;
    }

    .awps-result-image img {
        width: 50px;
        height: 50px;
    }

    .awps-view-all {
        padding: 0.5rem;
    }

    .awps-view-all-icon {
        flex: 0 0 30px;
        font-size: 1rem;
    }

    .awps-view-all-arrow {
        flex: 0 0 20px;
        font-size: 0.8rem;
    }

    .awps-view-all .awps-result-title {
        font-size: 0.9rem;
    }
}

/* Ensure proper z-index for dropdown */
.form-control:focus {
    z-index: 1;
}

/* Fix for Bootstrap 5.3 rounded pills */
.rounded-start-pill {
    border-top-left-radius: 50rem !important;
    border-bottom-left-radius: 50rem !important;
}

.rounded-end-pill {
    border-top-right-radius: 50rem !important;
    border-bottom-right-radius: 50rem !important;
}

/* Limit the number of results shown to prevent overflow */
.awps-autocomplete-container .awps-result-item:nth-child(n+6) {
    display: none;
    /* Show only 5 products + view all button */
}