/**
 * Advanced Features CSS
 * Styles for Live Search, Filters, Admin AJAX, etc.
 */

/* Live Search Results */
#live-search-results,
#header-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-height: 500px;
    overflow-y: auto;
    z-index: 1050;
    display: none;
}

.search-results {
    padding: 0;
}

.search-group-title {
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}

.search-result-item:hover {
    background: #f8f9fa;
    transform: translateX(5px);
}

.search-item-image {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 12px;
}

.search-item-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e9ecef;
    border-radius: 4px;
    margin-right: 12px;
    color: #6c757d;
    font-size: 1.5rem;
}

.search-item-content {
    flex: 1;
}

.search-item-title {
    font-weight: 600;
    margin-bottom: 4px;
    color: #212529;
}

.search-item-desc {
    font-size: 0.875rem;
    color: #6c757d;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-item-price {
    font-weight: 600;
    margin-top: 4px;
}

.search-result-item mark {
    background-color: #ffeb3b;
    padding: 2px 4px;
    border-radius: 2px;
    font-weight: 600;
}

.search-loading,
.search-no-results,
.search-error {
    padding: 32px;
}

/* Product Filters */
#loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

#loading-overlay i {
    font-size: 3rem;
    color: #007bff;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hover-card {
    transition: all 0.3s ease;
    border: 1px solid #e0e0e0;
}

.hover-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15) !important;
}

/* Filter Panel */
.filter-panel {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.filter-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

.filter-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.filter-section h6 {
    font-weight: 600;
    margin-bottom: 12px;
    color: #212529;
}

/* Price Range Slider */
input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e9ecef;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    transition: all 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #0056b3;
    transform: scale(1.2);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

input[type="range"]::-moz-range-thumb:hover {
    background: #0056b3;
    transform: scale(1.2);
}

/* Checkbox Styles */
.form-check-input:checked {
    background-color: #007bff;
    border-color: #007bff;
}

/* Toast Notifications (SweetAlert2) */
.swal2-toast {
    border-radius: 8px;
}

/* Admin AJAX Buttons */
.btn-ajax {
    position: relative;
    overflow: hidden;
}

.btn-ajax.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-ajax.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
}

/* Lazy Loading Placeholder */
img.lazy {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

img.loaded {
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Responsive */
@media (max-width: 768px) {
    .search-result-item {
        flex-direction: column;
        text-align: center;
    }
    
    .search-item-image,
    .search-item-icon {
        margin-right: 0;
        margin-bottom: 8px;
    }
    
    .filter-panel {
        margin-bottom: 20px;
    }
}

/* Badge Animations */
.badge {
    animation: badgePulse 0.5s ease;
}

@keyframes badgePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Button Ripple Effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-ripple:active::after {
    width: 300px;
    height: 300px;
}

