/**
 * Filter Sidebar - Yemeksepeti/Lieferando Style
 * FIXED: Bootstrap-kompatibel, keine Layout-Konflikte
 * Toggle-Switches & Clean Layout
 * CSP-konform
 */

/* === Sidebar Container === */
.filter-sidebar {
    background: white;
    border-radius: 12px;
    padding: 24px;
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.filter-sidebar::-webkit-scrollbar {
    width: 6px;
}

.filter-sidebar::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 3px;
}

.filter-sidebar::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.filter-sidebar::-webkit-scrollbar-thumb:hover {
    background: #ccc;
}

/* === Header === */
.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.filter-title {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.filter-reset {
    font-size: 13px;
    color: var(--theme-primary, #E87722);
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
    text-decoration: underline;
    padding: 0;
}

.filter-reset:hover {
    color: color-mix(in srgb, var(--theme-primary, #E87722) 85%, black);
}

/* === Section === */
.filter-section {
    margin-bottom: 28px;
}

.filter-section:last-child {
    margin-bottom: 0;
}

.filter-section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    cursor: pointer;
    user-select: none;
}

.filter-section-title span {
    font-size: 16px;
    font-weight: 700;
    color: #333;
}

.filter-section-title i {
    font-size: 14px;
    color: #999;
    transition: transform 0.2s;
}

.filter-section-title.collapsed i,
.filter-section.collapsed .filter-section-title i {
    transform: rotate(-90deg);
}

.filter-section-content {
    padding-top: 16px;
    overflow: hidden;
    max-height: 1000px;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out, opacity 0.3s ease-out;
    opacity: 1;
}

/* Collapsed State - Filter-Sektion eingeklappt */
.filter-section.collapsed .filter-section-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
}

/* === Sort Options (Radio) === */
.sort-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sort-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.sort-option:hover {
    background: #f9f9f9;
}

.sort-option input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--theme-primary, #E87722);
    cursor: pointer;
    margin: 0;
    flex-shrink: 0;
}

.sort-option span {
    font-size: 15px;
    color: #666;
    font-weight: 500;
}

.sort-option:has(input:checked) {
    background: #FFF7F0;
}

.sort-option:has(input:checked) span {
    color: var(--theme-primary, #E87722);
    font-weight: 600;
}

/* === Category Filters (Checkboxes) === */
.category-filters {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.category-filter:hover {
    background: #f9f9f9;
}

.filter-checkbox {
    flex-shrink: 0;
}

.filter-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--theme-primary, #E87722);
    cursor: pointer;
    margin: 0;
}

.filter-label {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.filter-label-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.filter-label-text {
    font-size: 15px;
    color: #666;
    font-weight: 500;
}

.category-filter:has(input:checked) {
    background: #FFF7F0;
}

.category-filter:has(input:checked) .filter-label-text {
    color: var(--theme-primary, #E87722);
    font-weight: 600;
}

/* === Price Range === */
.price-range-filter {
    padding: 8px 0;
}

.price-inputs {
    display: flex;
    align-items: center;
    gap: 12px;
}

.price-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    font-weight: 500;
}

.price-input:focus {
    border-color: var(--theme-primary, #E87722);
}

.price-input::placeholder {
    color: #aaa;
}

.price-separator {
    color: #999;
    font-weight: 600;
}

/* === Toggle Switches (Yemeksepeti Style) === */
.toggle-filters {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.toggle-filter {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
    background: #f9f9f9;
}

.toggle-filter:hover {
    background: #f5f5f5;
}

.toggle-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.toggle-info i {
    font-size: 20px;
    color: #666;
    flex-shrink: 0;
}

.toggle-label {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
}

.toggle-description {
    font-size: 13px;
    color: #999;
}

/* === Toggle Switch Component === */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-switch::before {
    content: '';
    position: absolute;
    inset: 0;
    background: #ddd;
    border-radius: 13px;
    transition: all 0.3s;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-filter:has(input:checked) .toggle-switch::before {
    background: var(--theme-primary, #E87722);
}

.toggle-filter:has(input:checked) .toggle-switch::after {
    transform: translateX(22px);
}

.toggle-filter:has(input:checked) {
    background: #FFF7F0;
}

.toggle-filter:has(input:checked) .toggle-label {
    color: var(--theme-primary, #E87722);
}

/* === Range Slider (Mindestbestellwert) === */
.range-slider-container {
    padding: 12px 0;
}

.range-slider-container input[type="range"] {
    width: 100%;
    height: 6px;
    background: linear-gradient(to right, var(--theme-primary, #E87722) 0%, var(--theme-primary, #E87722) var(--slider-value, 100%), #ddd var(--slider-value, 100%), #ddd 100%);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.range-slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    background: white;
    border: 2px solid var(--theme-primary, #E87722);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: transform 0.15s ease;
}

.range-slider-container input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.range-slider-container input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
    background: white;
    border: 2px solid var(--theme-primary, #E87722);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.range-slider-container input[type="range"]::-moz-range-track {
    height: 6px;
    background: #ddd;
    border-radius: 3px;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 13px;
    color: #666;
}

.range-labels span:last-child {
    font-weight: 600;
    color: var(--theme-primary, #E87722);
}

/* === Delivery Time Options === */
.delivery-time-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* === Apply Button === */
.apply-filters-btn {
    width: 100%;
    padding: 14px;
    margin-top: 24px;
    background: var(--theme-primary, #E87722);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.apply-filters-btn:hover {
    background: color-mix(in srgb, var(--theme-primary, #E87722) 85%, black);
}

/* === Responsive === */
@media (max-width: 1024px) {
    .filter-sidebar {
        position: static;
        max-height: none;
        margin-bottom: 24px;
    }
}

@media (max-width: 768px) {
    .filter-sidebar {
        padding: 20px;
    }

    .filter-title {
        font-size: 18px;
    }
}
