/* FullCalendar Apple-like skin */
:root {
    --fc-text: #1d1d1f;
    --fc-muted: rgba(29, 29, 31, 0.55);
    --fc-border: rgba(0, 0, 0, 0.08);
    --fc-bubble: rgba(62, 133, 255, 0.14);
    --fc-bubble-strong: rgba(62, 133, 255, 0.28);
    --fc-grid-bg: rgba(255, 255, 255, 0.6);
    --fc-glass: rgba(255, 255, 255, 0.75);
}

#calendar.fc {
    color: var(--fc-text);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
    --fc-today-bg-color: var(--fc-bubble);
    --fc-highlight-color: var(--fc-bubble);
    --fc-border-color: var(--fc-border);
    --fc-neutral-bg-color: var(--fc-grid-bg);
    --fc-page-bg-color: transparent;
    --fc-now-indicator-color: rgba(62, 133, 255, 0.6);
}

body.dark-mode #calendar.fc {
    --fc-text: #f5f5f7;
    --fc-muted: rgba(245, 245, 247, 0.6);
    --fc-border: rgba(255, 255, 255, 0.12);
    --fc-bubble: rgba(94, 157, 255, 0.18);
    --fc-bubble-strong: rgba(94, 157, 255, 0.3);
    --fc-grid-bg: rgba(22, 24, 28, 0.8);
    --fc-glass: rgba(22, 24, 28, 0.85);
    --fc-now-indicator-color: rgba(94, 157, 255, 0.7);
}

#calendar.fc .fc-day-today {
    background: var(--fc-bubble) !important;
}

/* Disable the today highlight in day view to avoid the full-column tint. */
#calendar.fc .fc-timeGridDay-view .fc-day-today {
    background: transparent !important;
}

#calendar.fc .fc-scrollgrid {
    border: 1px solid var(--fc-border);
    border-radius: 16px;
    background: var(--fc-grid-bg);
    overflow: hidden;
}

#calendar.fc .fc-scrollgrid-section-header > * {
    background: var(--fc-glass);
    border-color: var(--fc-border);
}

#calendar.fc .fc-col-header-cell {
    padding: 6px 0;
    font-weight: 600;
}

#calendar.fc .fc-col-header-cell-cushion {
    color: var(--fc-text);
    text-decoration: none;
    padding: 2px 6px;
    border-radius: 10px;
    display: inline-block;
}

#calendar.fc .fc-col-header-cell-cushion:hover {
    text-decoration: none;
    background: rgba(0, 0, 0, 0.04);
}

body.dark-mode #calendar.fc .fc-col-header-cell-cushion:hover {
    background: rgba(255, 255, 255, 0.08);
}

#calendar.fc .fc-timegrid-slot-label,
#calendar.fc .fc-timegrid-axis,
#calendar.fc .fc-daygrid-day-number {
    color: var(--fc-muted);
    font-size: 0.85rem;
}

/* Replace cramped "all-day" text with a compact icon + tooltip support */
#calendar.fc .fc-timegrid-axis-cushion.fc-scrollgrid-shrink-cushion {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    min-height: 20px;
    font-size: 0;
    color: transparent;
    padding: 2px 4px;
}

#calendar.fc .fc-timegrid-axis-cushion.fc-scrollgrid-shrink-cushion::before {
    content: "☼";
    font-size: 0.78rem;
    line-height: 1;
    color: var(--fc-muted);
}

body.dark-mode #calendar.fc .fc-timegrid-axis-cushion.fc-scrollgrid-shrink-cushion::before {
    color: rgba(245, 245, 247, 0.65);
}

#calendar.fc .fc-daygrid-day,
#calendar.fc .fc-timegrid-col {
    background: transparent;
}

#calendar.fc .fc-highlight {
    background: var(--fc-bubble) !important;
    border-radius: 12px;
}


#calendar.fc .fc-timegrid-now-indicator-line {
    border-color: #1d1d1f;
}

#calendar.fc .fc-timegrid-now-indicator-arrow {
    border-color: #1d1d1f;
}

