/**
 * Taxonomy Filter Bar Styles
 * Файл: assets/css/taxonomy-filters.css
 */

.taxonomy-filter-bar {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 15px 20px;
    margin-bottom: 30px;
    /* No transition on desktop to prevent transitionend from firing */
    transition: none;
}

.filter-bar-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    align-items: flex-start;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 0 0 auto;
    min-width: 140px;
}

.filter-group.filter-actions {
    flex: 0 0 auto;
    margin-left: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group.filter-actions .filter-label {
    visibility: hidden;
    margin: 0;
    padding: 0;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.2;
    height: calc(0.85rem * 1.2);
    min-height: calc(0.85rem * 1.2);
    overflow: hidden;
    flex-shrink: 0;
}

.filter-group.filter-actions .filter-clear-btn {
    margin-top: 0;
}

.filter-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #666;
    margin: 0;
    white-space: nowrap;
    order: -1;
    line-height: 1.2;
    height: calc(0.85rem * 1.2);
    min-height: calc(0.85rem * 1.2);
}

.filter-select {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    background: #fff;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 36px;
    min-height: 36px;
    width: 100%;
    box-sizing: border-box;
}

.filter-select:hover {
    border-color: var(--pr-primary-accent, #e91e63);
}

.filter-select:focus {
    outline: none;
    border-color: var(--pr-primary-accent, #e91e63);
    box-shadow: 0 0 0 2px rgba(233, 30, 99, 0.1);
}

/* Dropdown Styles */
.filter-dropdown {
    position: relative;
}

.filter-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 36px;
    min-height: 36px;
    width: 100%;
    box-sizing: border-box;
}

.filter-dropdown-toggle:hover {
    border-color: var(--pr-primary-accent, #e91e63);
}

.filter-dropdown-toggle.active {
    border-color: var(--pr-primary-accent, #e91e63);
    box-shadow: 0 0 0 2px rgba(233, 30, 99, 0.1);
}

.filter-dropdown-text {
    font-size: 0.9rem;
    color: #333;
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-dropdown-count {
    font-size: 0.8rem;
    color: var(--pr-primary-accent, #e91e63);
    font-weight: 600;
    margin-left: 6px;
}

.filter-dropdown-arrow {
    font-size: 0.75rem;
    color: #666;
    margin-left: 6px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.filter-dropdown-toggle.active .filter-dropdown-arrow {
    transform: rotate(180deg);
}

.filter-dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    margin-top: 5px;
    min-width: 220px;
    width: max-content;
}

.filter-dropdown-content.active {
    display: block;
}

.filter-checkbox-label {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.filter-checkbox-label:last-child {
    border-bottom: none;
}

.filter-checkbox-label:hover {
    background: #f8f8f8;
}

.filter-checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--pr-primary-accent, #e91e63);
    flex-shrink: 0;
}

.filter-checkbox-label span {
    font-size: 0.9rem;
    color: #333;
    flex: 1;
}

/* Clear Button */
.filter-clear-btn {
    padding: 8px 16px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    height: 36px;
    min-height: 36px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-clear-btn:hover {
    background: #e8e8e8;
    border-color: #bbb;
}

.filter-clear-btn:active {
    transform: translateY(1px);
}

/* Loading Overlay */
.filter-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 8px;
}

.filter-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--pr-primary-accent, #e91e63);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* No Results */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 1.1rem;
    width: 100%;
    box-sizing: border-box;
}

/* Filter bar header - hidden on desktop, visible on mobile */
.filter-bar-header {
    display: none;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .filter-bar-container {
        flex-wrap: wrap;
    }
    
    .filter-group {
        flex: 1 1 auto;
        min-width: 140px;
    }
    
    .filter-group.filter-actions {
        flex: 1 1 100%;
        margin-left: 0;
        margin-top: 8px;
    }
}

@media (max-width: 768px) {
    .taxonomy-filter-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        padding: 0;
        margin: 0;
        border-radius: 0;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
        z-index: 1000;
        background: #fff;
        max-height: 100vh;
        overflow-y: auto;
        transform: translateY(calc(100% - 60px));
        transition: transform 0.3s ease;
    }
    
    .taxonomy-filter-bar.expanded {
        transform: translateY(0);
    }
    
    /* Filter bar header - видимата част (only on mobile) */
    .filter-bar-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 15px;
        background: #fff;
        border-top: 1px solid #e0e0e0;
        cursor: pointer;
        min-height: 60px;
    }
    
    .filter-bar-header-text {
        font-size: 0.95rem;
        font-weight: 600;
        color: #333;
    }
    
    .filter-bar-header-icon {
        font-size: 1.2rem;
        color: #666;
        transition: transform 0.3s ease;
    }
    
    .taxonomy-filter-bar.expanded .filter-bar-header-icon {
        transform: rotate(180deg);
    }
    
    /* Filter bar content - скрива се по подразбиране */
    .filter-bar-content {
        display: none;
        padding: 15px;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
    }
    
    .taxonomy-filter-bar.expanded .filter-bar-content {
        display: block;
    }
    
    /* Overlay when filters are open */
    .filter-bar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .taxonomy-filter-bar.expanded ~ .filter-bar-overlay,
    .filter-bar-overlay.active {
        display: block;
        opacity: 1;
    }
    
    .filter-bar-container {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .filter-group {
        width: 100%;
        min-width: 100%;
        gap: 6px;
    }
    
    .filter-group.filter-actions {
        width: 100%;
        margin-left: 0;
        margin-top: 10px;
    }
    
    .filter-label {
        font-size: 0.85rem;
    }
    
    .filter-select,
    .filter-dropdown-toggle {
        width: 100%;
        min-width: 100%;
    }
    
    .filter-clear-btn {
        width: 100%;
    }
    
    .filter-dropdown-content {
        max-height: 250px;
        min-width: 100%;
        width: 100%;
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        margin-top: 5px;
    }
}

@media (max-width: 480px) {
    .filter-bar-header {
        padding: 10px 12px;
        min-height: 56px;
    }
    
    .filter-bar-header-text {
        font-size: 0.9rem;
    }
    
    .filter-bar-content {
        padding: 12px;
    }
    
    .filter-label {
        font-size: 0.85rem;
    }
    
    .filter-select,
    .filter-dropdown-toggle {
        padding: 8px 10px;
        font-size: 0.9rem;
    }
}

/* Prevent body scroll when filter bar is open on mobile */
@media (max-width: 768px) {
    body.filter-bar-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
}
