/* =========================
   기본 설정
========================= */
@font-face {
    font-family: "Pretendard";
    src: url("/static/fonts/Pretendard-Regular.woff2");
    font-weight: 400;
}

@font-face {
    font-family: "Pretendard";
    src: url("/static/fonts/Pretendard-Medium.woff2");
    font-weight: 500;
}

@font-face {
    font-family: "Pretendard";
    src: url("/static/fonts/Pretendard-SemiBold.woff2");
    font-weight: 600;
}
* {
    box-sizing: border-box;
}

html {
    scrollbar-gutter: stable;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: "Pretendard";
    font-weight: 500;
    background-color: #f5f6f8;
    color: #222;
}


/* =========================
   페이지 내용
========================= */

.page-content {
    min-height: 100vh;

    padding-top: 80px;
    padding-bottom: 30px;
    padding-left: 30px;
    padding-right: 30px;
}


/* =========================
   네비게이션
========================= */

.navigation {
    position: fixed;

    top: 0;
    left: 0;

    width: 100%;
    height: 64px;

    background-color: white;

    border-bottom: 1px solid #e5e5e5;

    z-index: 1000;

    display: flex;
    align-items: center;
}


/* 사이트 이름 */

.site-title {
    font-size: 30px;
    font-family: "Pretendard";
    font-weight: 600;
    white-space: nowrap;
    padding-left: 30px;
}


/* 가운데 메뉴 */

.nav-menu {
    position: absolute;

    left: 50%;
    transform: translateX(-50%);

    height: 100%;

    display: flex;

    justify-content: center;
    align-items: center;

    white-space: nowrap;
}


.nav-item {
    height: 100%;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0 25px;

    color: #777;

    text-decoration: none;
    font-size: 20px;
}


.nav-item:hover {
    background-color: #f5f5f5;
}


.nav-item.active {
    color: #3366ff;
}

/* =========================
   네비게이션 아이콘
========================= */

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

/* 홈 */

.home-icon {
    width: 22px;
    height: 22px;
    position: relative;
    margin: 0 auto;
}

.home-icon::before {
    content: "";
    position: absolute;
    width: 20px;
    height: 16px;
    left: 50%;
    top: 7px;
    transform: translateX(-50%);
    border: 2px solid currentColor;
    border-top: none;
    border-radius: 2px;
    box-sizing: border-box;
}

.home-icon::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    left: 50%;
    top: 2px;
    transform: translateX(-50%) rotate(45deg);
    border-left: 2px solid currentColor;
    border-top: 2px solid currentColor;
    box-sizing: border-box;
}

/* 일정 */

.schedule-icon {
    width: 22px;
    height: 22px;
    position: relative;
    margin: 0 auto;
}

.schedule-icon::before {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    left: 50%;
    top: 2px;
    transform: translateX(-50%);
    border: 2px solid currentColor;
    border-radius: 2px;
    box-sizing: border-box;
}

/* 자료실 */

.archive-icon {
    position: relative;
    width: 20px;
    height: 15px;
    border: 2px solid currentColor;
    border-radius: 3px;
    box-sizing: border-box;
    margin: 0 auto;
}

.archive-icon::before {
    content: "";
    position: absolute;
    top: -5px;
    left: 3px;
    width: 8px;
    height: 4px;
    border: 2px solid currentColor;
    border-bottom: 0;
    border-radius: 2px 2px 0 0;
    box-sizing: border-box;
}

/* 부서 */

.department-icon {
    position: relative;
    width: 22px;
    height: 22px;
    margin: 0 auto;
}

.department-icon::before {
    content: "";
    position: absolute;

    width: 9px;
    height: 9px;

    top: 0;
    left: 50%;

    transform: translateX(-50%);

    border: 2px solid currentColor;
    border-radius: 50%;
    box-sizing: border-box;
}

.department-icon::after {
    content: "";
    position: absolute;

    width: 20px;
    height: 9px;

    left: 50%;
    bottom: 1px;

    transform: translateX(-50%);

    border: 2px solid currentColor;
    border-radius: 10px 10px 3px 3px;

    box-sizing: border-box;
}


/* 기타 */

.etc-icon {
    width: 24px;
    height: 20px;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 4px;
}

.etc-icon span {
    display: block;

    width: 6px;
    height: 6px;

    flex-shrink: 0;

    border-radius: 50%;
    background-color: currentColor;
}

/* =========================
   모바일
========================= */

