/* =============================================
   REZEPTE GURU - FILTER BAR (Dark Theme)
   Angepasst an das bestehende Design
   ============================================= */

/* === FILTER BAR CONTAINER === */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-glass, rgba(255,255,255,0.05));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.1));
    border-radius: var(--radius-lg, 16px);
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* === SORTIEREN & FILTER BUTTONS === */
.sort-dropdown {
    position: relative;
}

.sort-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-glass, rgba(255,255,255,0.08));
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.1));
    border-radius: var(--radius-full, 50px);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary, #a0a0a0);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
}

.sort-btn:hover {
    background: rgba(255,255,255,0.12);
    border-color: var(--accent-primary, #6366f1);
    color: var(--text-primary, #fff);
}

.sort-btn i {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* === DROPDOWN MENU === */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 220px;
    background: var(--bg-secondary, #1e1e2e);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.1));
    border-radius: var(--radius-lg, 16px);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    z-index: 200;
    display: none;
    overflow: hidden;
}

.dropdown-menu.active {
    display: block;
    animation: dropdownFade 0.2s ease;
}

@keyframes dropdownFade {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-section {
    padding: 12px 0;
}

.dropdown-section:not(:last-child) {
    border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.1));
}

.dropdown-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted, #666);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0 16px 10px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.9rem;
    color: var(--text-secondary, #a0a0a0);
}

.dropdown-item:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary, #fff);
}

.dropdown-item.active {
    color: var(--accent-primary, #6366f1);
    background: rgba(99, 102, 241, 0.1);
}

.dropdown-item i {
    width: 16px;
    font-size: 0.8rem;
    opacity: 0.6;
}

/* === CHECKBOX ITEMS (für Kategorien) === */
.dropdown-item-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.9rem;
    color: var(--text-secondary, #a0a0a0);
}

.dropdown-item-checkbox:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary, #fff);
}

.dropdown-item-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary, #6366f1);
    cursor: pointer;
    border-radius: 4px;
}

.dropdown-item-checkbox label {
    cursor: pointer;
    flex: 1;
}

/* === SUCHFELD === */
.search-container {
    flex: 1;
    min-width: 200px;
    max-width: 400px;
    position: relative;
}

.search-container > i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted, #666);
    font-size: 0.85rem;
}

.filter-bar .search-input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.1));
    border-radius: var(--radius-full, 50px);
    font-size: 0.875rem;
    background: var(--bg-glass, rgba(255,255,255,0.05));
    color: var(--text-primary, #fff);
    transition: all 0.2s ease;
    font-family: inherit;
}

.filter-bar .search-input::placeholder {
    color: var(--text-muted, #666);
}

.filter-bar .search-input:focus {
    outline: none;
    border-color: var(--accent-primary, #6366f1);
    background: rgba(255,255,255,0.08);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* === REZEPT COUNTER === */
.recipe-count {
    font-size: 0.875rem;
    color: var(--text-muted, #666);
    white-space: nowrap;
    padding: 0 8px;
}

.recipe-count strong {
    color: var(--text-primary, #fff);
    font-weight: 600;
}

/* === FILTER COUNT BADGE === */
.filter-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--accent-primary, #6366f1);
    color: white;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 6px;
}

/* === ACTIVE FILTERS CHIPS === */
.active-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 0 4px;
}

.active-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: var(--accent-primary, #6366f1);
    border-radius: var(--radius-full, 50px);
    font-size: 0.8rem;
    font-weight: 500;
}

.active-filter-chip .remove-filter {
    cursor: pointer;
    opacity: 0.7;
    font-size: 1rem;
    line-height: 1;
    transition: opacity 0.15s;
}

.active-filter-chip .remove-filter:hover {
    opacity: 1;
}

/* === OVERLAY === */
.dropdown-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 190;
}

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

/* Filter Bar und Dropdowns z-index Hierarchie */
.filter-bar {
    position: relative;
    z-index: 200;
}

/* Dropdown Container braucht höheren z-index */
.sort-dropdown {
    position: relative;
    z-index: 210;
}

/* Dropdown Menu über allem */
.dropdown-menu {
    z-index: 220 !important;
}

/* =============================================
   MOBILE RESPONSIVE
   ============================================= */

@media (max-width: 768px) {
    .filter-bar {
        padding: 10px 12px;
        gap: 8px;
        border-radius: var(--radius-md, 12px);
    }
    
    .sort-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    /* Text ausblenden auf Mobile, nur Icons */
    .sort-btn span:not(.filter-count-badge) {
        display: none;
    }
    
    .search-container {
        order: -1;
        flex: 1 1 100%;
        max-width: 100%;
        margin-bottom: 4px;
    }
    
    .recipe-count {
        margin-left: auto;
    }
    
    /* Dropdown von unten auf Mobile */
    .dropdown-menu {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 60vh;
        overflow-y: auto;
        border-radius: 20px 20px 0 0;
        border-bottom: none;
    }
    
    .dropdown-menu.active {
        animation: slideUp 0.3s ease;
    }
    
    @keyframes slideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
    
    .dropdown-section {
        padding: 16px 0;
    }
    
    .dropdown-title {
        padding: 0 20px 12px;
    }
    
    .dropdown-item,
    .dropdown-item-checkbox {
        padding: 14px 20px;
    }
}

/* === EXTRA SMALL (< 375px) === */
@media (max-width: 375px) {
    .filter-bar {
        padding: 8px;
        gap: 6px;
    }
    
    .sort-btn {
        padding: 8px 10px;
    }
    
    .recipe-count {
        font-size: 0.75rem;
    }
}

/* =============================================
   LIGHT THEME OVERRIDES
   ============================================= */

[data-theme="light"] .filter-bar {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .sort-btn {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
    color: #475569;
}

[data-theme="light"] .sort-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    border-color: var(--accent-primary);
    color: #1e293b;
}

[data-theme="light"] .dropdown-menu {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .dropdown-title {
    color: #94a3b8;
}

[data-theme="light"] .dropdown-item {
    color: #475569;
}

[data-theme="light"] .dropdown-item:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #1e293b;
}

[data-theme="light"] .dropdown-item.active {
    color: var(--accent-primary);
    background: rgba(217, 119, 6, 0.1);
}

[data-theme="light"] .dropdown-item-checkbox {
    color: #475569;
}

[data-theme="light"] .dropdown-item-checkbox:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #1e293b;
}

[data-theme="light"] .search-input {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.1);
    color: #1e293b;
}

[data-theme="light"] .search-input::placeholder {
    color: #94a3b8;
}

[data-theme="light"] .recipe-count {
    color: #64748b;
}

[data-theme="light"] .recipe-count strong {
    color: #1e293b;
}

[data-theme="light"] .dropdown-overlay {
    background: rgba(0, 0, 0, 0.3);
}