#calendar.fc .fc-event {
    border: 1px solid rgba(62, 133, 255, 0.35);
    background: rgba(62, 133, 255, 0.18);
    color: var(--fc-text);
    border-radius: 10px;
    padding: 2px 6px;
}

#calendar.fc .event-assignment {
    background-image: repeating-linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.35) 0,
        rgba(255, 255, 255, 0.35) 6px,
        rgba(255, 255, 255, 0.1) 6px,
        rgba(255, 255, 255, 0.1) 12px
    );
}

#calendar.fc .event-milestone {
    background-image: repeating-linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.1) 0,
        rgba(0, 0, 0, 0.1) 6px,
        rgba(255, 255, 255, 0.15) 6px,
        rgba(255, 255, 255, 0.15) 12px
    );
}

#calendar.fc .event-project {
    background-image: repeating-linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.35) 0,
        rgba(255, 255, 255, 0.35) 6px,
        rgba(255, 255, 255, 0.1) 6px,
        rgba(255, 255, 255, 0.1) 12px
    );
}

#calendar.fc .event-personal {
    border-width: 2px;
    border-style: solid;
    border-color: rgba(255, 140, 64, 0.88);
    background: rgba(255, 179, 132, 0.22);
}

#calendar.fc .event-complete {
    opacity: 0.55;
    text-decoration: line-through;
}

#calendar.fc .event-assignment.fc-timegrid-event,
#calendar.fc .event-project.fc-timegrid-event {
    min-height: 22px;
}

#calendar.fc .event-meeting-has-note {
    position: relative;
    padding-right: 20px;
}

#calendar.fc .meeting-note-indicator {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background-image: url("/images/sticky-note.svg");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-color: transparent;
    pointer-events: none;
}

.calendar-event-info-popup {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1400;
}

.calendar-event-info-popup.is-open {
    pointer-events: auto;
}

.calendar-event-info-card {
    position: absolute;
    width: min(300px, calc(100vw - 20px));
    border-radius: 14px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.24);
    padding: 10px 12px 12px;
    display: grid;
    gap: 6px;
}

.calendar-event-info-card h3 {
    margin: 0;
    font-size: 0.95rem;
}

.calendar-event-info-actions {
    display: grid;
    grid-auto-flow: column;
    justify-content: end;
    gap: 8px;
}

.calendar-event-info-type {
    margin: 0;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: rgba(0, 0, 0, 0.58);
}

.calendar-event-info-card ul {
    margin: 0;
    padding-left: 16px;
    display: grid;
    gap: 4px;
    font-size: 0.84rem;
}

.calendar-event-info-card p {
    margin: 0;
    font-size: 0.84rem;
}

.calendar-event-info-goto {
    border: 1px solid rgba(62, 133, 255, 0.35);
    border-radius: 999px;
    background: rgba(62, 133, 255, 0.16);
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

.calendar-event-info-edit {
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.05);
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

.calendar-create-card {
    width: min(420px, calc(100vw - 20px));
    position: relative;
}

.meeting-note-card textarea {
    resize: vertical;
    min-height: 120px;
}

.calendar-create-popup {
    position: fixed;
    inset: 0;
    z-index: 1450;
    background: rgba(0, 0, 0, 0.28);
    display: none;
    place-items: center;
    padding: 10px;
}

.calendar-create-popup.is-open {
    display: grid;
}

.calendar-create-form {
    display: grid;
    gap: 8px;
}

.calendar-create-form label {
    display: grid;
    gap: 4px;
    font-size: 0.82rem;
    font-weight: 600;
}

.calendar-create-form input,
.calendar-create-form textarea {
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    padding: 7px 9px;
    font: inherit;
    background: rgba(255, 255, 255, 0.9);
    color: inherit;
}

.calendar-create-times {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.calendar-create-toggle {
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 8px;
}

.calendar-create-days {
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    padding: 8px;
    display: grid;
    gap: 8px;
    background: rgba(255, 255, 255, 0.62);
}

.calendar-create-days.is-disabled {
    opacity: 0.45;
}

.calendar-create-days.is-disabled .calendar-day-pill {
    pointer-events: none;
}

.calendar-create-days-title {
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: rgba(0, 0, 0, 0.58);
}

.calendar-create-days-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.calendar-day-pill {
    position: relative;
    display: grid;
    place-items: center;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    padding: 5px 0;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
}

.calendar-day-pill input {
    position: absolute;
    opacity: 0;
    inset: 0;
    margin: 0;
    cursor: pointer;
}

.calendar-day-pill input:checked + span {
    color: #0b3d91;
}

.calendar-day-pill:has(input:checked) {
    background: rgba(62, 133, 255, 0.18);
    border-color: rgba(62, 133, 255, 0.45);
}

.calendar-create-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 4px;
}

.calendar-create-actions #createEventCancelButton {
    grid-column: 1 / -1;
}