@media (max-width: 768px) {

    .navigation {
        top: auto;
        bottom: 0;

        height: 64px;

        border-top: 1px solid #e5e5e5;
        border-bottom: none;
    }

    .nav-menu {
        position: static;
        transform: none;
        width: 100%;
        height: 100%;
        display: flex;
    }

    .nav-item {
        flex: 1 1 0;
        min-width: 0;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        padding: 0;
        font-size: 11px;
    }

    .nav-icon {
        width: 30px;
        height: 22px;
        flex: 0 0 22px;
        margin: 0 auto;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
    }

    /* 실제 아이콘 크기는 강제로 늘리지 않음 */
    .home-icon,
    .schedule-icon,
    .archive-icon,
    .department-icon,
    .etc-icon {
        flex: 0 0 auto;
    }

    .nav-text {
    height: 14px;
    line-height: 14px;
    display: block;
    }

    .page-content {
        padding-top: 20px;

        /*
         * 모바일 하단 네비게이션에
         * 내용이 가리지 않도록 여유 공간 확보
         */
        padding-bottom: 90px;
    }

    /* 홈 아이콘 가로로 늘리기 */
    .home-icon::before {
        width: 18px;
        height: 16px;
    }

    /* 일정 아이콘 조금 키우기 */
    .schedule-icon::before {
        width: 19px;
        height: 19px;
    }

    /* 자료실 아이콘 줄이기 */
    .archive-icon {
        width: 20px;
        height: 15px;
    }

    .archive-text {
        transform: translateY(3.3px);

}

}

/* =========================
   캘린더
========================= */

.calendar-container {
    max-width: 1000px;
    margin: 0 auto;
}


.calendar-header {
    position: relative;

    display: flex;

    justify-content: flex-end;

    min-height: 50px;

    margin-bottom: 20px;
}


.calendar-nav {
    position: absolute;

    left: 50%;

    top: 50%;

    transform: translate(-50%, -50%);

    display: flex;

    align-items: center;

    gap: 30px;
}


.calendar-header h1 {
    margin: 0;

    font-size: 28px;

    text-align: center;

    white-space: nowrap;
}


.calendar-header button:not(.add-button) {
    border: none;

    background: none;

    font-size: 32px;

    cursor: pointer;

    padding: 5px 15px;
}
/* 캘린더 전체 */

.calendar {
    display: grid;

    grid-template-columns: repeat(7, 1fr);

    background-color: white;

    border: 1px solid #e5e5e5;

    border-radius: 12px;

    overflow: hidden;
}


/* 요일 */

.day-name {
    padding: 15px;

    text-align: center;

    font-weight: bold;

    background-color: #f5f6f8;

    border-right: 1px solid #e5e5e5;
    border-bottom: 1px solid #e5e5e5;
}


/* 마지막 요일의 오른쪽 선 제거 */

.day-name:nth-child(7) {
    border-right: none;
}


/* 날짜 영역 */

#calendar-days {
    grid-column: 1 / -1;

    display: grid;

    grid-template-columns: repeat(7, 1fr);
}


/* 날짜 */

.calendar-day {
    min-height: 100px;

    padding: 10px;

    background-color: white;

    border-right: 1px solid #e5e5e5;
    border-bottom: 1px solid #e5e5e5;

    overflow: hidden;
}

@media (max-width: 768px) {

    .site-title {
        display: none;
    }

    .navigation {
        top: auto;
        bottom: 0;
        height: 64px;
        border-top: 1px solid #e5e5e5;
        border-bottom: none;
    }

    .page-content {
        padding-left: 10px;
        padding-right: 10px;
    }

    .calendar-container {
        width: 100%;
        max-width: none;
    }

    .calendar-header {
        min-height: 50px;
        margin-bottom: 10px;
        display: block;
    }

    .calendar-header .add-button {
        position: absolute;
        top: 0;
        right: 0;
        width: 44px;
        height: 44px;
        font-size: 26px;
    }

    .calendar-nav {
        left: 0;
        top: 0;
        transform: none;
        width: 100%;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: absolute;
    }

    .calendar-nav h1 {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }

    .calendar-nav #prev-month {
        position: absolute;
        left: calc(50% - 85px);
        top: 50%;
        transform: translateY(-50%);
    }

    .calendar-nav #next-month {
        position: absolute;
        right: calc(50% - 85px);
        top: 50%;
        transform: translateY(-50%);
    }

    .calendar-header h1 {
        font-size: 20px;
    }

    .calendar-header button:not(.add-button) {
        font-size: 28px;
        padding: 4px 8px;
    }

    .calendar {
        width: 100%;
        max-width: 100%;
    }

    #calendar-days {
        width: 100%;
        min-width: 0;
    }

}

/* 각 줄의 7번째 칸 */

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


/* 빈 날짜 */

.calendar-day.empty {
    background-color: #fafafa;
}


/* 마우스를 올렸을 때 */

.calendar-day:hover {
    background-color: #f5f6f8;
}

