/**
 * Taxonomy Filter Widget - Frontend Styles
 */

/* Main container */
.tfw-filter-widget {
    width: 100%;
}

.tfw-filter-form {
    width: 100%;
}

/* Filters wrapper layouts */
.tfw-filters-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.tfw-filters-inline {
    flex-direction: row;
}

.tfw-filters-stacked {
    flex-direction: column;
    align-items: stretch;
}

.tfw-filters-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}

/* Filter item */
.tfw-filter-item {
    display: flex;
    flex-direction: column;
}

.tfw-filters-stacked .tfw-filter-item {
    width: 100%;
}

/* Labels */
.tfw-filter-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
    color: #333;
}

/* Select dropdown */
.tfw-filter-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px 35px 10px 15px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    min-width: 180px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tfw-filter-select:hover {
    border-color: #999;
}

.tfw-filter-select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

/* Search container */
.tfw-search-container {
    flex-shrink: 0;
}

.tfw-search-separate {
    margin-bottom: 15px;
}

.tfw-search-wrapper {
    position: relative;
    display: inline-block;
    width: 250px;
}

.tfw-search-input {
    width: 100%;
    padding: 10px 40px 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
    background-color: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tfw-search-input:hover {
    border-color: #999;
}

.tfw-search-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.tfw-search-input::placeholder {
    color: #999;
}

.tfw-search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Buttons wrapper */
.tfw-buttons-wrapper {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

/* Buttons */
.tfw-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 25px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.tfw-submit-button {
    background-color: #0073aa;
    color: #fff;
}

.tfw-submit-button:hover {
    background-color: #005177;
    color: #fff;
}

.tfw-reset-button {
    background-color: #f0f0f0;
    color: #333;
}

.tfw-reset-button:hover {
    background-color: #ddd;
    color: #333;
}

/* Responsive */
@media (max-width: 768px) {
    .tfw-filters-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    
    .tfw-filters-grid {
        grid-template-columns: 1fr;
    }
    
    .tfw-filter-item {
        width: 100%;
    }
    
    .tfw-filter-select {
        width: 100%;
        min-width: 100%;
    }
    
    .tfw-search-wrapper {
        width: 100%;
    }
    
    .tfw-search-input {
        width: 100%;
    }
    
    .tfw-buttons-wrapper {
        flex-direction: column;
    }
    
    .tfw-button {
        width: 100%;
        text-align: center;
    }
}

/* Loading state */
.tfw-filter-widget.tfw-loading {
    opacity: 0.7;
    pointer-events: none;
}

.tfw-filter-widget.tfw-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 2px solid #ddd;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: tfw-spin 0.8s linear infinite;
}

@keyframes tfw-spin {
    to {
        transform: rotate(360deg);
    }
}
