/**
 * JC Breakdance Custom Filters CSS
 * Styling per sistema di filtri personalizzato
 */

.jc-breakdance-filters-container {
    margin: 20px 0;
    padding: 0;
    font-family: inherit;
}

.jc-breakdance-filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
    width: 100%;
}

.jc-breakdance-filter-column {
    flex: 1;
    min-width: 200px;
    width: 100%;
}

.jc-breakdance-filter-label {
    display: none; /* Nascondiamo le label */
}

.jc-breakdance-filter-select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.jc-breakdance-filter-select {
    width: 100%;
    padding: 12px 50px 12px 12px;
    border: 1px solid #ddd;
    border-top: 2px solid #E73C1F;
    background-color: #fff;
    font-size: 1.1rem;
    color: #000;
    appearance: none;
    cursor: pointer;
    transition: border-color 0.3s ease;
    border-radius: 0;
}

.jc-breakdance-filter-select:focus {
    outline: none;
    border-color: #E73C1F;
}

.jc-breakdance-filter-select:hover {
    border-color: #E73C1F;
}

.jc-breakdance-filter-select:hover + .jc-breakdance-filter-select-wrapper::after,
.jc-breakdance-filter-select-wrapper:hover::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23E73C1F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6,9 12,15 18,9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* Custom dropdown arrow with SVG */
.jc-breakdance-filter-select-wrapper::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    width: 14px;
    height: 14px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6,9 12,15 18,9'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    z-index: 1;
    transition: all 0.3s ease;
}

/* Reset button */
.jc-breakdance-filter-reset {
    position: absolute;
    right: 35px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 20px;
    background-color: rgba(231, 60, 31, 0.2);
    color: #E73C1F;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: normal;
    line-height: 1.15;
    z-index: 2;
    transition: all 0.3s ease;
    border: 1px solid rgba(231, 60, 31, 0.3);
    text-align: center;
}

.jc-breakdance-filter-reset:hover {
    background-color: #E73C1F;
    color: white;
    border-color: #E73C1F;
}

.jc-breakdance-filter-reset:active {
    transform: translateY(-50%) scale(0.95);
}

/* Loading state */
.jc-breakdance-filter-loading {
    opacity: 0.6;
    pointer-events: none;
}

.jc-breakdance-filter-loading .jc-breakdance-filter-select-wrapper::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a9 9 0 11-6.219-8.56'%3E%3C/path%3E%3C/svg%3E");
    animation: spin 1s linear infinite;
}

.jc-loading-filtered-posts {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.jc-loading-filtered-posts::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #dc2626;
    border-radius: 50%;
    animation: jc-spin 1s linear infinite;
}

@keyframes spin {
    from { transform: translateY(-50%) rotate(0deg); }
    to { transform: translateY(-50%) rotate(360deg); }
}

@keyframes jc-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Results container */
.jc-breakdance-filter-results {
    margin-top: 20px;
}

.jc-breakdance-filter-results-count {
    margin-bottom: 15px;
    font-size: 14px;
    color: #666;
}

.jc-breakdance-filter-results-count strong {
    color: #E73C1F;
}

/* Post loop integration */
.jc-breakdance-filter-target {
    transition: opacity 0.3s ease;
}

.jc-breakdance-filter-target.loading {
    opacity: 0.6;
}

/* No results styling */
.jc-breakdance-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

/* Error styling */
.jc-breakdance-filter-error {
    background-color: #f8d7da;
    color: #721c24;
    padding: 12px 16px;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin: 10px 0;
}

/* Responsive design */
@media (max-width: 768px) {
    .jc-breakdance-filters-row {
        flex-direction: column;
        gap: 15px;
        width: 100%;
    }
    
    .jc-breakdance-filter-column {
        width: 100%;
        max-width: 100%;
        min-width: auto;
        flex: none;
    }
    
    .jc-breakdance-filter-select {
        padding: 12px 50px 12px 12px; /* Manteniamo il padding del desktop */
        font-size: 1.1rem; /* Manteniamo il font-size del desktop */
        width: 100%;
    }
    
    .jc-breakdance-filter-select-wrapper::after {
        width: 14px; /* Manteniamo le dimensioni del chevron del desktop */
        height: 14px;
    }
    
    .jc-breakdance-filter-reset {
        right: 35px; /* Manteniamo la posizione del desktop */
        width: 24px; /* Manteniamo le dimensioni del desktop */
        height: 20px;
        font-size: 14px; /* Manteniamo il font-size del desktop */
        line-height: 1.15;
    }
}

@media (max-width: 480px) {
    .jc-breakdance-filters-container {
        margin: 15px 0;
    }
    
    .jc-breakdance-filters-row {
        width: 100%;
    }
    
    .jc-breakdance-filter-column {
        width: 100%;
    }
    
    .jc-breakdance-filter-select {
        padding: 12px 50px 12px 12px; /* Manteniamo il padding del desktop anche su mobile piccolo */
        font-size: 1.1rem; /* Manteniamo il font-size del desktop */
        width: 100%;
    }
    
    .jc-breakdance-filter-select-wrapper::after {
        width: 14px; /* Manteniamo le dimensioni del chevron del desktop */
        height: 14px;
    }
    
    .jc-breakdance-filter-reset {
        right: 35px; /* Manteniamo la posizione del desktop */
        width: 24px; /* Manteniamo le dimensioni del desktop */
        height: 20px;
        font-size: 14px; /* Manteniamo il font-size del desktop */
        line-height: 1.15;
    }
}

/* Accessibility improvements */
.jc-breakdance-filter-select:focus,
.jc-breakdance-filter-reset:focus {
    outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .jc-breakdance-filter-select {
        border-color: #000;
    }
    
    .jc-breakdance-filter-reset {
        background-color: #000;
        color: #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .jc-breakdance-filter-select,
    .jc-breakdance-filter-reset,
    .jc-breakdance-filter-target {
        transition: none;
    }
    
    .jc-breakdance-filter-loading .jc-breakdance-filter-select-wrapper::after {
        animation: none;
    }
}