@media (max-width: 768px) {

    .calendar-day {
        min-height: 90px;
        min-width: 0;
        aspect-ratio: auto;
        padding: 5px;
        overflow-y: auto;
    }

    .calendar-day .calendar-event {
        min-width: 0;
        max-width: 100%;
        align-self: stretch;
        padding: 1px 2px;
        font-size: 10px;
        line-height: 1.25;
        white-space: normal;
        word-break: normal;
        overflow-wrap: anywhere;
        text-overflow: clip;
    }

}

/* =========================
   학급 자료실
========================= */

.archive-page {
    max-width: 1200px;
    margin: 0 auto;
}


.archive-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    margin-bottom: 30px;
}


.archive-header h1 {
    margin: 0 0 5px 0;
}


.archive-header p {
    margin: 0;

    color: #777;
}


/* + 버튼 */

.add-button {
    width: 50px;
    height: 50px;

    border: none;
    border-radius: 50%;

    background-color: #3366ff;
    color: white;

    font-size: 30px;

    cursor: pointer;
}


.add-button:hover {
    transform: scale(1.05);
}


/* 게시글 */

.post-grid {
    display: grid;

    grid-template-columns:
        repeat(auto-fill, minmax(280px, 1fr));

    gap: 20px;
    align-items: start; 

}


.post-card {
    background-color: white;

    border: 1px solid #e5e5e5;

    border-radius: 14px;

    overflow: hidden;

    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.04);

    min-width: 0;
}


.post-image {
    max-width: 100%;
    height: auto;
    display: block;
    margin-bottom: 15px;
    border-radius: 8px;
}


.post-content {
    padding: 20px;
    text-align: left;
}


.post-content h2 {
    margin-top: 0;
    margin-bottom: 10px;

    font-size: 20px;

    text-align: left;
    overflow-wrap: anywhere;
    word-break: break-word;
}


.post-content p {
    margin: 0;

    white-space: pre-wrap;

    color: #555;

    text-align: left;
}


.post-date {
    margin: 0;

    font-size: 17px;

    color: #999;

    line-height: 1;
}



.file-button {
    display: inline-block;

    padding: 8px 12px;

    margin-top: 10px;

    border-radius: 8px;

    background-color: #f1f3f5;

    color: #333;

    text-decoration: none;

    font-size: 14px;
}


.file-button:hover {
    background-color: #e5e7eb;
}


.empty-posts {
    padding: 20px;

    text-align: left;
    font-size: 20px;

    color: #888;
}

.post-text {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;

    text-align: left;

    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.post-footer {
    display: flex;

    width: 100%;
    height: 50px;

    align-items: center;
    justify-content: space-between;

    margin-top: auto;
    padding-top: 30px;
}

.detail-image-grid {
    display: grid;

    grid-template-columns: repeat(2, 1fr);

    gap: 8px;

    margin-bottom: 20px;
}

.detail-image {
    width: 100%;

    aspect-ratio: 1 / 1;

    object-fit: cover;

    border-radius: 8px;

    cursor: pointer;
}

.post-detail-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    text-align: left;
    line-height: 1.6;
    margin-bottom: 20px;
}

.post-detail-date {
    color: #999;
}


/* =========================
   게시글 작성 모달
========================= */

.modal {
    position: fixed;

    inset: 0;

    display: none;

    align-items: center;
    justify-content: center;

    background-color: rgba(0, 0, 0, 0.4);

    z-index: 2000;

    padding: 20px;
}


.modal.show {
    display: flex;
}


.modal-content {
    width: 100%;
    max-width: 550px;

    background-color: white;

    border-radius: 16px;

    padding: 25px;
}


.modal-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    margin-bottom: 20px;
}


.modal-header h2 {
    margin: 0;
}


.modal-header button {
    border: none;

    background: none;

    font-size: 28px;

    cursor: pointer;
}


.modal-content form {
    display: flex;

    flex-direction: column;

    gap: 10px;
}


.modal-content input[type="text"],
.modal-content textarea {
    width: 100%;

    padding: 12px;

    border: 1px solid #ddd;

    border-radius: 8px;

    font-family: inherit;

    font-size: 15px;
}


.modal-content textarea {
    min-height: 150px;

    resize: vertical;
}


.modal-buttons {
    display: flex;

    justify-content: flex-end;

    gap: 10px;

    margin-top: 15px;
}


.modal-buttons button {
    padding: 10px 18px;

    border: none;

    border-radius: 8px;

    cursor: pointer;
}


.modal-buttons button[type="submit"] {
    background-color: #3366ff;

    color: white;
}