.calendar-create-actions #createEventSaveButton.is-wide {
    grid-column: 1 / -1;
}

.calendar-create-actions #meetingQuickNoteSaveButton.is-wide {
    grid-column: 1 / -1;
}

.calendar-create-actions #meetingQuickNoteCancelButton {
    grid-column: 1 / -1;
}

.calendar-create-primary,
.calendar-create-secondary,
.calendar-create-danger {
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    padding: 7px 10px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.calendar-create-primary {
    background: rgba(62, 133, 255, 0.18);
    border-color: rgba(62, 133, 255, 0.4);
}

.calendar-create-secondary {
    background: rgba(0, 0, 0, 0.05);
}

.calendar-create-danger {
    background: rgba(214, 65, 65, 0.14);
    border-color: rgba(214, 65, 65, 0.36);
    color: #7a1f1f;
}


body.dark-mode #calendar.fc .fc-event {
    border-color: rgba(94, 157, 255, 0.5);
    background: rgba(94, 157, 255, 0.24);
    color: #f5f5f7;
}

body.dark-mode .calendar-event-info-card {
    border-color: rgba(255, 255, 255, 0.14);
    background: rgba(24, 26, 30, 0.98);
    color: #f5f5f7;
}

body.dark-mode .calendar-event-info-type {
    color: rgba(245, 245, 247, 0.68);
}

body.dark-mode .calendar-event-info-goto {
    border-color: rgba(94, 157, 255, 0.55);
    background: rgba(94, 157, 255, 0.26);
    color: #f5f5f7;
}

body.dark-mode .calendar-event-info-edit {
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    color: #f5f5f7;
}

body.dark-mode #calendar.fc .event-personal {
    border-color: rgba(255, 169, 109, 0.92);
    background: rgba(255, 169, 109, 0.22);
}

body.dark-mode .calendar-create-form input,
body.dark-mode .calendar-create-form textarea {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.16);
    color: #f5f5f7;
}

body.dark-mode .calendar-create-popup {
    background: rgba(0, 0, 0, 0.45);
}

body.dark-mode .calendar-create-days {
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.04);
}

body.dark-mode .calendar-create-days.is-disabled {
    opacity: 0.5;
}

body.dark-mode .calendar-create-primary,
body.dark-mode .calendar-create-secondary,
body.dark-mode .calendar-create-danger {
    border-color: rgba(255, 255, 255, 0.18);
    color: #f5f5f7;
}

body.dark-mode .calendar-create-days-title {
    color: rgba(245, 245, 247, 0.7);
}

body.dark-mode .calendar-day-pill {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.16);
}

body.dark-mode .calendar-day-pill:has(input:checked) {
    background: rgba(94, 157, 255, 0.3);
    border-color: rgba(94, 157, 255, 0.62);
}

body.dark-mode .calendar-day-pill input:checked + span {
    color: #f5f5f7;
}

body.dark-mode .calendar-create-secondary {
    background: rgba(255, 255, 255, 0.08);
}

body.dark-mode .calendar-create-danger {
    background: rgba(255, 107, 107, 0.22);
    border-color: rgba(255, 107, 107, 0.44);
}

body.dark-mode #calendar.fc .fc-event-title,
body.dark-mode #calendar.fc .fc-event-time {
    color: #f5f5f7;
}

#calendar.fc .fc-event-title {
    font-weight: 600;
}

#calendar.fc .fc-daygrid-day-frame,
#calendar.fc .fc-timegrid-col-frame {
    border-radius: 12px;
}

