/* Collapsible Filters - Fiacore 2025 */
/* Compact, professional filter bar that collapses to save space */

/* ===== FILTER BAR CONTAINER ===== */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(59, 130, 246, 0.1);
    align-items: center;
    transition: all 0.3s ease;
}

[data-theme="dark"] .filter-bar {
    background: var(--bg-card);
    border-color: var(--border-primary);
}

/* ===== FILTER TOGGLE BUTTON ===== */
.filter-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 10px;
    color: #3b82f6;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.filter-toggle-btn:hover {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    transform: translateY(-1px);
}

.filter-toggle-btn:focus {
    outline: none;
    box-shadow: none;
}

.filter-toggle-btn:focus-visible {
    outline: none;
    box-shadow: none;
}

.filter-toggle-btn:active {
    outline: none;
    box-shadow: none;
}

.filter-toggle-btn i {
    transition: transform 0.3s ease;
}

.filter-toggle-btn.expanded i {
    transform: rotate(180deg);
}

[data-theme="dark"] .filter-toggle-btn {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0.1) 100%);
    border-color: rgba(59, 130, 246, 0.3);
    color: #60A5FA;
}

[data-theme="dark"] .filter-toggle-btn:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.25) 0%, rgba(59, 130, 246, 0.15) 100%);
}

/* ===== ACTIVE FILTERS DISPLAY ===== */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.filter-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 20px;
    font-size: 0.85rem;
    color: #3b82f6;
    font-weight: 500;
    transition: all 0.2s ease;
}

.filter-chip i {
    font-size: 0.7rem;
}

.filter-chip .chip-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: rgba(59, 130, 246, 0.15);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-chip .chip-remove:hover {
    background: #3b82f6;
    color: white;
}

[data-theme="dark"] .filter-chip {
    background: rgba(96, 165, 250, 0.15);
    border-color: rgba(96, 165, 250, 0.3);
    color: #93C5FD;
}

/* ===== COLLAPSIBLE FILTER CONTENT ===== */
.filter-content {
    width: 100%;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.3s ease,
                padding 0.3s ease,
                margin 0.3s ease;
    padding-top: 0;
    margin-top: 0;
}

.filter-content.expanded {
    max-height: 500px;
    opacity: 1;
    padding-top: 16px;
    margin-top: 12px;
    border-top: 1px solid rgba(59, 130, 246, 0.1);
}

[data-theme="dark"] .filter-content.expanded {
    border-top-color: var(--border-primary);
}

/* ===== FILTER GRID ===== */
.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    align-items: end;
}

/* ===== FILTER ITEM ===== */
.filter-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-item label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748B;
}

[data-theme="dark"] .filter-item label {
    color: var(--text-muted);
}

.filter-item input,
.filter-item select {
    padding: 10px 14px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: 0.9rem;
    background: #F9FAFB;
    color: #1F2937;
    transition: all 0.2s ease;
}

.filter-item input:focus,
.filter-item select:focus {
    border-color: #3b82f6;
    background: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

[data-theme="dark"] .filter-item input,
[data-theme="dark"] .filter-item select {
    background: var(--bg-tertiary);
    border-color: var(--border-primary);
    color: var(--text-primary);
}

[data-theme="dark"] .filter-item input:focus,
[data-theme="dark"] .filter-item select:focus {
    background: var(--bg-secondary);
    border-color: var(--color-primary);
}


/* ===== FILTER ACTIONS ===== */
.filter-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
}

.filter-actions .btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
}

/* ===== COLLAPSIBLE YEAR SELECTOR (Sidebar) ===== */
.year-selector-content.expanded {
    max-height: 400px;
    opacity: 1;
    padding-top: 12px;
    margin-top: 10px;
}


.year-grid-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.year-btn {
    padding: 6px 12px;
    background: #F3F4F6;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #6B7280;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    box-shadow: none;
}

.year-btn:hover {
    background: #E5E7EB;
    color: #374151;
    transform: translateY(-1px);
}

