/* =========================================
   0. CONFIGURAZIONE & VARIABILI (DESIGN SYSTEM)
   ========================================= */
:root {
    --color-primary: #EC3228;
    --color-primary-dark: #b81e15;
    --color-primary-light: rgba(236, 50, 40, 0.08);

    --color-text-main: #111827;
    --color-text-body: #4b5563;
    --color-text-light: #9ca3af;
    --color-bg-light: #f9fafb;
    --color-white: #ffffff;
    --color-border: #e5e7eb;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --shadow-hover: 0 20px 25px rgba(0,0,0,0.1);

    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-pill: 9999px;

    --transition-fast: 0.2s cubic-bezier(0.4,0,0.2,1);
    --transition-smooth: 0.3s cubic-bezier(0.25,0.8,0.25,1);

    --col-aperto: #10b981;
    --col-inarrivo: #1f2937;
    --col-chiuso: #ec3228;
}

.bandi-archive-wrapper,
.bando-single-wrapper {
    max-width: 1400px;
    margin: 60px auto;
    padding: 0 32px;
    font-family: Inter, system-ui, sans-serif;
    color: var(--color-text-body);
}
.bandi-archive-header {
    text-align: center;
}

/* =========================================
   SEARCH BAR — FINALE
   ========================================= */
.search-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    margin-bottom: 25px;
}

.search-bar-container {
    position: relative;
    max-width: 650px;
    width: 100%;
    height: 62px;

    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);

    display: flex;
    align-items: center;
    overflow: hidden;

    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.search-bar-container:has(input:focus) {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(236,50,40,0.18);
}

.search-bar-container input {
    flex: 1;
    height: 100%!important;
    border: none!important;
    background: transparent!important;
    outline: none !important;
    box-shadow: none !important;
    padding-left: 22px;
    padding-right: 60px;
    font-size: 17px;
    color: var(--color-text-main);
}

#bando-search-btn {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);

    width: 32px;
    height: 32px;

    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;
    padding: 0;
}

#bando-search-btn svg {
    width: 22px;
    height: 22px;
    stroke: var(--color-primary);
}

/* Hover */
#bando-search-btn:hover {
    transform: translateY(-50%) scale(1.3);
}
/* =========================================
   TOPBAR — PILL CUSTOM (come FILTRI)
   ========================================= */
/* ======================================================
   1. PILL BUTTON — STILE UNICO PER TUTTI I BOTTONI TOPBAR
   ====================================================== */

.pill-btn,
.filter-toggle-btn.topbar-btn {
    height: 46px !important;
    padding: 0 22px !important;
    border-radius: 40px !important;

    background: #fff !important;
    border: 2px solid #00000010 !important;

    display: flex !important;
    align-items: center !important;
    gap: 8px !important;

    font-size: 13px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    color: #111 !important;

    cursor: pointer;
    transition: 0.2s ease !important;
    white-space: nowrap;
}

/* Hover identico per tutti */
.pill-btn:hover,
.filter-toggle-btn.topbar-btn:hover {
    background: #EC3228 !important;
    color: #fff !important;
    border-color: #EC3228 !important;
}

/* Stato attivo per FILTRI */
.filter-toggle-btn.topbar-btn.active {
    background: #EC3228 !important;
    border-color: #EC3228 !important;
    color: #fff !important;
}

.filter-toggle-btn.topbar-btn .chevron {
    font-size: 11px;
}

/* Icona dentro filtri */
.filter-toggle-btn.topbar-btn .icon svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
}

/* =============================================
   2. CONTENITORE FILTRI — RIDUZIONE SPAZIO
   ============================================= */
.search-filters-inline {
    width: 100%;
    max-width: 900px;
    margin-top: 10px;

    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filters-left {
    display: flex;
    gap: 14px;
    align-items: center;
}

/* Elimina la barra bianca gigante attorno al bottone filtri */
.filter-toggle-btn {
    box-shadow: none !important;
    background: #fff !important;
}
/* =========================================================================
   FIX DROPDOWN INLINE PER I PILL (STATO INCENTIVI / ORDINA PER)
   ========================================================================= */

.inline-dropdown {
    position: relative;
}

/* CORREGGE allineamento pannello */
.inline-dropdown .panel {
    position: absolute;
    top: calc(100% + 6px);      /* distanza perfetta sotto il pill */
    left: 0;

    width: 180px;               /* larghezza ideale (modifica se serve) */
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);

    padding: 10px 0;
    display: none;
    z-index: 50;                /* sopra tutto */
}

