@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

:root {
    --bg: #f4f4f0;
    --white: #ffffff;
    --border: #e0ddd8;
    --text: #1a1a1a;
    --text-muted: #888;
    --today-border: #1a1a1a;
    --sun: #d93025;
    --sat: #1a73e8;
    --special-bg: #fff8e1;
    --special-border: #f9a825;
    --vacation-bg: #efefef;
    --vacation-text: #aaa;
    --past-opacity: 0.38;
    --header-bg: #1a1a1a;
    --header-text: #ffffff;

    --badge-exam: #d93025;
    --badge-assignment: #e65100;
    --badge-event: #2e7d32;
    --badge-holiday: #5c5c5c;
    --badge-milestone: #1565c0;
    --badge-special: #6a1b9a;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ─── HEADER ─────────────────────────────── */
.header {
    background: var(--header-bg);
    color: var(--header-text);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0 12px;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
}

.header-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.nav-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.28);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.today-bar {
    background: rgba(255, 255, 255, 0.08);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.75);
    padding: 5px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ─── DOW HEADER ─────────────────────────── */
.dow-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #2c2c2c;
    text-align: center;
    font-size: 11px;
    font-weight: 500;
    padding: 5px 0;
}

.dow-header span {
    padding: 2px 0;
    color: #e0e0e0;
}

.dow-header .sun {
    color: #ef5350;
}

.dow-header .sat {
    color: #64b5f6;
}

/* ─── CALENDAR GRID ──────────────────────── */
.calendar-wrap {
    padding: 8px;
}

.calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

/* ─── DAY CELL ───────────────────────────── */
.day {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    min-height: 110px;
    padding: 6px 5px;
    cursor: pointer;
    position: relative;
    transition: box-shadow 0.15s, transform 0.1s;
    overflow: hidden;
}

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

.day.empty {
    background: transparent;
    border-color: transparent;
    pointer-events: none;
    min-height: 0;
}

.day.past {
    opacity: var(--past-opacity);
}

.day.today {
    border: 2px solid var(--today-border);
    box-shadow: 0 0 0 1px var(--today-border);
}

.day.today .date-num {
    background: var(--today-border);
    color: #fff;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.day.sat .date-num {
    color: var(--sat);
}

.day.sun .date-num {
    color: var(--sun);
}

.day.special-day {
    background: var(--special-bg);
    border-color: var(--special-border);
}

.day.vacation {
    background: var(--vacation-bg);
}

.day.vacation .date-num {
    color: var(--vacation-text);
}

.day.out-of-range {
    background: #f8f8f8;
    opacity: 0.3;
    pointer-events: none;
}

/* date number */
.date-num {
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* badges */
.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin-top: 3px;
}

.badge {
    font-size: 9.5px;
    font-weight: 500;
    padding: 1px 5px;
    border-radius: 3px;
    white-space: nowrap;
    line-height: 16px;
}

.badge.exam {
    background: #fde8e8;
    color: var(--badge-exam);
}

.badge.assignment {
    background: #fff3e0;
    color: var(--badge-assignment);
}

.badge.event {
    background: #e8f5e9;
    color: var(--badge-event);
}

.badge.holiday {
    background: #f0f0f0;
    color: var(--badge-holiday);
}

.badge.milestone {
    background: #e3f2fd;
    color: var(--badge-milestone);
}

.badge.special {
    background: #f3e5f5;
    color: var(--badge-special);
}

.badge.vacation {
    background: #eeeeee;
    color: #888;
}

.badge.more {
    background: #eee;
    color: #666;
}

/* ─── LEGEND ─────────────────────────────── */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    padding: 8px 12px;
    font-size: 11px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ─── MODAL ──────────────────────────────── */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.52);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 16px;
    animation: fadeIn 0.15s ease;
}

.overlay.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal {
    background: var(--white);
    width: 100%;
    max-width: 440px;
    max-height: 82vh;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.18s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(24px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--border);
    background: #fafafa;
}

.modal-date {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.modal-date-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    padding: 0 0 0 8px;
    flex-shrink: 0;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    overflow-y: auto;
    padding: 12px 16px 20px;
    flex: 1;
}

/* modal sections */
.modal-section {
    margin-bottom: 14px;
}

.modal-section:last-child {
    margin-bottom: 0;
}

.section-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.section-label-icon {
    font-size: 14px;
}

.section-content {
    background: #f9f9f7;
    border-radius: 8px;
    padding: 10px 12px;
}

.section-empty {
    font-size: 13px;
    color: #b0b0b0;
    font-style: italic;
}

.item-row {
    font-size: 13.5px;
    line-height: 1.5;
    padding: 3px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.item-row:last-child {
    border-bottom: none;
}

.item-row.class-item {
    color: #1a1a1a;
}

.item-row.exam-item {
    color: var(--badge-exam);
    font-weight: 500;
}

.item-row.assignment-item {
    color: var(--badge-assignment);
}

.item-row.event-item {
    color: var(--badge-event);
}

.item-row.holiday-item {
    color: var(--badge-holiday);
}

.item-row.milestone-item {
    color: var(--badge-milestone);
    font-size: 12.5px;
}

/* lunch list */
.lunch-list {
    list-style: none;
}

.lunch-list li {
    font-size: 13.5px;
    line-height: 1.7;
    padding: 1px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.lunch-list li:last-child {
    border-bottom: none;
}

.lunch-list li::before {
    content: "•";
    margin-right: 6px;
    color: #bbb;
}

/* events in modal */
.events-section {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.event-chip {
    font-size: 12px;
    font-weight: 500;
    padding: 3px 9px;
    border-radius: 20px;
}

.event-chip.exam {
    background: #fde8e8;
    color: var(--badge-exam);
}

.event-chip.assignment {
    background: #fff3e0;
    color: var(--badge-assignment);
}

.event-chip.event {
    background: #e8f5e9;
    color: var(--badge-event);
}

.event-chip.holiday {
    background: #f0f0f0;
    color: var(--badge-holiday);
}

.event-chip.milestone {
    background: #e3f2fd;
    color: var(--badge-milestone);
}

.event-chip.special {
    background: #f3e5f5;
    color: var(--badge-special);
}

/* vacation modal */
.vacation-banner {
    background: #eeeeee;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    color: #888;
    font-size: 15px;
    font-weight: 500;
}

/* closed modal */
.closed-banner {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

/* ─── RESPONSIVE ─────────────────────────── */
@media (max-width: 480px) {
    .day {
        min-height: 90px;
        padding: 4px 4px;
    }

    .date-num {
        font-size: 12px;
    }

    .badge {
        font-size: 8.5px;
        padding: 1px 4px;
    }

    .header-title {
        font-size: 15px;
    }
}

@media (min-width: 768px) {
    .calendar-wrap {
        padding: 12px 16px;
    }

    .calendar {
        gap: 6px;
    }

    .day {
        min-height: 130px;
        padding: 8px 7px;
    }

    .date-num {
        font-size: 14px;
    }

    .badge {
        font-size: 10.5px;
    }
}

/* ─── 오늘 버튼 ──────────────────────────── */
#todayBtn {
    width: auto;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.25);
}

#todayBtn:hover {
    background: rgba(255, 255, 255, 0.38);
}

/* ─── note 메모 ──────────────────────────── */
.item-note {
    font-size: 11.5px;
    color: #888;
    margin-top: 2px;
    padding-left: 4px;
    border-left: 2px solid #ddd;
    line-height: 1.5;
}