.year-btn:focus {
    outline: none;
    box-shadow: none;
}

.year-btn:focus-visible {
    outline: none;
    box-shadow: none;
}

[data-theme="dark"] .year-btn {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

[data-theme="dark"] .year-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ===== CATEGORY VIEW TOGGLE - COMPACT ===== */
.category-toggle-compact {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 8px;
}

.category-toggle-compact label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #475569;
    margin: 0;
}

[data-theme="dark"] .category-toggle-compact {
    background: rgba(96, 165, 250, 0.1);
    border-color: rgba(96, 165, 250, 0.2);
}

[data-theme="dark"] .category-toggle-compact label {
    color: var(--text-secondary);
}

/* ===== MINI TOGGLE SWITCH ===== */
.mini-switch {
    position: relative;
    width: 44px;
    height: 24px;
}

.mini-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.mini-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #CBD5E1;
    transition: 0.3s;
    border-radius: 24px;
}

.mini-switch-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mini-switch input:checked + .mini-switch-slider {
    background-color: #3b82f6;
}

.mini-switch input:checked + .mini-switch-slider:before {
    transform: translateX(20px);
}

[data-theme="dark"] .mini-switch-slider {
    background-color: #4B5563;
}

[data-theme="dark"] .mini-switch-slider:before {
    background-color: #E5E7EB;
}

[data-theme="dark"] .mini-switch input:checked + .mini-switch-slider {
    background-color: #3b82f6;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-toggle-btn {
        width: 100%;
        justify-content: center;
    }
    
    .active-filters {
        justify-content: center;
    }
    
    .filter-grid {
        grid-template-columns: 1fr;
    }
    
}

/* ===== ANIMATION FOR FILTER REVEAL ===== */
@keyframes filterSlideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.filter-content.expanded .filter-grid {
    animation: filterSlideDown 0.3s ease-out;
}

/* ===== FILTER LEFT SIDEBAR ===== */
.filter-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.filter-sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.filter-sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 300px;
    height: 100vh;
    background: white;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
    z-index: 1051;
    overflow-y: auto;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
}

.filter-sidebar.active {
    left: 0;
}

[data-theme="dark"] .filter-sidebar {
    background: var(--bg-primary);
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.4);
}

.filter-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(229, 231, 235, 0.8);
    background: white;
}

[data-theme="dark"] .filter-sidebar-header {
    background: var(--bg-primary);
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.filter-sidebar-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: #3b82f6;
}

[data-theme="dark"] .filter-sidebar-header h3 {
    color: #60A5FA;
}

.filter-sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #6B7280;
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    outline: none;
    box-shadow: none;
}

.filter-sidebar-close:hover {
    background: #f3f4f6;
    color: #374151;
}

.filter-sidebar-close:focus {
    outline: none;
    box-shadow: none;
}

[data-theme="dark"] .filter-sidebar-close {
    color: var(--text-muted);
}

[data-theme="dark"] .filter-sidebar-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.filter-sidebar-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.filter-sidebar-content form {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.filter-sidebar-section {
    border-bottom: 1px solid rgba(229, 231, 235, 0.8);
    padding-bottom: 16px;
}

[data-theme="dark"] .filter-sidebar-section {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

.filter-sidebar-section-header {
    padding: 16px 24px 8px;
}

.filter-sidebar-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748B;
}

[data-theme="dark"] .filter-sidebar-section-title {
    color: var(--text-muted);
}

.filter-sidebar-fields {
    padding: 8px 24px 16px;
}

.filter-sidebar-field {
    margin-bottom: 12px;
}

.filter-sidebar-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: #64748B;
    margin-bottom: 4px;
}

[data-theme="dark"] .filter-sidebar-field label {
    color: var(--text-muted);
}

.filter-sidebar-field input[type="date"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.9rem;
    background: #f9fafb;
    color: #1f2937;
    transition: all 0.2s ease;
}

