:root {
    --fl-red: #D60101;
    --fl-red-light: #FFF1F1;
    --fl-black: #0A0A0A;
    --fl-white: #FFFFFF;
    --slate-50: #F8FAFC;
    --slate-100: #F1F5F9;
    --slate-200: #E2E8F0;
    --slate-400: #94A3B8;
    --slate-500: #64748B;
    --slate-700: #334155;
    --slate-800: #1E293B;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background-color: var(--slate-50);
    color: var(--fl-black);
    font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
}

a { text-decoration: none; color: inherit; }

/* Navbar */
.fl-nav {
    background: rgba(255,255,255,.95);
    border-bottom: 1px solid var(--slate-200);
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
    position: sticky;
    top: 0;
    z-index: 50;
}
.fl-nav-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.fl-nav-inner img { height: 40px; width: auto; }
.fl-nav-links {
    display: flex;
    gap: 24px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--slate-700);
}
.fl-nav-links a:hover { color: var(--fl-red); }
.fl-nav-links a.active { color: var(--fl-red); border-bottom: 2px solid var(--fl-red); }

/* Main */
main { max-width: 1280px; margin: 0 auto; padding: 48px 24px 96px; }

.fl-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-radius: 999px;
    background: var(--fl-red-light);
    color: var(--fl-red);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    border: 1px solid #FFDADA;
    margin-bottom: 24px;
}

main header h1 {
    font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif !important;
    font-size: 44px !important;
    font-weight: 900 !important;
    line-height: 1.1 !important;
    margin: 0 0 24px !important;
    color: var(--fl-black) !important;
}
h1 .fl-red { color: var(--fl-red); }

.fl-subtitle {
    font-size: 18px;
    color: var(--slate-500);
    max-width: 720px;
    line-height: 1.6;
    font-weight: 500;
    margin: 0;
}

.fl-intro {
    max-width: 720px;
    color: var(--slate-700);
    line-height: 1.7;
    margin: 20px 0 0;
}

/* Filters */
.fl-filters { margin: 48px 0; display: flex; flex-direction: column; gap: 12px; }
.fl-filter-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--slate-400);
    margin: 0 0 4px;
}
.fl-pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.fl-pill {
    padding: 10px 20px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    background: var(--fl-white);
    color: var(--slate-500);
    border: 1px solid var(--slate-200);
    box-shadow: 0 1px 2px rgba(0,0,0,.03);
    white-space: nowrap;
}
.fl-pill:hover { border-color: var(--fl-red); color: var(--fl-red); }
.fl-pill.active { background: var(--fl-red); color: var(--fl-white); border-color: var(--fl-red); box-shadow: 0 4px 12px rgba(214,1,1,.25); }
.fl-pill.active.fl-pill-dark { background: var(--slate-800); box-shadow: 0 4px 12px rgba(30,41,59,.25); }