/* Mostra quando attivo */
.inline-dropdown.active .panel {
    display: block;
    animation: dropdownFade .18s ease-out;
}

@keyframes dropdownFade {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Elementi interni del pannello */
.inline-dropdown .panel div {
    padding: 10px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
    color: #333;
}

.inline-dropdown .panel div:hover {
    background: #EC322810;
    color: #EC3228;
}

/* =========================================
   2. ARCHIVIO & CARD (GRIGLIA)
   ========================================= */

.bandi-archive-header {
    margin-bottom: 48px;
}

.bandi-archive-title {
    font-size: 42px;
    font-weight: 800;
    margin: 0 0 12px;
    color: var(--color-text-main);
    letter-spacing: -0.02em;
}

.bandi-archive-subtitle {
    margin: 0;
    font-size: 18px;
    color: var(--color-text-body);
    font-weight: 400;
    max-width: 600px;
    line-height: 1.6;
}

/* Griglia Intelligente */
.bandi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); /* Card leggermente più larghe */
    gap: 32px;
    position: relative;
    z-index: 1;
}

/* --- Card Bando Modernizzata --- */

.bando-card {
    background: var(--color-white);
    border-radius: var(--radius-md);
    padding: 28px;
    text-decoration: none;
    color: inherit;
    border: 1px solid rgba(0,0,0,0.04);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: hidden;
}
/* BADGE STATO — stile base */
.bando-status {
    display: inline-block;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #ffffff !important;
    background: #111827; /* fallback */
}

/* APERTO → VERDE */
.bando-status.status-aperto {
    background: #10b981 !important;
}

/* IN ARRIVO → BLU SCURO */
.bando-status.status-in_arrivo {
    background: #1f2937 !important; /* come prima */
}

/* CHIUSO → ROSSO */
.bando-status.status-chiuso {
    background: #EC3228 !important;
}

/* Linea superiore colorata */
.bando-card.status-aperto:hover::before {
    background: var(--col-aperto);
    opacity: 1;
}

.bando-card.status-in_arrivo:hover::before {
    background: var(--col-inarrivo);
    opacity: 1;
}

.bando-card.status-chiuso:hover::before {
    background: var(--col-chiuso);
    opacity: 1;
}

/* Titolo colorato */
.bando-card.status-aperto:hover .bando-title {
    color: var(--col-aperto);
}
.bando-card.status-in_arrivo:hover .bando-title {
    color: var(--col-inarrivo);
}
.bando-card.status-chiuso:hover .bando-title {
    color: var(--col-chiuso);
}

/* Hover Effect: Lift & Glow */
.bando-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(236, 50, 40, 0.15);
}

/* Linea decorativa superiore (opzionale, aggiunge carattere) */
.bando-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--color-primary);
    opacity: 0;
    transition: var(--transition-fast);
}

.bando-card:hover::before {
    opacity: 1;
}

.bando-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.bando-id {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-light);
    background: var(--color-bg-light);
    padding: 4px 8px;
    border-radius: 6px;
}

.bando-title {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 12px;
    color: var(--color-text-main);
    transition: color 0.2s ease;
}

.bando-card:hover .bando-title {
    color: var(--color-primary);
}

.bando-meta {
    font-size: 14px;
    color: var(--color-text-body);
    margin-bottom: 24px;
    line-height: 1.5;
    opacity: 0.8;
}

/* Tag Container */
.bando-tags {
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.tag {
    background: var(--color-bg-light);
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    color: var(--color-text-body);
    font-weight: 600;
    border: 1px solid var(--color-border);
}


/* =========================================
   3. PAGINAZIONE & BOTTONI
   ========================================= */

.bandi-load-more-wrap {
    text-align: center;
    margin: 60px 0;
}

.bando-btn, 
.bando-btn.load-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 180px;
    padding: 14px 32px;
    background: var(--color-primary);
    color: var(--color-white);
    border-radius: var(--radius-pill);
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: 0 4px 15px rgba(236, 50, 40, 0.3);
}

