/**
 * CLW Buxtons Search Extender Styles
 * 
 * @package CLW_BSE
 * @author Charli Lue Wickes
 * @version 1.0.1
 */

/* Search Extension Styles */
.clw-bse-enhanced-search {
    position: relative;
}

.clw-bse-search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 999;
    max-height: 300px;
    overflow-y: auto;
}

.clw-bse-suggestion-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.clw-bse-suggestion-item:hover,
.clw-bse-suggestion-item.highlighted {
    background-color: #f8f9fa;
}

.clw-bse-suggestion-item:last-child {
    border-bottom: none;
}

.clw-bse-search-highlight {
    background-color: #fffbdd;
    font-weight: 600;
}

.clw-bse-no-results {
    padding: 16px;
    text-align: center;
    color: #999;
    font-style: italic;
}

/* Loading state */
.clw-bse-loading {
    position: relative;
}

.clw-bse-loading::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #333;
    border-radius: 50%;
    animation: clw-bse-spin 1s linear infinite;
}

@keyframes clw-bse-spin {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .clw-bse-search-suggestions {
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    }
    
    .clw-bse-suggestion-item {
        padding: 14px 12px;
        font-size: 14px;
    }
}

/* Brand logo styling */
.clw-bse-brand-logo-container {
    margin: 8px 0px;
    display: block;
}

.clw-bse-brand-logo {
    max-height: 120px;
    width: auto;
    max-width: 120px;
}

.clw-bse-brand-title {
    font-weight: bold;
    margin-bottom: 5px;
    display: block;
    font-size: 1.1em;
    color: #666;
}

/* Manual product title styling */
.clw-bse-manual-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    margin: 8px 0;
    color: #333;
}

/* Badge styling */
.clw-bse-badge-container,
.clw-bse-bpb-badges {
    position: absolute;
    top: 0;
    left: 0;
    width: 90px;
    z-index: 99;
    display: flex;
    flex-direction: column;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.3s ease;
}

.clw-bse-badge-container.show,
.clw-bse-bpb-badges.show {
    opacity: 1;
}

/* Adjust position for image wrapping element */
.dgwt-wcas-details-main-image {
    position: relative;
}

/* Badge integration with BPB */
.clw-bse-badge-container.bpb-integration {
    width: auto;
    height: auto;
}

.clw-bse-badge-container.bpb-integration .bpb-badge-container {
    position: static !important;
    z-index: inherit !important;
}

.clw-bse-badge {
    max-height: 4em;
    max-width: 5.2em;
}

/* Review styling */
.clw-bse-review-container {
    margin: 10px 0;
}

/* Product title wrapper styling */
.clw-bse-product-title-wrapper {
    display: block;
    margin-top: 5px;
}

/* Price styling in search results */
.dgwt-wcas-sp .price {
    font-size: 1em;
}

/* Model search expansion indicator */
.clw-bse-model-expansion-indicator {
    display: inline-block;
    font-size: 0.8em;
    color: #94be57;
    background: #e8f5ff;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 8px;
    vertical-align: middle;
}

/* Highlighted model matches */
.clw-bse-model-match,
.clw-bse-model-highlight,
mark.clw-bse-model-highlight {
    background-color: #fffbcc;
    border-radius: 2px;
    padding: 1px 2px;
    font-weight: 600;
    color: #333;
}

