/* ============================================
WRAPPER PRINCIPALE
============================================ */
.dcf-wrapper {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 40px;
    align-items: start;
    margin-bottom: 50px;
}

/* ============================================
SIDEBAR
============================================ */
.dcf-sidebar-inner {
    background: #f9f9f9;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #eee;
}

.dcf-sidebar-header-mobile {
    display: none;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}
.dcf-sidebar-header-mobile h3 {
    margin: 0;
    font-size: 18px;
}
.dcf-sidebar-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 1;
}

/* ============================================
GRUPPI FILTRO
============================================ */
.dcf-filter-group {
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid #eee;
}
.dcf-filter-group:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
}
.dcf-label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #555;
}
.dcf-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.dcf-input:focus {
    outline: none;
    border-color: #000;
}

/* ============================================
CATEGORIE CON RADIO BUTTON
Il container ha altezza fissa calcolata via JS
============================================ */
.dcf-categories {
    display: flex;
    flex-direction: column;
    gap: 5px;
    overflow: hidden;
    /* L'altezza viene impostata inline via JS */
}

.dcf-category-item {
    border-radius: 4px;
    transition: background 0.2s;
    /* Nessun min-height: le label stanno attaccate */
}

.dcf-radio-label {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}
.dcf-radio-label:hover {
    background: #eef2f6;
}

.dcf-parent-radio {
    width: 18px;
    height: 18px;
    margin: 0 10px 0 0 !important;
    cursor: pointer;
    accent-color: #000;
    flex-shrink: 0;
}

.dcf-radio-text {
    font-size: 14px;
    color: #333;
    user-select: none;
    flex: 1;
}

/* ============================================
ICONA ESPANDI
Chiuso: freccia ▶   Aperto: linea orizzontale
============================================ */
.dcf-expand-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: auto;
    color: #999;
    user-select: none;
    flex-shrink: 0;
    position: relative;
}
.dcf-expand-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translate(-60%, -50%) rotate(-45deg);
    transition: all 0.25s ease;
}

/* Quando espanso: linea orizzontale semplice */
.dcf-category-item.expanded .dcf-expand-icon::before {
    width: 10px;
    height: 2px;
    background: currentColor;
    border: none;
    transform: translate(-50%, -50%);
}

/* Quando espanso: il trattino (ruotando la L diventa un meno) */
.dcf-category-item.expanded .dcf-expand-icon::before {
    transform: translate(-50%, -50%);
    width: 10px;
    height: 0;
    border-right: none;
    border-bottom: 2px solid currentColor;
}

/* ============================================
SOTTOCATEGORIE (checkbox)
Animazione tramite max-height
============================================ */
.dcf-subcategories {
    max-height: 0;
    overflow: hidden;
    padding: 0 0 0 38px;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.dcf-category-item.expanded .dcf-subcategories {
    max-height: 500px;
    padding: 5px 0 10px 38px;
}

.dcf-checkbox-label {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}
.dcf-checkbox-label:hover {
    background: #eef2f6;
}

.dcf-subcategory-checkbox {
    width: 16px;
    height: 16px;
    margin: 0 8px 0 0 !important;
    cursor: pointer;
    accent-color: #000;
    flex-shrink: 0;
}

.dcf-checkbox-text {
    font-size: 13px;
    color: #555;
    user-select: none;
}

/* ============================================
HEADER RISULTATI
============================================ */
.dcf-results-header {
    margin-bottom: 20px;
}
.dcf-count {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* ============================================
GRIGLIA CORSI
============================================ */
.dcf-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 25px;
}
.dcf-grid .dcf-card {
    height: 100%;
    min-width: 0;
}
.dcf-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    min-width: 0;
}
.dcf-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px 20px;
    background: #f9f9f9;
    border-radius: 8px;
    color: #888;
    font-size: 15px;
    margin: 0;
}

/* ============================================
ANIMAZIONE LOADING
============================================ */
#dcf-results {
    transition: opacity 0.25s ease-in;
    min-height: 200px;
}
.dcf-loading {
    opacity: 0.3;
    pointer-events: none;
}

/* ============================================
MOBILE CONTROLS
============================================ */
.dcf-mobile-controls {
    display: none;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}
.dcf-input-mobile {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    box-sizing: border-box;
}

.dcf-mobile-toggles {
    display: flex;
    gap: 8px;
    align-items: stretch;
    flex-wrap: wrap;
}

.dcf-toggle-btn {
    flex: 1;
    padding: 10px 12px;
    background: #fff;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    min-width: 0;
}
.dcf-toggle-btn:hover {
    border-color: #999;
}
.dcf-toggle-btn.active {
    background: #000;
    color: #fff;
    border-color: #000;
}

.dcf-btn-filters-mobile {
    padding: 10px 12px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    flex: 0 0 auto;
}
.dcf-icon-filter {
    display: inline-block;
    width: 14px;
    height: 14px;
    background: currentColor;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 4h18v2H3V4zm3 7h12v2H6v-2zm4 7h4v2h-4v-2z'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 4h18v2H3V4zm3 7h12v2H6v-2zm4 7h4v2h-4v-2z'/%3E%3C/svg%3E") no-repeat center;
}

/* Backdrop */
.dcf-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s;
}
.dcf-backdrop.active {
    display: block;
    opacity: 1;
}

/* ============================================
RESPONSIVE
============================================ */
@media (max-width: 1024px) {
    .dcf-wrapper {
        grid-template-columns: 240px minmax(0, 1fr);
        gap: 25px;
    }
    .dcf-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
    }
}

@media (max-width: 900px) {
    .dcf-wrapper {
        grid-template-columns: 220px minmax(0, 1fr);
        gap: 20px;
    }
    .dcf-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .dcf-wrapper {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .dcf-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 350px;
        height: 100vh;
        max-height: 100vh;
        background: #fff;
        z-index: 9999;
        transition: left 0.3s ease;
        overflow-y: auto;
    }
    .dcf-sidebar.open {
        left: 0;
    }
    .dcf-sidebar-inner {
        border-radius: 0;
        border: none;
        height: 100%;
        overflow-y: auto;
    }
    .dcf-sidebar-header-mobile {
        display: flex;
    }
    .dcf-mobile-controls {
        display: flex;
    }
    .dcf-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .dcf-mobile-toggles {
        flex-wrap: wrap;
    }
    .dcf-toggle-btn {
        flex: 1 1 calc(33.33% - 6px);
    }
    .dcf-btn-filters-mobile {
        flex: 1 1 100%;
        justify-content: center;
    }
}