/* =================================
   sections/calendar.css (v11 - Mobile UX Overhaul)
================================= */

#calendar {
    position: relative;
    padding: 100px 20px;
    background-color: #eef2f7;
    /* Fallback color */
    overflow: hidden;
}

#calendar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../../assets/images/exp/winter1.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    filter: blur(8px) brightness(1.1);
    opacity: 0.6;
    z-index: 1;
}

#calendar .section-header,
#calendar .operating-calendar-container {
    position: relative;
    z-index: 2;
}


/* --- Section Header --- */
#calendar .section-header {
    text-align: center;
    margin-bottom: 3rem;
    color: #2c3e50;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#calendar .section-overline {
    display: block;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    color: #5b7282;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

#calendar .section-title {
    font-family: 'Pretendard', sans-serif;
    font-size: 2.2rem;
    font-weight: 700;
    margin: 0;
}

/* --- Main Layout --- */
.operating-calendar-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* --- PC Custom Dropdown Navigation --- */
.custom-dropdown-wrapper {
    display: block;
    position: relative;
}

.dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.25rem 0.5rem;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: #2c3e50;
    cursor: pointer;
    text-align: left;
}

.selected-month {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}

.selected-month-num {
    font-family: 'Outfit', sans-serif;
    font-size: 2.2rem;
    font-weight: 700;
    color: #007bff;
    line-height: 1;
}

.selected-month-name {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: #2c3e50;
}

.dropdown-chevron {
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    color: #868e96;
    width: 20px;
    height: 20px;
}

.custom-dropdown-wrapper.active .dropdown-chevron {
    transform: rotate(180deg);
}

.dropdown-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    margin: 0;
    padding: 0.5rem;
    list-style: none;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    z-index: 10;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.custom-dropdown-wrapper.active .dropdown-options {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.dropdown-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.dropdown-option:hover {
    background-color: rgba(0, 123, 255, 0.1);
    color: #0056b3;
}

.dropdown-option .month-num {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: #adb5bd;
}

.dropdown-option .month-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.dropdown-option:hover .month-num {
    color: #007bff;
}

/* --- Mobile Month Navigation --- */
.month-selector-mobile {
    display: none;
}

/* --- Calendar Card --- */
.calendar-display-card {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

/* --- Calendar Grid --- */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: 1fr;
    border-radius: 8px;
    overflow: hidden;
    flex-grow: 1;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

.calendar-grid.visible {
    opacity: 1;
}

.weekday,
.day {
    border-right: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
}

.weekday:last-child,
.day:nth-child(7n) {
    border-right: none;
}

.day:nth-child(n+36) {
    border-bottom: none;
}

.weekday {
    font-weight: 700;
    color: #495057;
    font-size: 1.1rem;
    text-align: center;
    padding: 0.75rem 0;
}

.weekday:first-child {
    color: #e63946;
}

.weekday:last-child {
    color: #1d3557;
}

/* --- Day Cell Styles (PC) --- */
.day {
    color: #343a40;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    min-height: 4.5rem;
}

.day.other-month {
    background-color: transparent;
}

.day.other-month .day-number {
    color: #adb5bd;
}

.day-number {
    font-size: 1rem;
    font-weight: 600;
    flex-shrink: 0;
    width: 2em;
    height: 2em;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    line-height: 1;
}

.day.sunday .day-number,
.day.holiday .day-number {
    color: #e63946;
}

.day.saturday .day-number {
    color: #1d3557;
}

.day-number.is-regular-holiday {
    background-color: #fab005;
    color: #ffffff;
}

.day-number.is-maintenance-holiday {
    background-color: #fa5252;
    color: #ffffff;
}

.day-number.is-event-day {
    background-color: #7950f2;
    color: #ffffff;
}

.day.sunday .day-number.is-regular-holiday,
.day.saturday .day-number.is-regular-holiday,
.day.holiday .day-number.is-regular-holiday {
    color: #ffffff;
}

.day-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.holiday-name,
.day-status-text,
.event-name {
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1.3;
}

.day-details .day-status-text {
    color: #868e96;
    font-weight: 700;
}

.day-details .event-name {
    color: #7950f2;
    font-weight: 700;
}


/* --- Season Display --- */
.season-tag {
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
}

.season-tag.season-winter {
    background-color: #e0f2fe;
    color: #0284c7;
    border: 1px solid #7dd3fc;
}

.season-tag.season-spring {
    background-color: #f0fdf4;
    color: #16a34a;
    border: 1px solid #86efac;
}

.season-tag.season-summer {
    background-color: #eff6ff;
    color: #2563eb;
    border: 1px solid #93c5fd;
}

.season-tag.season-autumn {
    background-color: #fffbeb;
    color: #d97706;
    border: 1px solid #fcd34d;
}

/* --- Responsive Adjustments --- */
@media (max-width: 992px) {
    #calendar {
        padding: 60px 15px;
    }

    .custom-dropdown-wrapper {
        display: block;
        /* Show custom dropdown on mobile */
    }

    .month-selector-mobile {
        display: none;
        /* Hide native select on mobile */
    }

    /* Adjust custom dropdown for mobile */
    .selected-month-name {
        display: none;
        /* Hide month name as requested */
    }

    .dropdown-option .month-name-en {
        display: none;
    }

    .selected-month {
        gap: 0.5rem;
        /* Adjust gap */
    }

    .selected-month-num {
        font-size: 2rem;
        /* Slightly smaller number */
    }

    .calendar-header {
        flex-direction: row;
        /* Keep header in a row */
        align-items: center;
        gap: 0.75rem;
    }

    .season-display-wrapper {
        margin-left: auto;
        /* Push season tag to the right */
        align-self: center;
    }

    .weekday {
        font-size: 0.7rem;
        /* Reduce weekday font size */
        padding: 0.4rem 0;
        /* Reduce padding */
    }

    /* --- Day Cell Styles (Mobile) - REDUCED SIZE --- */
    .day {
        flex-direction: column;
        min-height: auto;
        aspect-ratio: 1 / 1;
        padding: 2px;
        /* Reduce padding */
        gap: 1px;
        /* Reduce gap */
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

    .day[data-tooltip] {
        position: relative;
    }

    .day .day-number {
        width: 2em;
        /* Reduce circle size */
        height: 2em;
        /* Reduce circle size */
        font-size: 0.8rem;
        /* Reduce font size */
    }

    .day .day-details {
        margin-top: 1px;
    }

    .day-details .day-status-text {
        font-size: 0.6rem;
        /* Make status text smaller */
    }

    /* --- Mobile Legend --- */
    .calendar-legend-mobile {
        display: flex;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 1rem;
        padding-top: 1rem;
        margin-top: 1rem;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
    }

    .legend-item {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .legend-color {
        width: 12px;
        height: 12px;
        border-radius: 50%;
    }

    .legend-color.is-regular-holiday {
        background-color: #ffb300;
    }

    .legend-color.is-holiday {
        background-color: #e63946;
    }

    .legend-color.is-maintenance-holiday {
        background-color: #ff5e00;
    }

    .legend-color.is-event-day {
        background-color: #2bff00;
    }

    .legend-text {
        font-size: 0.8rem;
        color: #495057;
    }
}

@media (max-width: 768px) {
    #calendar .section-header {
        margin-bottom: 2rem;
    }

    #calendar .section-overline {
        font-size: 0.7rem;
    }

    #calendar .section-title {
        font-size: 1.6rem;
    }
}

