/**
 * CSF AJAX Search Styles
 * Clean, modern design with white background and theme colors
 * WCAG compliant with proper contrast ratios
 * 
 * @package Custom_Site_Functions
 * @since 1.3
 */

/* Screen reader only content */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Clear search button */
.csf-clear-search {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: #666;
    transition: color 0.2s;
    z-index: 10;
}

.csf-clear-search:hover {
    color: #333;
}

/* Search results container */
.csf-search-results {
    position: absolute;
    z-index: 9999;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    max-height: 400px;
    overflow-y: auto;
    display: none;
    font-family: inherit;
}

/* Search results header */
.csf-search-header {
    padding: 12px 16px 8px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
    border-radius: 8px 8px 0 0;
}

.csf-results-count {
    font-size: 13px;
    color: #666;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Individual search result */
.csf-search-result {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    position: relative;
    border-radius: 8px;
    margin: 4px 8px;
}

.csf-search-result:hover,
.csf-search-result:focus,
.csf-search-result.csf-selected {
    background: #f8f9fa;
    border-radius: 12px;
}

.csf-search-result:last-child {
    border-bottom: none;
}

/* Product image */
.csf-product-image {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    margin-right: 12px;
    position: relative;
    border-radius: 4px;
    overflow: hidden;
    background: #f8f9fa;
}

.csf-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

/* Sale badge */
.csf-sale-badge {
    position: absolute;
    top: 0;
    left: 0;
    background: #e74c3c;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 4px;
    border-radius: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Product info */
.csf-product-info {
    flex: 1;
    min-width: 0;
}

.csf-search-results h4.csf-product-name {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 4px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.csf-product-subtitle {
    font-size: 12px;
    color: #666;
    margin: 2px 0 4px 0;
    line-height: 1.2;
    font-style: italic;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.csf-product-price {
    font-size: 14px;
    font-weight: normal;
    color: inherit;
    margin-left: auto;
    flex-shrink: 0;
    padding-left: 12px;
}

.csf-product-category {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

.csf-stock-status {
    font-size: 11px;
    color: #999;
    font-weight: 500;
    margin-top: 2px;
}

/* Loading state */
.csf-search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #666;
}

.csf-loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e0e0e0;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: csf-spin 1s linear infinite;
    margin-right: 8px;
}

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

.csf-loading-text {
    font-size: 13px;
}

/* No results state */
.csf-no-results {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #666;
    text-align: center;
}

.csf-no-results-text {
    font-size: 13px;
}

/* View all results link */
.csf-view-all {
    padding: 12px 16px;
}

.csf-search-results .csf-view-all-link {
    display: block;
    text-align: center;
    color: #007cba;
    text-decoration: none;
    font-size: 14px;
    font-weight: normal;
    padding: 12px;
    border-radius: 4px;
    transition: all 0.2s ease;
    border: 1px solid #cce5f0;
    background: transparent;
}

.csf-view-all-link:hover,
.csf-view-all-link:focus {
    background: #f5f5f5;
    border-color: #99cfe0;
}

/* Responsive design */
@media (max-width: 768px) {
    .csf-search-results {
        left: 10px !important;
        right: 10px;
        width: auto !important;
        max-width: calc(100vw - 20px);
    }
    
    .csf-product-image {
        width: 50px;
        height: 50px;
        margin-right: 10px;
    }
    
    .csf-product-name {
        font-size: 13px;
    }
    
    .csf-product-price {
        font-size: 12px;
    }
}
