.calendar-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    font-family: inherit;
    overflow-y: auto;
}

.calendar-modal-content {
    background: white;
    margin: 5% auto;
    padding: 20px;
    width: 95%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    border-radius: 8px;
    color: #001f3f;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
}

.calendar-modal *,
.calendar-modal *::before,
.calendar-modal *::after {
    color: #001f3f !important;
    fill: #001f3f !important;
}

.close-calendar-modal {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #001f3f !important;
}

.calendar-mode {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.calendar-slot-flags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 4px 0 6px 0;
}

.calendar-slot-flag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 2px solid #001f3f;
    border-radius: 4px;
    background: #eee !important;
    padding: 6px 10px;
    font-weight: bold;
    color: #001f3f !important;
}

.calendar-slot-flag input[type="checkbox"] {
    accent-color: #001f3f;
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    background: #ffffff !important;
}

.calendar-modal .calendar-slot-flag.slot-day-active {
    background: #4caf50 !important;
    border-color: #4caf50 !important;
}

.calendar-modal .calendar-slot-flag.slot-evening-active {
    background: #5c6bc0 !important;
    border-color: #5c6bc0 !important;
}

.calendar-modal .calendar-slot-flag.slot-day-active span,
.calendar-modal .calendar-slot-flag.slot-evening-active span {
    color: #ffffff !important;
}

.calendar-modal .calendar-slot-flag.slot-day-active input[type="checkbox"],
.calendar-modal .calendar-slot-flag.slot-evening-active input[type="checkbox"] {
    accent-color: #001f3f;
    background: #ffffff !important;
}

.calendar-slot-note {
    margin-bottom: 10px;
    font-size: 12px;
    color: #415a77 !important;
}

.calendar-mode button {
    padding: 6px 10px;
    border: 2px solid #8f8f8f;
    background: #d9d9d9 !important;
    color: #001f3f !important;
    font-weight: bold;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    position: relative;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.calendar-mode button:not(.active):hover {
    background: #cfcfcf !important;
}

.calendar-mode .active {
    background: #f39c12 !important;
    border: 2px solid #f39c12 !important;
    color: #ffffff !important;
}

.calendar-mode button:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    top: 110%;
    left: 50%;
    transform: translateX(-50%);
    background: white !important;
    color: #001f3f !important;
    padding: 5px 8px;
    border-radius: 4px;
    border: 1px solid #001f3f;
    font-size: 12px;
    white-space: nowrap;
    z-index: 9999;
    opacity: 0.97;
    box-shadow: 0 2px 6px rgba(0,0,0,0.07);
}

.calendar-header {
    text-align: center;
    font-weight: bold;
    margin: 10px 0;
    font-size: 16px;
    user-select: none;
}

#calendar-prev, #calendar-next {
    cursor: pointer;
    padding: 0 10px;
    font-size: 18px;
}

table {
    border-collapse: collapse;
    margin: auto;
    width: 100%;
}

th, .calendar-cell {
    width: 14.28%;
    text-align: center;
    vertical-align: middle;
    border: 1px solid #ddd;
    padding: 6px;
    font-size: 14px;
}

th {
    font-weight: bold;
    border-bottom: 1px solid #bbb;
    color: #001f3f !important;
    background: #f5f5f5;
}

.calendar-cell {
    cursor: pointer;
    background: white;
    transition: background 0.2s, color 0.2s;
    min-height: 54px;
}

.calendar-cell-num {
    display: block;
    font-weight: 600;
}

.calendar-cell-slots {
    display: block;
    margin-top: 3px;
    font-size: 10px;
    line-height: 1.1;
    color: inherit !important;
}

.calendar-cell.selected {
    background-color: #4caf50;
    color: white !important;
}

.calendar-cell.selected-day {
    background-color: #4caf50;
}

.calendar-cell.selected-evening {
    background-color: #5c6bc0;
}

.calendar-cell.selected-both {
    background: linear-gradient(135deg, #4caf50 0%, #4caf50 50%, #5c6bc0 50%, #5c6bc0 100%);
}

.calendar-cell.past {
    background-color: #f1f1f1 !important;
    color: #bbb !important;
    cursor: not-allowed !important;
    text-decoration: line-through;
    pointer-events: none;
}

.calendar-cell.out-of-range {
    background-color: #f1f1f1 !important;
    color: #bbb !important;
    cursor: not-allowed !important;
    pointer-events: none;
    text-decoration: none;
    opacity: 0.85;
}

#save-availability:not(:disabled) {
    background-color: #68aee8 !important;
    color: white !important;
    border: none !important;
    cursor: pointer;
}

#save-availability:disabled, 
#save-availability[disabled] {
    background-color: #eee !important;
    color: #aaa !important;
    cursor: not-allowed !important;
    border: 2px solid #eee !important;
    opacity: 1 !important;
}

/* Per sicurezza, togli ogni stile .active sul bottone Salva */
#save-availability.active {
    background: none !important;
    color: inherit !important;
    border: none !important;
}

.calendar-modal-content h2 {
    cursor: move;
    user-select: none;
    text-align: center;
    margin-bottom: 10px;
    font-size: 2.4em;
}

save-availability {
        font-size: 13px;
    }

/* 📱 Mobile responsive */
@media (max-width: 480px) {
    .calendar-modal-content {
        width: 98%;
        max-width: 98%;
        font-size: 13px;
        padding: 8px;
    }

    .calendar-slot-flags {
        flex-direction: column;
        align-items: stretch;
    }

    .calendar-slot-flag {
        min-height: 44px;
        justify-content: space-between;
    }

    .calendar-slot-flag input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }

    .calendar-mode button {
        flex: 1;
        font-size: 12px;
    }

    th,
    .calendar-cell {
        padding: 4px;
        font-size: 12px;
    }

    #save-availability {
        font-size: 13px;
    }
}

    #open-calendar-modal {
        display: none !important;
    }