.filter-sidebar-field input[type="date"]:focus {
    border-color: #3b82f6;
    background: white;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

[data-theme="dark"] .filter-sidebar-field input[type="date"] {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .filter-sidebar-field input[type="date"]:focus {
    background: var(--bg-secondary);
    border-color: #3b82f6;
}

/* Quick Access Items in Sidebar */
.filter-sidebar-quick-access {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 12px 0;
}

.filter-quick-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: #64748B;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    border-radius: 8px;
    outline: none;
    box-shadow: none;
}

.filter-quick-item:hover {
    background: #f1f5f9;
    color: #374151;
}

.filter-quick-item:focus {
    outline: none;
    box-shadow: none;
}

.filter-quick-item i {
    width: 16px;
    font-size: 0.85rem;
    color: #94A3B8;
}

.filter-quick-item:hover i {
    color: #64748B;
}

[data-theme="dark"] .filter-quick-item {
    color: var(--text-secondary);
}

[data-theme="dark"] .filter-quick-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

[data-theme="dark"] .filter-quick-item i {
    color: var(--text-muted);
}

/* View Toggle Styling */
.filter-view-toggle {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 8px 0;
}

.filter-view-label {
    font-size: 0.9rem;
    color: #374151;
    font-weight: 500;
}

[data-theme="dark"] .filter-view-label {
    color: var(--text-primary);
}

.filter-view-options {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-view-option {
    font-size: 0.85rem;
    color: #94A3B8;
    font-weight: 500;
    transition: color 0.2s ease;
}

.filter-view-option.active {
    color: #3b82f6;
}

[data-theme="dark"] .filter-view-option {
    color: var(--text-muted);
}

[data-theme="dark"] .filter-view-option.active {
    color: #60A5FA;
}

/* Expandable Section Button */
.filter-sidebar-expand-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 0;
    border: none;
    background: transparent;
    color: #64748B;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    outline: none;
    box-shadow: none;
}

.filter-sidebar-expand-btn:hover {
    color: #3b82f6;
}

.filter-sidebar-expand-btn:focus {
    outline: none;
    box-shadow: none;
}


[data-theme="dark"] .filter-sidebar-expand-btn {
    color: var(--text-secondary);
}

[data-theme="dark"] .filter-sidebar-expand-btn:hover {
    color: #60A5FA;
}

/* Expandable Content */
.filter-sidebar-expandable {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.filter-sidebar-expandable.expanded {
    max-height: 300px;
}

.filter-sidebar-year-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
}

.filter-year-btn {
    padding: 6px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #f9fafb;
    color: #64748B;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    box-shadow: none;
}

.filter-year-btn:hover {
    background: #dbeafe;
    border-color: #3b82f6;
    color: #3b82f6;
}

.filter-year-btn:focus {
    outline: none;
    box-shadow: none;
}

[data-theme="dark"] .filter-year-btn {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

[data-theme="dark"] .filter-year-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
    color: #60A5FA;
}

.filter-sidebar-empty {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    color: #94A3B8;
    font-size: 0.85rem;
}

[data-theme="dark"] .filter-sidebar-empty {
    color: var(--text-muted);
}

/* Bottom Action Buttons */
.filter-sidebar-actions {
    display: flex;
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    background: white;
    margin-top: auto;
}

[data-theme="dark"] .filter-sidebar-actions {
    background: var(--bg-primary);
    border-top-color: rgba(255, 255, 255, 0.08);
}

/* Apply Button - Same as Filter Button */
.filter-apply-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 10px;
    color: #3b82f6;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.25s ease;
    outline: none;
    box-shadow: none;
}

.filter-apply-btn:hover {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    transform: translateY(-1px);
}

.filter-apply-btn:focus {
    outline: none;
    box-shadow: none;
}

[data-theme="dark"] .filter-apply-btn {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0.1) 100%);
    border-color: rgba(59, 130, 246, 0.3);
    color: #60A5FA;
}

[data-theme="dark"] .filter-apply-btn:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.25) 0%, rgba(59, 130, 246, 0.15) 100%);
}