.bando-btn:hover,
.bando-btn.load-more:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(236, 50, 40, 0.4);
}

/* =========================================
   4. FILTRI A TENDINA (DROPDOWN FLOTTANTI)
   ========================================= */

/* --- Contenitore Principale che si apre/chiude --- */
/* Manteniamo il drawer per racchiudere tutto, ma l'animazione interna cambia */
.filters-drawer-wrapper {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.3s ease;
    margin-bottom: 20px;
    overflow: hidden;
}
.filters-drawer-wrapper.is-open {
    grid-template-rows: 1fr;
    /* Lasciamo overflow visibile affinché i dropdown possano uscire fuori! */
    overflow: visible; 
}
.filters-drawer {
    overflow: visible; /* Fondamentale: permette ai menu di andare sopra agli altri elementi */
    min-height: 0;
}

.filters-drawer-inner {
    background: var(--color-white);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    padding: 25px;
    margin-top: 10px;
}

/* --- Griglia dei Pulsanti Filtro --- */
.filters-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px; /* Spazio tra i pulsanti: "ognuno a sé" */
    align-items: flex-start;
}

/* --- Il singolo blocco Filtro (Pulsante + Menu) --- */
.filter-dropdown-item {
    position: relative; /* Punto di ancoraggio per il menu assoluto */
}

/* Il Pulsante (Chip) */
.dropdown-btn {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 160px;
    padding: 10px 16px;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: 8px; /* O var(--radius-pill) se li vuoi tondi */
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-body);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.dropdown-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* Stato Attivo (Quando il menu è aperto) */
.filter-dropdown-item.active .dropdown-btn {
    background: var(--color-bg-light);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.dropdown-btn .arrow {
    font-size: 10px;
    transition: transform 0.2s;
}

.filter-dropdown-item.active .dropdown-btn .arrow {
    transform: rotate(180deg);
}

/* --- IL MENU A TENDINA (Galleggiante) --- */
.dropdown-content {
    display: none; /* Nascosto di default */
    position: absolute;
    top: calc(100% + 8px); /* 8px sotto il bottone */
    left: 0;
    width: 280px; /* Larghezza fissa per il menu */
    max-height: 300px;
    overflow-y: auto;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15); /* Ombra forte per staccarlo dallo sfondo */
    z-index: 100; /* Z-Index alto per stare SOPRA a tutto */
    padding: 15px;
    
    /* Scrollbar sottile */
    scrollbar-width: thin;
    scrollbar-color: #ddd transparent;
}

/* Quando il genitore ha classe .active, mostra il menu */
.filter-dropdown-item.active .dropdown-content {
    display: block;
    animation: popIn 0.2s cubic-bezier(0.165, 0.84, 0.44, 1);
}

@keyframes popIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Checkbox dentro il dropdown */
.fy-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.1s;
}
.fy-checkbox:hover {
    background: var(--color-bg-light);
}

/* Footer (Reset / Applica) */
.filters-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--color-bg-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Responsive: su mobile torniamo a colonna per usabilità */
@media (max-width: 768px) {
    .filters-grid { flex-direction: column; gap: 10px; }
    .filter-dropdown-item, .dropdown-btn { width: 100%; }
    .dropdown-content { width: 100%; position: static; box-shadow: none; border-top: none; display: none; }
    .filter-dropdown-item.active .dropdown-content { position: static; display: block; }
}
/* =========================================
   STILE BOTTONE "FILTRI"
   ========================================= */

.filter-toggle-btn {
    /* Layout & Dimensioni */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;           /* Spazio tra icona e testo */
    height: 54px;        /* Stessa altezza della barra di ricerca (regola se necessario) */
    padding: 0 32px;     /* Spazio laterale comodo */
    
    /* Aspetto Grafico */
    background-color: var(--color-white);
    border: 1px solid var(--color-border); /* Bordo grigio chiaro di base */
    border-radius: 9999px; /* Pillola (arrotondato totale) */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); /* Ombra leggera */
    
    /* Tipografia */
    color: var(--color-text-main);
    font-size: 16px;
    font-weight: 700;    /* Testo bello grassetto */
    font-family: inherit;
    white-space: nowrap; /* Evita che il testo vada a capo */
    
    /* Interazione */
    cursor: pointer;
    user-select: none;   /* Evita la selezione del testo cliccando */
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* --- STATO HOVER (Mouse sopra) --- */
.filter-toggle-btn:hover {
    border-color: var(--color-primary); /* Diventa rosso */
    color: var(--color-primary);        /* Testo rosso */
    background-color: #fff5f5;          /* Sfondo rosso chiarissimo (opzionale) */
    transform: translateY(-2px);        /* Si alza leggermente */
    box-shadow: 0 6px 12px rgba(236, 50, 40, 0.15); /* Ombra colorata */
}

