body {
    font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f4f6f8;
    margin: 0;
    padding: 20px;
    color: #333;
}

.calendar-wrapper {
    max-width: 1200px;
    margin: 0 auto;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.calendar-header h2 {
    font-size: 1.6rem;
    font-weight: 600;
    color: #222;
}

.nav-btn {
    width: 40px;
    height: 40px;
    /* quadrato perfetto */
    font-size: 1.6rem;
    /* leggermente ridotto per centratura */
    font-weight: bold;
    font-family: Arial, sans-serif;
    /* font più prevedibile */
    line-height: 1;
    /* elimina spazio verticale extra */
    color: #000000;
    background-color: #c8cac9;
    border: 2px solid #011036;
    border-radius: 6px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.nav-btn:hover {
    background: #0069d9;
    color: #ffffff;
    transform: scale(1.1);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    /* solo Lun–Ven */
    gap: 10px;
}

.weekday {
    text-align: center;
    font-weight: 600;
    padding: 8px 0;
    background: #0069d9;
    color: #fff;
    border-radius: 6px;
}

.days {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.day {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.day:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

.day-header {
    font-weight: 600;
    font-size: 0.95rem;
    color: #222;
}

.day-text {
    font-size: 0.9rem;
    line-height: 1.5;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.day-text .corso {
    color: #222;
    /* più leggibile */
    font-weight: 500;
}

.day-text .prenotazioni {
    margin-top: 6px;
    font-size: 0.85rem;
    color: #0069d9;
    /* blu leggibile */
    font-weight: 600;
}

.select-btn {
    align-self: flex-start;
    padding: 6px 12px;
    border: none;
    background: #0069d9;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.select-btn:hover {
    background: #0056b3;
}

.day.disabled {
    background: #e0e0e0;
    /* grigio più scuro e leggibile */
    color: #666;
}

.day.disabled .corso {
    color: #666;
}

.day.disabled .prenotazioni {
    color: #999;
}

.day.disabled .select-btn {
    background: #ccc;
    cursor: not-allowed;
}

.day.today {
    border: 2px solid #28a745;
    background: #eafbe7;
}

.day.today .day-header {
    color: #28a745;
}

/* Modale */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: none;
}

.modal[aria-hidden="false"] {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    width: min(480px, 92vw);
    position: relative;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.close-btn {
    position: absolute;
    right: 12px;
    top: 12px;
    border: 0;
    background: transparent;
    font-size: 20px;
    cursor: pointer;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
}

input,
textarea,
select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.9rem;
}

.primary-btn {
    padding: 8px 14px;
    border: 0;
    background: #28a745;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.primary-btn:hover {
    background: #218838;
}

.feedback {
    margin-top: 10px;
    font-size: 0.85rem;
    color: #d9534f;
}

/* Nav Bar */
.site-header {
    position: sticky;
    top: 0;
    z-index: 200;
    background: #0069d9;
    color: #fff;
    border-bottom: 2px solid #0056b3;
}

.main-nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo a {
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 20px;
    margin: 0;
    padding: 0;
}

.nav-links a {
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: #ffd43b;
}

.nav-links a.active {
    border-bottom: 2px solid #ffd43b;
    padding-bottom: 2px;
}

/* Tabella settimanale in Corsi */
.weekly-courses-wrapper {
    margin: 20px auto;
    max-width: 800px;
    font-family: Arial, sans-serif;
}

/* Header */
.weekly-courses-header {
    text-align: center;
    margin-bottom: 15px;
}

.weekly-courses-header h2 {
    font-size: 1.4rem;
    margin: 0;
}

/* Griglia corsi */
.weekly-courses-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    /* lun-ven */
    gap: 10px;
}

/* Giorno */
.weekly-day {
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 10px;
    background: #f9f9f9;
}

/* Titolo giorno */
.weekly-day-header {
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 0.95rem;
    color: #333;
}

/* Lista corsi */
.weekly-day-text .corso {
    font-size: 0.85rem;
    margin: 4px 0;
    color: #555;
}

/* Pulsante finale */
.weekly-courses-footer {
    text-align: center;
    margin-top: 20px;
}

.weekly-courses-footer .primary-btn {
    padding: 8px 16px;
    font-size: 0.9rem;
    border: none;
    border-radius: 4px;
    background: #0077cc;
    color: #fff;
    cursor: pointer;
}

.weekly-courses-footer .primary-btn:hover {
    background: #005fa3;
}

/* Tabella Corsi */
.calendar-wrapper-corsi {
    max-width: 1000px;
    margin: 0 auto;
}

.weekday-corsi {
    text-align: center;
    font-weight: 600;
    padding: 8px 0;
    background: #c8cac9;
    color: #000000;
    border-radius: 6px;
}


/* Mobile */
@media (max-width: 768px) {
    .main-nav {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-links {
        flex-direction: column;
        gap: 10px;
        margin-top: 10px;
    }
}

/* Responsive */
@media (max-width: 768px) {

    .calendar-grid,
    .days {
        grid-template-columns: 1fr;
        /* su mobile una colonna */
    }
}

/* prova */

/* Intestazione mese sempre visibile */
.calendar-header {
    position: sticky;
    /* resta visibile quando scrolli */
    top: 0;
    /* agganciato in alto */
    background: #fff;
    /* sfondo bianco per coprire i giorni */
    z-index: 10;
    /* sopra al contenuto */
    padding: 8px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

/* Contenitore griglia scrollabile */
.calendar-grid {
    max-height: 70vh;
    /* altezza massima visibile */
    overflow-y: auto;
    /* scroll verticale */
    margin: 0;
    padding: 0;
}

/* Giorni compatti */
.calendar-wrapper-corsi .days {
    margin: 0;
    padding: 0;
}

/* freccia torna su */
.scroll-top {
    position: sticky;
    bottom: 10px;
    width: 100%;
    display: flex;
    justify-content: flex-end;
    /* ✅ spinge il bottone a destra */
    padding-right: 12px;
}

#scrollTopBtn {
    background: #67b0d1;
    border: 2px solid #fff;
    color: #fff;
    font-size: 1.5rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

#scrollTopBtn:hover {
    transform: scale(1.1);
}

/* Mobile verticale: iPhone, iPad, Android */
@media screen and (orientation: portrait) and (max-width: 1024px) {
    .calendar-wrapper-corsi .days {
        grid-template-columns: 1fr !important;
        gap: 6px !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .calendar-wrapper-corsi .weekday-corsi {
        display: none !important;
    }

    .calendar-wrapper-corsi .days:empty,
    .calendar-wrapper-corsi .days.days-empty {
        display: none !important;
    }

    .calendar-wrapper-corsi .days:not(:empty) {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 6px !important;
        margin: 0 !important;
        padding: 0 !important;
    }
}