/**
 * KB Search Auto Suggest - Frontend Styles
 */

/* Search Container */
.kbsas-search-container {
    position: relative;
    width: 100%;
}

/* Search Input */
.kbsas-search-input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.kbsas-search-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Dropdown Container */
.kbsas-dropdown {
    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 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    display: none;
}

.kbsas-dropdown.active {
    display: block;
}

/* Section Headings */
.kbsas-heading {
    padding: 8px 15px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* Items */
.kbsas-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
}

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

.kbsas-item:hover {
    text-decoration: none;
}

/* Product Items */
.kbsas-product {
    gap: 12px;
}

.kbsas-product-image {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 4px;
    background: #f5f5f5;
    flex-shrink: 0;
}

.kbsas-product-info {
    flex: 1;
    min-width: 0;
}

.kbsas-product-name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kbsas-product-category {
    font-size: 12px;
    color: #666;
}

.kbsas-product-price {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    white-space: nowrap;
}

/* Category Items */
.kbsas-category {
    font-size: 14px;
}

.kbsas-category-icon {
    margin-right: 10px;
    color: #666;
}

/* Search Term Highlight */
.kbsas-highlight {
    font-weight: bold;
}

/* Popular/Recent Searches */
.kbsas-suggestions {
    padding: 10px 0;
}

.kbsas-suggestions-heading {
    padding: 5px 15px;
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kbsas-suggestion {
    display: flex;
    align-items: center;
    padding: 8px 15px;
    cursor: pointer;
    font-size: 14px;
}

.kbsas-suggestion:hover {
    background-color: #f5f5f5;
}

.kbsas-suggestion-icon {
    margin-right: 10px;
    font-size: 16px;
    color: #999;
}

.kbsas-suggestion-text {
    flex: 1;
}

/* Loading State */
.kbsas-loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.kbsas-loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: kbsas-spin 0.8s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes kbsas-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* No Results */
.kbsas-no-results {
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

/* View All Results Link */
.kbsas-view-all {
    display: block;
    text-align: center;
    padding: 12px 15px;
    font-size: 14px;
    color: #007bff;
    background: #f8f9fa;
    border-top: 1px solid #ddd;
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.kbsas-view-all:hover {
    background: #e9ecef;
    text-decoration: none;
    color: #0056b3;
}

/* Stock Badge */
.kbsas-stock-badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    border-radius: 3px;
    margin-left: 5px;
}

.kbsas-in-stock {
    background-color: #d4edda;
    color: #155724;
}

.kbsas-out-of-stock {
    background-color: #f8d7da;
    color: #721c24;
}

/* Responsive */
@media (max-width: 768px) {
    .kbsas-dropdown {
        max-height: 300px;
    }

    .kbsas-product-image {
        width: 40px;
        height: 40px;
    }

    .kbsas-product-name {
        font-size: 13px;
    }
}