/* --- STATO ACTIVE (Quando il cassetto è aperto) --- */
/* Questa classe '.active' viene aggiunta dal Javascript */
.filter-toggle-btn.active {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: #ffffff; /* Testo bianco */
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1); /* Effetto premuto */
}

/* --- ICONE DENTRO IL BOTTONE --- */
/* Icona Ingranaggio/Filtro */
.filter-toggle-btn .icon {
    font-size: 18px;
    display: flex; /* Centra l'icona */
}

/* Freccetta (Chevron) */
.filter-toggle-btn .chevron {
    font-size: 12px;
    margin-left: 4px;
    transition: transform 0.3s ease; /* Animazione rotazione */
}

/* Ruota la freccia quando attivo */
.filter-toggle-btn.active .chevron {
    transform: rotate(180deg);
}

/* --- MOBILE --- */
@media (max-width: 600px) {
    .filter-toggle-btn {
        width: 100%; /* Su mobile occupa tutta la larghezza */
        height: 50px;
        font-size: 15px;
    }
}

/* =========================================
   5. PAGINA SINGOLO BANDO
   ========================================= */

.bando-single-header {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 60px;
    align-items: start;
    margin-bottom: 40px;
}

.bando-single-title {
    font-size: 48px;
    line-height: 1.1;
    font-weight: 800;
    margin: 16px 0 24px;
    color: var(--color-text-main);
    letter-spacing: -0.03em;
}

.bando-single-id {
    display: inline-block;
    font-size: 14px;
    font-weight: 700;
    color: var(--color-primary);
    background: var(--color-primary-light);
    padding: 6px 12px;
    border-radius: 8px;
    margin-bottom: 10px;
}

/* Sidebox (Colonna Laterale Sticky) */
.bando-sidebox {
    background: var(--color-white);
    padding: 30px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-border);
    position: sticky;
    width: 360px;
    top: 40px; /* Rimane fissa mentre scrolli */
}
.bando-sidebox a.bando-btn {
    display: flex;
    justify-content: center;
    align-items: center;

    width: 100%;
    text-align: center;

    margin-top: 18px; /* spazio dal blocco sopra */
}
.bando-sidebox-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    padding: 16px 0;
    border-bottom: 1px solid var(--color-bg-light);
}

.bando-sidebox-row:first-child { padding-top: 0; }
.bando-sidebox-row:last-child { border-bottom: none; padding-bottom: 0; }

.bando-sidebox-row .label { font-weight: 500; color: var(--color-text-light); }
.bando-sidebox-row .value { font-weight: 700; color: var(--color-text-main); text-align: right; }

/* Contenuto Testo */
.bando-single-content {
    font-size: 18px;
    line-height: 1.8;
    color: var(--color-text-body);
}

.bando-single-content h2 {
    font-size: 28px;
    font-weight: 800;
    color: var(--color-text-main);
    margin: 50px 0 20px;
}

/* =========================================
   6. SCHEDA TECNICA COLLASSABILE
   ========================================= */

.bando-details-wrap { margin-top: 50px; }