/* --- Mobile Tooltip --- */
.calendar-tooltip {
    position: absolute;
    /* Positioned by JS */
    z-index: 5000;
    padding: 8px 12px;
    background-color: rgba(20, 20, 30, 0.9);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #fff;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    pointer-events: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    text-align: center;
    max-width: 200px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.calendar-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}
/* ===============================================================
   2개월 나란히 보기 — 접속월 + 다음달
   ---------------------------------------------------------------
   달을 하나씩 골라 보던 드롭다운을 없애고 두 달을 함께 편다.
   대신 한 칸에 쓸 수 있는 가로폭이 절반이 되므로 셀을 줄인다.
   =============================================================== */

.operating-calendar-container.is-dual {
    max-width: 1240px;
}

.calendar-dual-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    align-items: start;
}

.is-dual .calendar-display-card {
    padding: 1rem 1.05rem 1.1rem;
    border-radius: 14px;
}

.is-dual .calendar-header {
    margin-bottom: .7rem;
    padding-bottom: .7rem;
    gap: .5rem;
}

/* 달 표시 — 드롭다운 버튼이 아니라 그냥 제목이 된다 */
.calendar-month-label {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    min-width: 0;
}

.is-dual .calendar-month-label .selected-month-num {
    font-size: 1.6rem;
    line-height: 1;
}

.is-dual .calendar-month-label .selected-month-name {
    font-size: .8rem;
    color: #495057;
    white-space: nowrap;
}

/* 이번 달을 한눈에 구분한다 — 두 카드가 똑같이 생겨서 표식이 필요하다 */
.calendar-now-badge {
    flex: none;
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: -.01em;
    padding: .16rem .42rem;
    border-radius: 999px;
    background: #1d3557;
    color: #fff;
}

.is-dual .season-tag {
    font-size: .68rem;
    padding: .2rem .5rem;
}

/* --- 셀 축소 --- */
.is-dual .weekday {
    font-size: .74rem;
    padding: .35rem 0;
}

/* 가로가 좁아져 날짜와 상세를 나란히 둘 수 없다. 위아래로 쌓는다. */
.is-dual .day {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: .1rem;
    padding: .3rem .15rem;
    min-height: 2.9rem;
}

.is-dual .day-number {
    font-size: .82rem;
}

.is-dual .day-details {
    align-items: center;
    text-align: center;
    gap: 0;
}

/* 좁은 칸에서 일정 이름을 그대로 두면 줄이 밀려 칸 높이가 들쭉날쭉해진다.
   한 줄로 자르고, 전체 내용은 툴팁에서 본다. */
.is-dual .day-details>span {
    font-size: .58rem;
    line-height: 1.25;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.is-dual .calendar-legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: .5rem 1.1rem;
    margin-top: 1rem;
}

.is-dual .calendar-legend .legend-item {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .74rem;
    color: #495057;
}

/* --- 좁은 화면 : 두 달을 위아래로 --- */
@media (max-width: 992px) {
    .calendar-dual-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .is-dual .day {
        min-height: 2.6rem;
    }
}