/* Card grid */
.fl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 32px;
}
.fl-card {
    background: var(--fl-white);
    border: 1px solid var(--slate-200);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,.03);
    display: flex;
    flex-direction: column;
}
.fl-card-body { padding: 32px; display: flex; flex-direction: column; flex: 1; }
.fl-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 24px; }
.fl-category {
    padding: 4px 12px;
    background: var(--fl-red-light);
    color: var(--fl-red);
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
    border-radius: 6px;
}
.fl-date { font-size: 12px; font-weight: 700; color: var(--slate-400); white-space: nowrap; }
.fl-card h2 { font-size: 22px; font-weight: 700; margin: 0 0 16px; line-height: 1.3; }
.fl-card p.fl-desc { color: var(--slate-500); font-size: 14px; line-height: 1.6; margin: 0 0 32px; flex: 1; }
.fl-card-footer {
    padding-top: 24px;
    border-top: 1px solid var(--slate-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.fl-school { display: flex; align-items: center; gap: 10px; }
.fl-school-icon {
    width: 36px; height: 36px; border-radius: 999px;
    background: var(--slate-50); border: 1px solid var(--slate-100);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
}
.fl-school-name { font-size: 13px; font-weight: 700; color: var(--slate-700); }
.fl-school-label { font-size: 10px; text-transform: uppercase; color: var(--slate-400); font-weight: 700; display: block; }
.fl-cta {
    width: 44px; height: 44px; border-radius: 14px;
    background: var(--fl-red); color: var(--fl-white);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 700;
    box-shadow: 0 4px 12px rgba(214,1,1,.2);
}

.fl-empty {
    grid-column: 1 / -1;
    padding: 96px 24px;
    text-align: center;
    color: var(--slate-400);
}
.fl-empty h3 { font-size: 22px; font-weight: 900; text-transform: uppercase; letter-spacing: -.02em; color: var(--slate-400); }

/* Footer */
footer { background: var(--fl-black); color: var(--fl-white); padding: 48px 24px; margin-top: 64px; }
footer .fl-footer-inner { max-width: 1280px; margin: 0 auto; text-align: center; }
footer p { color: var(--slate-400); font-size: 14px; font-weight: 500; margin: 0; }

.fl-nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: var(--fl-black);
    padding: 8px;
}

@media (max-width: 768px) {
    .fl-nav-toggle { display: block; }
    .fl-nav-links {
        display: none;
        position: absolute;
        top: 80px;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        background: var(--fl-white);
        padding: 8px 24px 16px;
        border-bottom: 1px solid var(--slate-200);
        box-shadow: 0 8px 16px rgba(0,0,0,.06);
    }
    .fl-nav-links.fl-open { display: flex; }
    .fl-nav-links a { padding: 14px 0; border-bottom: 1px solid var(--slate-100); }
    .fl-nav-links a:last-child { border-bottom: none; }
    main header h1 { font-size: 32px !important; }
}

/* Layout a colonna (sidebar filtri + griglia corsi) — usato da index.php
   (filtri Città/Categoria/Scuola) e dalle pagine città bergamo.php/brescia.php
   (filtri Mese/Categoria/Scuola). */
.fl-browse { display: grid; grid-template-columns: 240px 1fr; gap: 40px; align-items: start; }
.fl-sidebar { position: sticky; top: 96px; display: flex; flex-direction: column; gap: 28px; }
.fl-filter-group button.fl-filter-label {
    all: unset; cursor: default; display: block; box-sizing: border-box; width: 100%;
}
.fl-sidebar-group { display: flex; flex-direction: column; gap: 6px; }
.fl-sidebar-link {
    display: block; padding: 8px 12px; border-radius: 10px; font-size: 14px;
    font-weight: 600; color: var(--slate-700);
}
.fl-sidebar-link:hover { background: var(--slate-50); }
.fl-sidebar-link.active { background: var(--fl-red-light); color: var(--fl-red); }
.fl-filter-summary { font-size: 16px; color: var(--slate-700); margin: 0 0 24px; }
.fl-filter-summary strong { color: var(--fl-black); }

/* Su desktop i filtri sono sempre visibili: lo stato "aperto/chiuso"
   esiste solo su mobile, dove parte chiuso di default. */
@media (max-width: 900px) {
    .fl-browse { grid-template-columns: 1fr; }
    .fl-sidebar { position: static; gap: 0; }
    .fl-filter-group {
        border-bottom: 1px solid var(--slate-200);
        padding: 16px 0;
    }
    .fl-filter-group button.fl-filter-label {
        cursor: pointer;
        display: flex; align-items: center; justify-content: space-between;
        font-size: 15px; font-weight: 700; color: var(--fl-black);
        text-transform: none; letter-spacing: normal;
        margin: 0;
    }
    .fl-filter-group button.fl-filter-label::after {
        content: "+"; font-size: 20px; font-weight: 400; color: var(--slate-400);
    }
    .fl-filter-group.fl-open button.fl-filter-label::after { content: "\2212"; }
    .fl-filter-group .fl-sidebar-group {
        display: none;
        flex-direction: row; flex-wrap: wrap; gap: 8px; margin-top: 14px;
    }
    .fl-filter-group.fl-open .fl-sidebar-group { display: flex; }
    .fl-filter-group .fl-sidebar-link { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--slate-200); }
}