/* Enhanced highlighting for search results */
mark.clw-bse-model-highlight {
    background: linear-gradient(120deg, #fffbcc 0%, #fff3a0 100%);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Model search results container */
.clw-bse-model-search-result {
    border-left: 3px solid #94be57;
}

/* Model detection visual indicator for search input */
.clw-bse-model-detected {
    background: linear-gradient(to right, #e8f5ff 0%, #ffffff 100%) !important;
    border-color: #94be57 !important;
    box-shadow: 0 0 0 1px rgba(0, 115, 170, 0.3) !important;
}

.clw-bse-model-detected::after {
    content: "🔍 Model detected";
    position: absolute;
    bottom: -25px;
    left: 0;
    font-size: 11px;
    color: #94be57;
    background: #e8f5ff;
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0.9;
    z-index: 1000;
    animation: clw-bse-fade-in 0.3s ease;
}

@keyframes clw-bse-fade-in {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 0.9; transform: translateY(0); }
}

.clw-bse-model-search-result {
    background-color: #f9f9f9;
    padding-left: 8px;
    margin-left: -8px;
}

/* Model number display */
.clw-bse-model-number {
    font-family: monospace;
    font-size: 0.9em;
    color: #555;
    background: #f0f0f0;
    padding: 2px 4px;
    border-radius: 2px;
    margin-left: 4px;
}

/* POA Integration - Style POA products in search results */

/* POA message styling */
.poa-message {
    display: inline-block;
    color: #666;
    font-weight: 600;
    font-size: 0.95em;
    font-style: italic;
}

/* POA message in suggestion dropdown */
.dgwt-wcas-suggestion.poa-product .poa-message {
    color: #94be57;
}

/* POA message in details panel */
.dgwt-wcas-details .poa-message {
    display: block !important;
    font-size: 1.1em;
    margin: 10px 0;
}

/* Hide add to cart and prices for POA products */
.dgwt-wcas-suggestion.poa-product .add_to_cart_button,
.dgwt-wcas-suggestion.poa-product form.cart,
.dgwt-wcas-details.poa-product .add_to_cart_button,
.dgwt-wcas-details.poa-product form.cart,
.dgwt-wcas-details.poa-product .quantity,
.dgwt-wcas-details.poa-product .dgwt-wcas-product-add-to-cart,
.dgwt-wcas-suggestion.poa-product .dgwt-wcas-st-price,
.dgwt-wcas-suggestion.poa-product .woocommerce-Price-amount,
.dgwt-wcas-suggestion.poa-product .dgwt-wcas-sp-price {
    display: none !important;
}

/* Ensure POA products are clearly identifiable */
.dgwt-wcas-suggestion.poa-product {
    position: relative;
}

/* Hide specific price elements in suggestions */
.dgwt-wcas-suggestion.poa-product .dgwt-wcas-st-price,
.dgwt-wcas-suggestion.poa-product .dgwt-wcas-suggestion-price,
.dgwt-wcas-suggestion.poa-product .dgwt-wcas-sp > .price,
.dgwt-wcas-suggestion.poa-product ins,
.dgwt-wcas-suggestion.poa-product del {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

/* Optional: Add subtle indicator for POA products in dropdown */
.dgwt-wcas-suggestion.poa-product::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, #94be57, #749641);
    opacity: 0.3;
}

/* ===================================================================
   AI-Powered Filter Toggle Styles
   ================================================================== */

/* Filter wrapper */
.clw-filters-wrapper {
    position: relative;
}

/* Low relevance filters - hidden by default via JS */
.clw-filter-widget.clw-low-relevance {
    opacity: 0.95;
}

/* Toggle button wrapper */
.clw-filter-toggle-wrapper {
    margin: 15px 0;
    padding: 10px 0;
    border-top: 1px solid #e5e5e5;
    border-bottom: 1px solid #e5e5e5;
}

/* Toggle button */
.clw-filter-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.clw-filter-toggle-btn:hover {
    background: linear-gradient(135deg, #e8e9ea 0%, #f8f9fa 100%);
    border-color: #94be57;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.clw-filter-toggle-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.clw-filter-toggle-btn:focus {
    outline: none;
    border-color: #94be57;
    box-shadow: 0 0 0 3px rgba(148, 190, 87, 0.15);
}

/* Expanded state */
.clw-filter-toggle-btn.expanded {
    background: linear-gradient(135deg, #e8f5ff 0%, #f0f8ff 100%);
    border-color: #94be57;
}

/* Toggle icon */
.clw-filter-toggle-btn .toggle-icon {
    flex-shrink: 0;
    margin-left: 8px;
    transition: transform 0.3s ease;
}

.clw-filter-toggle-btn.expanded .toggle-icon {
    transform: rotate(180deg);
}

/* Toggle text */
.clw-filter-toggle-btn .toggle-text-show,
.clw-filter-toggle-btn .toggle-text-hide {
    flex-grow: 1;
    text-align: left;
}

/* Badge for filter count */
.clw-filter-toggle-btn .toggle-text-show::after,
.clw-filter-toggle-btn .toggle-text-hide::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #94be57;
    border-radius: 50%;
    margin-left: 6px;
    vertical-align: middle;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .clw-filter-toggle-wrapper {
        margin: 12px 0;
    }
    
    .clw-filter-toggle-btn {
        padding: 10px 14px;
        font-size: 13px;
    }
}

/* Animation for showing/hiding filters */
@keyframes clw-filter-slide-in {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        max-height: 1000px;
        transform: translateY(0);
    }
}

/* Relevance indicator for debugging
   To enable, add this class to body: clw-show-relevance-scores
*/
body.clw-show-relevance-scores .clw-filter-widget[data-relevance-score]::before {
    content: attr(data-relevance-score);
    position: absolute;
    top: 5px;
    right: 5px;
    background: #94be57;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: bold;
    z-index: 100;
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .clw-filter-toggle-btn {
        background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
        border-color: #444;
        color: #e0e0e0;
    }
    
    .clw-filter-toggle-btn:hover {
        background: linear-gradient(135deg, #3a3a3a 0%, #2a2a2a 100%);
        border-color: #94be57;
    }
    
    .clw-filter-toggle-btn.expanded {
        background: linear-gradient(135deg, #1a3a2a 0%, #0a2a1a 100%);
    }
    
    .clw-filter-toggle-wrapper {
        border-color: #444;
    }
}