/**
 * Styles for the AJAX filter functionality
 * 
 * @author Stefan Schumann
 * @since 1.0
 */

/* Filter Container */
.filter-container {
    position: relative;
    margin-bottom: 2rem;
}

/* Filter Header */
.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.filter-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.filter-reset {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-reset:hover {
    background: #f5f5f5;
    border-color: #ccc;
}


/* Filter Section */
.filter-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Category Filter */
.category-filter {
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
}

.category-filter:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.filter-name {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    font-weight: 500;
}

/* Filter Types */
.filter-range {
    margin: 1rem 0;
}

.range-slider {
    margin: 1rem 0;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    position: relative;
}

.range-values {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: #666;
}

.filter-text input,
.filter-select select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.875rem;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.filter-checkbox input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
}

/* Product Filter Form */
.filter-form {
    display: flex;
    flex-direction: column;
}

.filter-label {
    display: flex;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
    margin-top: 0.5rem;
}

.filter-checkbox {
    margin-right: 0.5rem;
}

.filter-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

button.filter-reset {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    background-color: #007bff;
    color: #fff;
}

button.filter-reset:hover {
    background-color: #545b62;
}

.filter-options {
    display: flex;
    flex-direction: column;
}

h3.filter-group-title {
    margin: 0;
}

/* Filter Groups */
.filter-group {
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.filter-group:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

/* Boolean Filter - needs extra spacing since it has no title */
.filter-group.boolean-filter {
    padding-top: 0.5rem;
    border-top: 1px solid #eeeeee;
    margin-top: 0.5rem;
}

.filter-group.boolean-filter:first-child {
    padding-top: 0;
}

.filter-group-name {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    font-weight: 500;
}

/* Range Filter Styles */
.range-filter {
    margin-bottom: 0.5rem;
}

.range-filter .filter-group-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 10px;
}

.range-values {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #666;
}

.range-slider {
    position: relative;
    width: 100%;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    margin: 1rem 0;
}

.range-slider input[type="range"] {
    position: absolute;
    width: 100%;
    height: 4px;
    background: none;
    pointer-events: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.range-slider input[type="range"]::-webkit-slider-thumb {
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    margin-top: -6px;
    pointer-events: auto;
    -webkit-appearance: none;
}

.range-slider input[type="range"]::-moz-range-thumb {
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: none;
    pointer-events: auto;
}

.range-slider input[type="range"]::-ms-thumb {
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    pointer-events: auto;
}

/* Styling für den aktiven Bereich zwischen den Schiebereglern */
.range-slider::before {
    content: '';
    position: absolute;
    height: 4px;
    background: #007bff;
    border-radius: 2px;
    pointer-events: none;
}

/* Hover-Effekte */
.range-slider input[type="range"]::-webkit-slider-thumb:hover {
    background: #0056b3;
}

.range-slider input[type="range"]::-moz-range-thumb:hover {
    background: #0056b3;
}

.range-slider input[type="range"]::-ms-thumb:hover {
    background: #0056b3;
}

/* Focus-Styles für bessere Zugänglichkeit */
.range-slider input[type="range"]:focus {
    outline: none;
}

.range-slider input[type="range"]:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.range-slider input[type="range"]:focus::-moz-range-thumb {
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.range-slider input[type="range"]:focus::-ms-thumb {
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

/* Loading State */
.filter-loading .filter-container {
    opacity: 0.5;
    pointer-events: none;
}

.filter-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Error State */
.filter-error-message {
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid #dc3545;
    border-radius: 4px;
    color: #dc3545;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

/* Active States */
.filter-option.active {
    background: #f8f9fa;
}

.filter-option.selected {
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .filter-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    .filter-reset {
        width: 100%;
    }
} 