/* ===================================
   Blue Bull Fast Product Search Widget CSS
   Colors matched with ajax-filter.css
   =================================== */

:root {
    --primary-color: #007cba;
    --hover-bg: rgb(223, 246, 255);
    --border-color: #e1e1e1;
    --text-color: #333;
    --light-text: #666;
    --bg-light: #f8f9fa;
}

.cargozen-fast-product-search-widget {
    margin-bottom: 30px;
}

.cg-fast-product-search {
    position: relative;
    font-family: inherit;
}

.cg-search-wrapper {
    position: relative;
}

.cg-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.cg-search-input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.cg-search-icon {
    position: absolute;
    left: 12px;
    color: var(--light-text);
    font-size: 14px;
    z-index: 2;
    pointer-events: none;
    transition: color 0.3s ease;
}

.cg-search-input-wrapper:focus-within .cg-search-icon {
    color: var(--primary-color);
}

.cg-search-input {
    width: 100%;
    padding: 12px 40px 12px 35px;
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
    color: var(--text-color);
    line-height: 1.4;
}

.cg-search-input::placeholder {
    color: #999999;
    opacity: 1;
}

.cg-search-clear {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: #999999;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.3s ease;
    z-index: 2;
}

.cg-search-clear:hover {
    color: #ff4757;
    background-color: #fff5f5;
}

/* Search Results - Matching ajax-filter.css style */
.cg-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 2px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 350px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.cg-search-results.cg-visible {
    opacity: 1;
    transform: translateY(0);
}

.cg-search-results::-webkit-scrollbar {
    width: 6px;
}

.cg-search-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.cg-search-results::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.cg-search-results::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.cg-search-result-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    background-color: var(--bg-light);
    margin-bottom: 2px;
    border-radius: 5px;
    margin: 2px 5px;
}

.cg-search-result-item:hover {
    background-color: var(--hover-bg);
    color: var(--text-color);
    transform: translateX(2px);
}

.cg-search-result-item.cg-selected {
    background-color: #e3f2fd !important;
    border-left: 3px solid #2196f3 !important;
}

.cg-search-result-item:last-child {
    border-bottom: none;
}

.cg-search-result-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: var(--primary-color);
    transition: width 0.3s ease;
    border-radius: 5px 0 0 5px;
}

.cg-search-result-item:hover::before {
    width: 3px;
}

.cg-search-result-image {
    width: 36px;
    height: 36px;
    margin-right: 12px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid #f0f0f0;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.cg-search-result-item:hover .cg-search-result-image {
    transform: scale(1.05);
    border-color: var(--primary-color);
}

.cg-search-result-content {
    flex: 1;
    min-width: 0;
}

.cg-search-result-title {
    font-weight: 500;
    margin: 0 0 4px 0;
    font-size: 13px;
    color: var(--light-text);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.cg-search-result-item:hover .cg-search-result-title {
    color: var(--text-color);
    font-weight: 600;
}

.cg-search-result-price {
    color: #e47911;
    font-size: 11px;
    margin: 0;
    font-weight: 600;
}

.cg-search-no-results {
    padding: 20px;
    text-align: center;
    color: var(--light-text);
    font-style: italic;
    font-size: 13px;
    background: var(--bg-light);
    border-radius: 0 0 8px 8px;
}

/* Highlight matched text - matching ajax-filter style */
.cg-search-highlight {
    background: var(--hover-bg);
    color: var(--primary-color);
    font-weight: 700;
    padding: 1px 3px;
    border-radius: 3px;
}

/* Loading state */
.cg-search-loading {
    padding: 20px;
    text-align: center;
    color: var(--light-text);
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.cg-search-loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .cg-search-input {
        padding: 10px 35px 10px 30px;
        font-size: 13px;
    }
    
    .cg-search-results {
        max-height: 280px;
    }
    
    .cg-search-result-item {
        padding: 10px 12px;
        margin: 2px 3px;
    }
    
    .cg-search-result-image {
        width: 32px;
        height: 32px;
        margin-right: 10px;
    }
    
    .cg-search-result-title {
        font-size: 12px;
    }
    
    .cg-search-result-price {
        font-size: 10px;
    }

    .cg-search-icon {
        left: 10px;
        font-size: 13px;
    }

    .cg-search-clear {
        right: 10px;
        width: 22px;
        height: 22px;
    }
}

/* Widget specific styles */
.widget.cargozen-fast-product-search-widget {
    background: transparent;
    border: none;
    box-shadow: none;
}

.widget.cargozen-fast-product-search-widget .widget-title {
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
}

/* Sidebar specific adjustments */
.sidebar .cg-fast-product-search {
    width: 100%;
}

.sidebar .cg-search-input-wrapper {
    border-color: var(--border-color);
}

.sidebar .cg-search-input {
    font-size: 13px;
}

/* Focus states */
.cg-search-input:focus {
    color: var(--text-color);
}

/* RTL Support */
[dir="rtl"] .cg-search-icon {
    left: auto;
    right: 12px;
}

[dir="rtl"] .cg-search-input {
    padding: 12px 35px 12px 40px;
}

[dir="rtl"] .cg-search-clear {
    right: auto;
    left: 12px;
}

[dir="rtl"] .cg-search-result-image {
    margin-right: 0;
    margin-left: 12px;
}

[dir="rtl"] .cg-search-result-item:hover {
    transform: translateX(-2px);
}

[dir="rtl"] .cg-search-result-item::before {
    left: auto;
    right: 0;
    border-radius: 0 5px 5px 0;
}
