/* Paleta do calendário público, conforme a referência visual. */
#public-calendar {
    --fc-classic-button: #0069ff;
    --fc-classic-button-border: #0069ff;
    --fc-classic-button-strong: #0056b3;
    --fc-classic-button-strong-border: #0056b3;
    --fc-classic-button-outline: #00336680;
    --fc-classic-button-foreground: #fff;
    --fc-classic-primary: #0069ff;
    --fc-classic-foreground: #005c9e;
    --fc-classic-background: #fff;
    --fc-classic-border: #ddd;
    --fc-classic-faint-foreground: #9bc2ed;
}

#public-calendar .public-calendar-event {
    --fc-event-contrast-color: #005c9e;
    background-color: #fff !important;
    border-color: #0069ff !important;
    border-style: solid;
    border-width: 1px;
    color: #005c9e !important;
}

#public-calendar .public-calendar-event .fc-event-main-content,
#public-calendar .public-calendar-event .fc-event-details {
    color: #005c9e !important;
}

#public-calendar .fc-classic-AVD {
    color: #003366;
}

.public-calendar-toolbar {
    gap: .75rem;
}

.public-calendar-title {
    font-weight: 600;
    color: #003366;
    letter-spacing: -.01em;
}

.public-calendar-card .card-header {
    padding: 1rem 1.25rem .85rem;
}

.public-calendar-card .card-body {
    padding: 1rem;
}

.public-calendar-actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
}

.public-calendar-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem .6rem;
    width: 100%;
}

.public-calendar-legend-label {
    font-size: .78rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: .03em;
    white-space: nowrap;
}

.public-calendar-legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem .5rem;
}

.public-calendar-legend-row {
    width: 100%;
    margin-top: 1rem;
}

.public-calendar-no-print {
    display: block;
}

.public-calendar-legend-item {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .28rem .55rem;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 999px;
    background: #fff;
    font-size: .78rem;
    line-height: 1.2;
    color: #495057;
    box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .03);
    white-space: nowrap;
}

.public-calendar-legend-swatch {
    width: .85rem;
    height: .85rem;
    border-radius: 999px;
    flex: 0 0 auto;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}

#public-calendar .fc-daygrid-day-frame {
    min-height: 7.25rem;
}

#public-calendar .fc-daygrid-event {
    margin-inline: 3px;
    margin-block: 3px;
    border-inline-start-width: 3px;
    border-radius: 4px;
    transition: background-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

#public-calendar .fc-daygrid-event:hover {
    background-color: #f2f7ff !important;
    box-shadow: 0 2px 6px rgba(0, 51, 102, .12);
}

#public-calendar .fc-daygrid-more-link {
    display: inline-block;
    margin: 2px 5px 4px;
    padding: 2px 6px;
    border-radius: 999px;
    color: #005c9e;
    background: #eef5ff;
    font-weight: 600;
    text-decoration: none;
}

#public-calendar .fc-daygrid-more-link:hover {
    background: #dcecff;
    color: #003366;
}

#public-calendar .public-calendar-interactive-event:focus-visible,
#public-calendar .fc-daygrid-more-link:focus-visible,
#public-calendar .fc-list-event:focus-visible {
    outline: 3px solid rgba(0, 105, 255, .35);
    outline-offset: 2px;
}

@media (max-width: 767.98px) {
    .public-calendar-toolbar {
        align-items: stretch !important;
    }

    .public-calendar-legend {
        width: 100%;
    }

    .public-calendar-legend-items {
        width: 100%;
    }

    .public-calendar-legend-item {
        flex: 1 1 auto;
        justify-content: flex-start;
        padding: .24rem .45rem;
        font-size: .74rem;
    }

    .public-calendar-actions {
        justify-content: flex-start;
        width: 100%;
    }

    .public-calendar-actions .btn {
        flex: 1 1 auto;
    }

    #public-calendar .fc-daygrid-day-frame {
        min-height: 5.5rem;
    }
}

@media print {
    .public-calendar-no-print,
    .public-header,
    footer,
    .btn,
    .modal,
    .fc-toolbar,
    .fc-header-toolbar,
    #calendar-loading {
        display: none !important;
    }

    body {
        background: #fff !important;
    }

    main.container {
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .card,
    .card-body,
    .card-header {
        box-shadow: none !important;
        border-color: #ddd !important;
    }

    .card {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .public-calendar-legend-row {
        margin-top: 1rem;
    }
}

#public-calendar .fc-event-details { opacity: 0.8; }

/* Mais espaço útil para horários e títulos em eventos simultâneos. */
#public-calendar .public-calendar-week-event .fc-event-main-content {
    align-items: flex-start !important;
    padding: 4px 5px;
    gap: 3px;
    white-space: normal;
}

#public-calendar .public-calendar-week-event .fc-event-indicators {
    margin-right: 2px !important;
    margin-top: 4px;
}

#public-calendar .public-calendar-week-event .fc-event-time {
    font-size: .75rem;
    font-weight: 600;
    line-height: 1.35;
    white-space: normal;
    margin-bottom: 3px;
}

#public-calendar .public-calendar-week-event .fc-event-title {
    display: block;
    font-size: .8rem;
    line-height: 1.3;
    white-space: normal;
    overflow-wrap: anywhere;
}

#public-calendar .public-calendar-week-event .fc-event-details {
    line-height: 1.3;
    white-space: normal;
    overflow-wrap: anywhere;
}

/* O destaque segue as classes do tema FullCalendar 7 instalado. */
#public-calendar .public-calendar-today .fc-classic-TZ4,
#public-calendar .public-calendar-today-header .fc-classic-rVY {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 28px;
    border-radius: 999px;
    padding: 2px 6px;
    background-color: #0069ff;
    color: #fff;
    font-weight: 600;
}