#calendar.fc .fc-timegrid-slot,
#calendar.fc .fc-daygrid-day-frame {
    border-color: rgba(0, 0, 0, 0.04);
}

#calendar.fc .fc-timegrid-axis-frame,
#calendar.fc .fc-timegrid-col-frame,
#calendar.fc .fc-daygrid-day-frame {
    padding: 4px;
}

/* Toolbar buttons (today/prev/next) */
#calendar.fc .fc-button {
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.75);
    color: var(--fc-text);
    font-weight: 600;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

body.dark-mode #calendar.fc .fc-button {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: #f5f5f7;
}


#calendar.fc .fc-today-button {
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

#calendar.fc .fc-button:hover {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

#calendar.fc .fc-button:focus {
    box-shadow: 0 0 0 3px rgba(62, 133, 255, 0.25);
}

#calendar.fc .fc-button-primary {
    background: rgba(255, 255, 255, 0.75);
    border-color: rgba(0, 0, 0, 0.08);
}

#calendar.fc .fc-button-primary:not(:disabled).fc-button-active,
#calendar.fc .fc-button-primary:not(:disabled):active {
    background: rgba(62, 133, 255, 0.18);
    border-color: rgba(62, 133, 255, 0.35);
    color: var(--fc-text);
}

#calendar.fc .fc-button-group {
    gap: 6px;
}

#calendar.fc .fc-button-group > .fc-button {
    margin-left: 0;
}

/* Desktop zoom-out pass: show more calendar content at once */
@media (min-width: 901px) {
    #calendar.fc {
        font-size: 0.82rem;
    }

    #calendar.fc .fc-toolbar-title {
        font-size: 1rem;
    }

    #calendar.fc .fc-timegrid-slot {
        height: 1.2em;
    }

    #calendar.fc .fc-timegrid-slot-label,
    #calendar.fc .fc-timegrid-axis,
    #calendar.fc .fc-daygrid-day-number {
        font-size: 0.72rem;
    }

    #calendar.fc .fc-event {
        padding: 1px 3px;
        border-radius: 6px;
    }

    #calendar.fc .fc-event-title,
    #calendar.fc .fc-event-time {
        font-size: 0.68rem;
        line-height: 1.15;
    }
}

@media (max-width: 900px) {
    .calendar-area {
        overflow-x: auto;
        overflow-y: hidden;
        position: relative;
    }

    #calendar {
        min-width: 720px;
    }

    #calendar.fc .fc-header-toolbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        flex-wrap: nowrap;
    }

    #calendar.fc .fc-toolbar-title {
        display: block;
        font-size: 0.95rem;
        font-weight: 600;
        color: var(--fc-text);
        opacity: 0.85;
        line-height: 1.2;
        text-align: left;
        white-space: nowrap;
    }

    body:not(.day-view) #calendar.fc .fc-toolbar-title {
        font-size: 0.74rem;
    }

    body:not(.day-view) #calendar.fc .fc-header-toolbar {
        gap: 6px;
    }

    body:not(.day-view) #calendar.fc .fc-button {
        padding: 0.22em 0.36em;
        font-size: 0.75rem;
    }

    #calendar.fc .fc-toolbar-chunk {
        display: flex;
        gap: 8px;
        justify-content: flex-end;
        align-items: center;
    }

    #calendar.fc .fc-header-toolbar .fc-toolbar-chunk:first-child {
        position: sticky;
        left: 0;
        z-index: 2;
        padding-right: 6px;
    }

    #calendar.fc .fc-header-toolbar .fc-toolbar-chunk:last-child {
        position: sticky;
        right: 0;
        z-index: 2;
        padding-left: 6px;
    }

    #calendar.fc .fc-button {
        padding: 0.25em 0.45em;
        font-size: 0.85rem;
    }

    #calendar.fc .fc-toolbar-title {
        white-space: nowrap;
    }

    #calendar.fc .fc-button-group {
        gap: 6px;
    }

    #calendar.fc .fc-button-group > .fc-button {
        margin-left: 0;
    }
}


body.day-view .calendar-area {
    overflow-x: hidden;
}

body.day-view #calendar {
    min-width: 0;
    width: 100%;
}