.bando-details-toggle {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    border-radius: var(--radius-pill);
    border: 2px solid var(--color-bg-light);
    background: var(--color-white);
    color: var(--color-text-main);
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.bando-details-toggle:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.bando-details-toggle.is-open {
    background: var(--color-primary-light);
    border-color: transparent;
    color: var(--color-primary);
}

.bando-details-toggle .toggle-icon {
    font-size: 18px;
    transition: transform 0.3s ease;
}

.bando-details-toggle.is-open .toggle-icon {
    transform: rotate(45deg);
}

.bando-details {
    margin-top: 20px;
    background: var(--color-bg-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    height: 0;
    transition: height 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.bando-details-inner { padding: 30px; }

.bando-details-row {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 20px;
    padding: 14px 0;
    border-bottom: 1px dashed rgba(0,0,0,0.1);
    font-size: 15px;
}

.bando-details-row .label { font-weight: 600; color: var(--color-text-body); }
.bando-details-row .value { color: var(--color-text-main); }

/* =========================================
   7. RESPONSIVE
   ========================================= */

@media (max-width: 960px) {
    .bando-single-header {
        grid-template-columns: 1fr; /* Stack verticale su tablet */
        gap: 30px;
    }
    .bando-sidebox {
        position: static;
        width: 100%;
        box-sizing: border-box;
        order: -1; /* Mette i dettagli chiave sopra il titolo */
        margin-bottom: 20px;
    }
    .bando-details-row { grid-template-columns: 1fr; gap: 5px; }
}

@media (max-width: 600px) {
    .bandi-grid { grid-template-columns: 1fr; }
    .search-wrap { flex-direction: column; align-items: stretch; }
    .bandi-archive-title { font-size: 32px; }
    .bando-single-title { font-size: 34px; }
    .filter-modal { width: 95%; padding: 24px; }
}

@media (max-width: 960px) {

    /* HEADER */
    .bando-single-header {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .bando-sidebox {
        position: static;
        width: 100%;
        box-sizing: border-box;
        order: -1;
        margin-bottom: 20px;
    }

    .bando-details-row { 
        grid-template-columns: 1fr; 
        gap: 5px; 
    }

    /* SEARCH + FILTRI */
    .search-wrap {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }

    .search-bar-container {
        max-width: 100%;
        width: 100%;
        height: 56px;
    }

    #bando-search-btn {
        right: 18px;
    }
}

@media (max-width: 600px) {

    /* GRIGLIA: una card per riga */
    .bandi-grid { 
        grid-template-columns: 1fr;
        gap: 22px;
    }

    /* SEARCH WRAP */
    .search-wrap {
        flex-direction: column;
        width: 100%;
        gap: 14px;
    }

    /* SEARCH BAR */
    .search-bar-container {
        width: 100%;
        max-width: 100%;
        height: 54px;
        border-radius: 9999px;
        padding-right: 0;
    }

    .search-bar-container input {
        font-size: 15px;
        padding-left: 18px;
        padding-right: 48px;
    }

    #bando-search-btn {
        width: 26px;
        height: 26px;
        right: 16px;
    }

    #bando-search-btn svg {
        width: 20px;
        height: 20px;
    }

    /* BOTTONE FILTRI */
    .filter-toggle-btn {
        width: 100%;
        justify-content: center;
        height: 50px;
        font-size: 15px;
        padding: 0 24px;
    }

    /* DROPDOWN FILTRI (mobile mode) */
    .filters-grid { 
        flex-direction: column; 
        gap: 10px; 
    }

    .filter-dropdown-item,
    .dropdown-btn {
        width: 100%;
    }

    .dropdown-content {
        position: static;
        width: 100%;
        border-radius: 10px;
        box-shadow: none;
        border-top: none;
        display: none;
        max-height: 250px;
    }

    .filter-dropdown-item.active .dropdown-content {
        display: block;
    }

    /* CARD */
    .bando-card {
        padding: 22px;
    }

    .bando-title {
        font-size: 20px;
    }

    .bando-meta {
        font-size: 14px;
    }

    /* SINGLE PAGE */
    .bandi-archive-title { font-size: 32px; }
    .bando-single-title { font-size: 34px; }
}

@media (max-width: 400px) {

    .search-bar-container {
        height: 50px;
    }

    .search-bar-container input {
        font-size: 14px;
        padding-left: 14px;
    }

    #bando-search-btn {
        right: 14px;
    }

    .filter-toggle-btn {
        height: 46px;
        font-size: 14px;
    }

    .bando-title {
        font-size: 18px;
    }
}

/* =========================================================================
   MOBILE FIX — OTTIMIZZAZIONE COMPLETA (≤ 600px)
   ========================================================================= */