.delete-button {
    display: block;

    margin: 0;
    padding: 4px 6px;

    border: none;

    background: white;

    color: #999;

    font-family: inherit;

    font-size: 17px;

    line-height: 1;

    cursor: pointer;
}


.delete-button:hover {
    color: #ff4444;
    font-size: 18px;
    line-height: 0.9;
}


.file-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-select-button {
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    cursor: pointer;
    white-space: nowrap;
}

.file-select-name {
    color: #666;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-grow {
    transition: transform 0.15s ease;
}

.btn-grow:hover {
    transform: scale(1.05);
}

.calendar-day {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.calendar-day-number {
    font-size: 14px;
    font-weight: 500;
}

.calendar-day.today {
    border: 2px solid #4a90e2;
    border-radius: 6px;
}

.calendar-event {
    font-size: 12px;
    background: #f0f4ff;
    color: #333;
    padding: 2px 4px;
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-event:hover {
    background: #dbe6ff;
}

.calendar-day:not(.empty) {
    cursor: pointer;
}

.calendar-day.holiday .calendar-day-number {
    color: #e74c3c;
}

.calendar-holiday {
    font-size: 11px;
    color: #e74c3c;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dday-list {
    display: flex;
    flex-direction: column;
}

.dday-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 16px;
}

.dday-group:last-child {
    margin-bottom: 0;
}

.dday-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    background: #f8f8f8;
    cursor: pointer;
}

.dday-item:hover {
    background: #efefef;
}

.dday-badge {
    font-weight: 700;
    color: #e74c3c;
    min-width: 50px;
}

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

.post-image-grid {
    display: grid;

    grid-template-columns: repeat(2, 1fr);

    gap: 8px;

    margin-bottom: 15px;
}

.post-image-grid .post-image {
    margin-bottom: 0;

    aspect-ratio: 1 / 1;

    object-fit: cover;
}

#image-viewer-modal .image-viewer-content {
    position: relative;

    display: flex;

    align-items: center;

    justify-content: center;

    width: 90vw;

    height: 90vh;
}

#image-viewer-img {
    max-width: 100%;

    max-height: 100%;

    object-fit: contain;

    border-radius: 8px;
}

.image-viewer-close {
    position: absolute;

    top: -40px;

    right: 0;

    background: none;

    border: none;

    color: white;

    font-size: 32px;

    cursor: pointer;
}

.image-viewer-nav {
    position: absolute;

    top: 50%;

    transform: translateY(-50%);

    background: rgba(0, 0, 0, 0.4);

    border: none;

    color: white;

    font-size: 32px;

    cursor: pointer;

    width: 48px;

    height: 48px;

    border-radius: 50%;

    display: flex;

    align-items: center;

    justify-content: center;

    padding: 0;
}

.image-viewer-prev {
    left: -60px;
}

.image-viewer-next {
    right: -60px;
}

#image-viewer-modal {
    background: rgba(0, 0, 0, 0.8);
}

@media (max-width: 768px) {

    #image-viewer-modal .image-viewer-content {
        width: 100vw;

        height: auto;

        max-height: 80vh;
    }

    .image-viewer-nav {
        font-size: 28px;

        padding: 8px 12px;
    }

    .image-viewer-prev {
        left: 8px;
    }

    .image-viewer-next {
        right: 8px;
    }

    .image-viewer-close {
        top: -36px;

        right: 8px;
    }

}

.image-viewer-download {
    position: absolute;

    bottom: -20px;

    left: 50%;

    transform: translateX(-50%);

    background: rgba(0, 0, 0, 0.6);

    color: white;

    border: none;

    padding: 10px 20px;

    border-radius: 20px;

    font-size: 14px;

    cursor: pointer;

    white-space: nowrap;
}

@media (max-width: 768px) {

    .image-viewer-download {
        bottom: -44px;

        font-size: 13px;

        padding: 8px 16px;
    }

}

.department-tabs {
    display: flex;

    gap: 8px;

    margin-bottom: 20px;

    overflow-x: auto;
}

.department-tab {
    padding: 8px 16px;

    border: 1px solid #e5e5e5;

    border-radius: 20px;

    background: white;

    color: #777;

    cursor: pointer;

    white-space: nowrap;

    font-size: 14px;
}

.department-tab.active {
    background: #3366ff;

    color: white;

    border-color: #3366ff;
}

.etc-item {
    margin-top: 10px;
}

.etc-title {
    font-size: 17px;

    font-weight: 600;

    margin: 0 0 6px;
}

/* 시험 D-day */

.exam-dday-section {
    margin-top: 30px;
}

.exam-dday-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

@media (max-width: 768px) {

    .exam-dday-section {
        margin-top: 25px;
    }

    .exam-dday-item {
        font-size: 14px;
    }

}