/**
 * CSS per sistema filtri modulare Pasta Girolomoni
 * 
 * @package PastaGirolomoni
 * @version 0.0.9.1
 */

/* Container principale */
.pasta-filters-modular {
    /*margin: 20px 0;*/
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

/* Container filtri */
.filters-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-m);
    margin-bottom: var(--space-s);
}

/* Gruppo filtro */
.filter-group {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.filter-group-title {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

/* Opzioni filtro */
.filter-options {
    display: flex;
    flex-direction: column;
    /*gap: 10px;*/
}

.filter-option {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.filter-option:hover {
    background: #f8f9fa;
    border-color: #e9ecef;
}

.filter-option input[type="checkbox"] {
    margin-right: 10px;
    transform: scale(1.2);
    accent-color: #007cba;
}

.filter-option input[type="checkbox"]:checked + .option-label {
    color: #007cba;
    font-weight: 600;
}

.option-label {
    flex: 1;
    font-size: 14px;
    color: #333;
    transition: color 0.3s ease;
}

.option-count {
    font-size: 12px;
    color: #666;
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
}

/* Select per tipo pasta */
.filter-select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    transition: border-color 0.3s ease;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

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

/* Azioni filtri */
.filter-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.btn-apply-filters,
.btn-clear-filters {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.btn-apply-filters {
    background: #007cba;
    color: white;
}

.btn-apply-filters:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 124, 186, 0.3);
}

.btn-clear-filters {
    background: #6c757d;
    color: white;
}

.btn-clear-filters:hover {
    background: #545b62;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.3);
}

/* Container risultati */
.pasta-results-modular {
    margin: 20px 0;
    padding: 20px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

/* Header risultati */
.results-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.results-header h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 24px;
}

.results-count {
    margin: 0;
    color: #666;
    font-size: 16px;
}

.results-count strong {
    color: #007cba;
    font-weight: 600;
}

/* Nessun risultato */
.no-results {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.no-results p {
    margin: 0;
    font-size: 16px;
}

/* Griglia risultati */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Link wrapper per card pasta */
.pasta-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: all 0.3s ease;
}

.pasta-card-link:hover {
    text-decoration: none;
    color: inherit;
}

/* Card pasta */
.pasta-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
}

.pasta-card-link:hover .pasta-card {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #007cba;
}

/* Immagine pasta */
.pasta-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pasta-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.pasta-card-link:hover .pasta-image img {
    transform: scale(1.05);
}

/* Contenuto card */
.pasta-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.pasta-card h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
}

.pasta-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
}

.meta-item {
    display: inline-block;
    padding: 4px 8px;
    background: #f0f0f0;
    border-radius: 4px;
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .filters-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .pasta-filters-modular,
    .pasta-results-modular {
        padding: 15px;
        margin: 15px 0;
    }
    
    .filter-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .btn-apply-filters,
    .btn-clear-filters {
        width: 100%;
        max-width: 200px;
    }
}

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Animazioni */
.pasta-card {
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .results-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
    }
    
    .pasta-image {
        height: 150px;
    }
    
    .pasta-content {
        padding: 15px;
    }
    
    .pasta-card h4 {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .results-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .pasta-image {
        height: 120px;
    }
    
    .pasta-content {
        padding: 12px;
    }
}

/* Stili per filtri attivi */
.filter-option:has(input:checked) {
    background: #e3f2fd;
    border-color: #007cba;
}

.filter-option:has(input:checked) .option-label {
    color: #007cba;
    font-weight: 600;
}

/* Stili per stato di errore */
.error {
    color: #d63384;
    font-size: 14px;
    margin-top: 5px;
}

/* Stili per successo */
.success {
    color: #198754;
    font-size: 14px;
    margin-top: 5px;
}