@media (max-width: 600px) {

    /* ------------------------------
       LAYOUT GENERALE
    ------------------------------ */
    .bandi-archive-wrapper {
        padding: 0 18px;
        margin-top: 40px;
        width: 100%;
        box-sizing: border-box;
    }

    .bandi-archive-title {
        font-size: 28px !important;
        text-align: center;
        line-height: 1.2;
        margin-bottom: 10px;
    }

    .bandi-archive-subtitle {
        font-size: 15px !important;
        text-align: center;
        line-height: 1.5;
        max-width: 100%;
        margin: 0 auto 18px;
    }

    /* ------------------------------
       SEARCH WRAP
    ------------------------------ */
    .search-wrap {
        width: 100%;
        flex-direction: column;
        gap: 12px;
        margin-bottom: 14px;
    }

    .search-bar-container {
        height: 52px !important;
        width: 100% !important;
        border-radius: 9999px;
    }

    .search-bar-container input {
        font-size: 15px !important;
        padding-left: 16px !important;
        padding-right: 48px !important;
    }

    #bando-search-btn {
        right: 14px !important;
        width: 26px !important;
        height: 26px !important;
    }

    #bando-search-btn svg {
        width: 18px !important;
        height: 18px !important;
    }

    /* ------------------------------
       TOPBAR: FILTRI + ORDINA PER
       (mettiamo in colonna)
    ------------------------------ */
    .search-filters-inline {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
        width: 100%;
    }

    .filters-left {
        width: 100%;
        justify-content: space-between;
        display: flex;
    }

    .inline-dropdown {
        width: 48%;
    }

    .pill-btn,
    .filter-toggle-btn.topbar-btn {
        width: 100% !important;
        justify-content: center;
        font-size: 14px !important;
        height: 46px !important;
    }

    /* ------------------------------
       DRAWER FILTRI
    ------------------------------ */
    .filters-drawer-wrapper {
    width:100%;
    overflow: hidden;
}
.filters-drawer-wrapper.is-open {
  
    /* Lasciamo overflow visibile affinché i dropdown possano uscire fuori! */
    overflow: visible; 
}
    .filters-grid {
        flex-direction: column !important;
        gap: 10px !important;
    }

    .filter-dropdown-item,
    .dropdown-btn {
        width: 100%;
    }

    .dropdown-content {
        position: static !important;
        width: 100% !important;
        box-shadow: none !important;
        border: 1px solid var(--color-border);
        max-height: 260px;
    }

    .filter-dropdown-item.active .dropdown-content {
        display: block !important;
    }

    /* Footer filtri */
    .filters-footer {
        flex-direction: column;
        gap: 12px;
        padding-top: 16px;
    }

    /* ------------------------------
       GRID & CARD
    ------------------------------ */
    .bandi-grid {
        grid-template-columns: 1fr !important;
        gap: 22px !important;
    }

    .bando-card {
        padding: 22px !important;
    }

    .bando-title {
        font-size: 18px !important;
        line-height: 1.3 !important;
    }

    .bando-meta {
        font-size: 14px !important;
    }

    /* Badge */
    .bando-status {
        padding: 5px 10px !important;
        font-size: 10px !important;
    }

    /* ------------------------------
       SINGLE PAGE OTTIMIZZAZIONI
    ------------------------------ */
    .bando-single-header {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
    }

    .bando-sidebox {
        width: 100% !important;
        margin-bottom: 20px !important;
        padding: 22px !important;
    }

    .bando-single-title {
        font-size: 30px !important;
        margin-top: 10px !important;
    }

    .bando-details-row {
        grid-template-columns: 1fr !important;
    }
}

.no-results {
    width: 100%;
    min-height: 320px;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    text-align: center;
    padding: 40px 20px;

    color: #222;
}

.no-results-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
}

.no-results-sub {
    font-size: 16px;
    color: #666;
    max-width: 420px;
    margin-bottom: 28px;
}

.no-results-btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 30px;
    background: #cc2121;
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    transition: background .2s ease;
}

.no-results-btn:hover {
    background: #b01b1b;
}

.no-results {
    grid-column: 1 / -1;        /* OCCUPA TUTTA LA RIGA DELLA GRIGLIA */
    text-align: center;
    padding: 60px 20px;

    display: flex;
    flex-direction: column;
    align-items: center;        /* centro orizzontale */
    justify-content: center;     /* centro interno verticale */
}

























