@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

/* ═══════════════════════════════════════════════════════════
 * 신성대학교 시수표·시간표 시스템 — 디자인 시스템
 * Apple 스타일의 정제된 화이트 테마.
 * 변수/클래스 이름은 기존과 동일하게 유지 (기능·JS 영향 없음).
 * ═══════════════════════════════════════════════════════════ */

:root {
    /* Accent — Apple blue */
    --primary-color: #0071e3;
    --primary-hover: #0077ed;
    --primary-soft: #f0f6ff;

    /* Neutrals */
    --text-color: #1d1d1f;
    --text-light: #6e6e73;
    --secondary-color: #f5f5f7;
    --bg-color: #fbfbfd;
    --card-bg: #ffffff;
    --border-color: #d2d2d7;
    --glass-border: #e8e8ed;

    /* Shadows — layered, soft, low-contrast (Apple-style depth) */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.06), 0 24px 48px rgba(0, 0, 0, 0.10);
    --shadow-accent: 0 1px 2px rgba(0, 113, 227, 0.22);
    --shadow-accent-hover: 0 4px 14px rgba(0, 113, 227, 0.28);

    --danger: #ff3b30;
    --success: #34c759;

    /* 모드 정체성 — 작성·수정(편집)=따뜻한 앰버 / 마이페이지(보기)=차분한 블루 */
    --edit-color: #b45309;      /* 편집 모드 텍스트/강조 (밝은 배경 위) */
    --edit-fill: #d2750f;       /* 편집 모드 채움색 (thumb·태그, 흰 글자) */
    --edit-hover: #e0851d;
    --edit-soft: #fff8ee;       /* 편집 배너 배경 */
    --edit-border: #f0d6a6;     /* 편집 배너 경계 */
    --view-color: #0a5bc4;      /* 보기 모드 텍스트/강조 */
    --view-border: #cfe4ff;     /* 보기 배너 경계 */

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
}

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

::selection {
    background: rgba(0, 113, 227, 0.16);
    color: var(--text-color);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text',
        'Pretendard', "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
    width: 100%;
}

/* 페이지 전환 — 토글이 있는 교원 페이지(입력/마이페이지)에서만 적용.
 * 세로 이동(translateY)은 레이아웃 흔들림(reflow)으로 버벅여 보이므로 제거.
 * 대신 불투명도 + 아주 미세한 스케일만 사용 → 레이아웃 변화 없이 부드럽게 안착. */
.page-anim {
    animation: pageEnter 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
    will-change: opacity, transform;
}
@keyframes pageEnter {
    from { opacity: 0; transform: scale(0.994); }
    to   { opacity: 1; transform: none; }
}
.page-anim.page-leaving {
    animation: pageLeave 0.16s ease forwards;
}
@keyframes pageLeave {
    to { opacity: 0; transform: scale(0.994); }
}
@media (prefers-reduced-motion: reduce) {
    .page-anim, .page-anim.page-leaving { animation: none !important; }
    .nav-toggle-thumb { transition: none !important; }
}

/* Cards — solid white, hairline border, layered shadow */
.card {
    background: var(--card-bg);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: -0.02em;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.45rem;
    font-weight: 500;
    font-size: 0.9375rem;
    color: var(--text-color);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 0.7rem 0.95rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-color);
    background: #fff;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
    -webkit-appearance: none;
    appearance: none;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    padding-right: 2.4rem;
    cursor: pointer;
}

input[type="number"] {
    font-variant-numeric: tabular-nums;
}

input::placeholder, textarea::placeholder {
    color: #aeaeb2;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12);
}

/* Buttons — flat, refined, no bounce */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.7rem 1.4rem;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease,
        opacity 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
    font-family: inherit;
    letter-spacing: -0.01em;
}

.btn:active { transform: translateY(0) scale(0.985); opacity: 0.92; }

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.25);
}

.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
    box-shadow: var(--shadow-accent);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: var(--shadow-accent-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--text-color);
    border: 1px solid transparent;
}

.btn-secondary:hover {
    background-color: #ebebed;
    transform: translateY(-1px);
}

.btn-danger {
    background-color: var(--danger);
    color: #fff;
    box-shadow: 0 1px 2px rgba(255, 59, 48, 0.22);
}

.btn-danger:hover {
    background-color: #e0352b;
    box-shadow: 0 4px 14px rgba(255, 59, 48, 0.28);
    transform: translateY(-1px);
}

/* Tables */
.table-responsive {
    overflow: auto;
    max-height: 75vh;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    background: #fff;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

th, td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.9375rem;
}

th {
    font-weight: 600;
    color: var(--text-light);
    white-space: nowrap;
    font-size: 0.875rem;
    letter-spacing: 0.01em;
}

.table-responsive thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--secondary-color);
    box-shadow: inset 0 -1px 0 var(--border-color);
}

/* 본문 셀도 줄바꿈 금지 — 폭이 좁으면 뭉개지 말고 가로 스크롤로 처리 */
.table-responsive td {
    white-space: nowrap;
}

tbody tr {
    transition: background-color 0.15s ease;
}

tbody tr:nth-child(even):not(.dept-group-header):not(.prof-subtotal) {
    background-color: #fcfcfd;
}

tbody tr:hover:not(.dept-group-header):not(.prof-subtotal) {
    background-color: var(--primary-soft) !important;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.tab-btn {
    padding: 0.5rem 1.1rem;
    border: none;
    background: none;
    font-weight: 500;
    font-size: 0.9375rem;
    color: var(--text-light);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.18s;
    font-family: inherit;
}

.tab-btn:hover {
    background: var(--secondary-color);
    color: var(--text-color);
}

.tab-btn.active {
    color: #fff;
    background: var(--primary-color);
}

.year-filter-btn.active {
    outline: 2.5px solid currentColor;
    outline-offset: 1px;
    font-weight: 700 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* Timetable Grid */
.timetable {
    display: grid;
    grid-template-columns: 100px repeat(7, 1fr);
    /* 1px gap으로 칸 구분선을 만들면 고배율(125/150%)·일부 브라우저에서 선이 사라져
     * 빈 칸이 안 보이는 문제가 생긴다 → gap=0 + 셀 테두리 방식으로 모든 환경에서 선 유지. */
    gap: 0;
    background: var(--border-color);
    border-top: 1px solid var(--border-color);
    border-left: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.timetable-cell {
    background: #fff;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.18s;
    font-size: 0.875rem;
}

.timetable-header {
    background: var(--secondary-color);
    font-weight: 600;
    padding: 1rem 0.5rem;
}

.timetable-cell:hover:not(.timetable-header) {
    background: var(--primary-soft);
}

.timetable-cell.selected {
    background: var(--primary-color);
    color: #fff;
}

.timetable-cell.selected .cell-desc {
    color: #cfe4ff;
}

.cell-desc {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: #fff;
    padding: 2rem;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    transform: scale(0.96);
    transition: transform 0.25s;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.hidden {
    display: none !important;
}

/* 미니멀 라인 아이콘 (SF Symbols 풍) — 컬러 이모지 대체 */
.ico {
    width: 1em;
    height: 1em;
    vertical-align: -0.14em;
    display: inline-block;
    flex-shrink: 0;
    stroke-width: 1.7;
}

/* Nav */
.nav {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    padding: 0.9rem 2rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-light);
    font-weight: 500;
    font-size: 0.9375rem;
    padding: 0.45rem 0.95rem;
    border-radius: 8px;
    transition: all 0.18s;
}

.nav-links a:hover {
    background: var(--secondary-color);
    color: var(--text-color);
}

.nav-links a.active {
    background: var(--primary-color);
    color: #fff;
}

/* ───────────────────────────────────────────────
 * 상단 세그먼트 토글 (마이페이지 ↔ 작성/수정하기)
 * ─────────────────────────────────────────────── */
.nav-toggle {
    position: relative;
    display: inline-flex;
    background: var(--secondary-color);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    padding: 3px;
}
.nav-toggle .seg {
    position: relative;
    z-index: 2;
    text-decoration: none;
    color: var(--text-light);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.42rem 1.15rem;
    border-radius: 999px;
    white-space: nowrap;
    text-align: center;
    transition: color 0.28s ease;
    cursor: pointer;
}
.nav-toggle .seg.active {
    color: #fff;
}
.nav-toggle .seg.seg-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.nav-toggle-thumb {
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 3px;
    width: 0;
    background: var(--primary-color);
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
    /* 오버슈트(튕김) 제거 — 230ms 후 페이지가 넘어가며 튕김이 중간에 잘려 버벅여 보였음.
     * 표준 ease-out으로 바꿔 짧은 시간에도 매끄럽게. */
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                background-color 0.25s ease;
    z-index: 1;
}

/* ───────────────────────────────────────────────
 * 모드 정체성 (마이페이지=보기 / 작성·수정=편집)
 * body.mode-view / body.mode-edit 로 스코프.
 * 같은 화면처럼 보이던 두 페이지를 색·배너로 즉시 구분.
 * ─────────────────────────────────────────────── */
/* nav 상단 3px 액센트 라인 — 스크롤해도 항상 보이는 모드 색상 단서 */
.nav { border-top: 3px solid transparent; }
body.mode-edit .nav { border-top-color: var(--edit-fill); }
body.mode-view .nav { border-top-color: var(--primary-color); }

/* 토글 thumb 색을 현재 모드 색으로 — 편집은 앰버, 보기는 블루 */
body.mode-edit .nav-toggle-thumb { background: var(--edit-fill); }
body.mode-view .nav-toggle-thumb { background: var(--primary-color); }
.nav-toggle .seg.active { font-weight: 700; }

/* nav 바로 아래 모드 배너 — 첫인상에서 "어떤 화면인지" 못 박아줌 */
.mode-strip {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.55rem 2rem;
    border-bottom: 1px solid transparent;
    line-height: 1.35;
}
.mode-strip .ms-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
    font-weight: 800;
    font-size: 0.8125rem;
    padding: 0.16rem 0.6rem;
    border-radius: 999px;
    color: #fff;
}
.mode-strip .ms-tag svg { width: 0.92rem; height: 0.92rem; }
.mode-strip strong { font-weight: 800; }

.mode-strip-edit {
    background: var(--edit-soft);
    color: var(--edit-color);
    border-bottom-color: var(--edit-border);
}
.mode-strip-edit .ms-tag { background: var(--edit-fill); }
.mode-strip-edit strong { color: var(--edit-color); }

.mode-strip-view {
    background: var(--primary-soft);
    color: var(--view-color);
    border-bottom-color: var(--view-border);
}
.mode-strip-view .ms-tag { background: var(--primary-color); }
.mode-strip-view strong { color: var(--view-color); }

/* 배너 좌우 패딩을 nav와 정렬 */
@media (min-width: 1280px) { .mode-strip { padding-left: 2.25rem; padding-right: 2.25rem; } }
@media (min-width: 1600px) { .mode-strip { padding-left: 3rem; padding-right: 3rem; } }

/* ───────────────────────────────────────────────
 * 세그먼트 탭 (iOS 스타일) — 페이지 내 뷰 전환용
 * ─────────────────────────────────────────────── */
.seg-tabs {
    display: inline-flex;
    gap: 2px;
    background: var(--secondary-color);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 3px;
    vertical-align: middle;
}
.seg-tabs button {
    border: none;
    background: transparent;
    color: var(--text-light);
    font-weight: 600;
    font-size: 0.875rem;
    font-family: inherit;
    line-height: 1.2;
    padding: 0.45rem 1.05rem;
    border-radius: 7px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.seg-tabs button:hover { color: var(--text-color); }
.seg-tabs button.active {
    background: #fff;
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.card h3 {
    font-weight: 600;
    color: var(--text-color);
    letter-spacing: -0.01em;
}

/* ───────────────────────────────────────────────
 * 비밀번호 표시/숨김 토글 (pw-toggle.js와 함께 사용)
 * ─────────────────────────────────────────────── */
.pw-field {
    position: relative;
    display: block;
}
.pw-field > input {
    padding-right: 2.8rem;
}
.pw-toggle {
    position: absolute;
    top: 50%;
    right: 0.5rem;
    transform: translateY(-50%);
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-light);
    transition: background-color 0.15s, color 0.15s;
    padding: 0;
}
.pw-toggle:hover {
    background: var(--secondary-color);
    color: var(--text-color);
}
.pw-toggle:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 1px;
}
.pw-toggle svg { width: 1.15rem; height: 1.15rem; display: block; }

/* ═════════════════════════════════════════════════════
 * 데스크탑 시인성 — 큰 화면 대응
 * ═════════════════════════════════════════════════════ */
@media (min-width: 1280px) {
    html { font-size: 16.5px; }
    .container { max-width: 1500px; padding: 2rem 2.5rem; }
    .header h1 { font-size: 1.85rem; }
    .card { padding: 2rem 2.25rem; }
    .nav { padding: 0.9rem 2.25rem; }
    th, td { padding: 0.9rem 1rem; }
}

@media (min-width: 1600px) {
    html { font-size: 17px; }
    .container { max-width: 1680px; padding: 2.5rem 3rem; }
    .header h1 { font-size: 2rem; letter-spacing: -0.02em; }
    .header { margin-bottom: 2.25rem; }
    .nav { padding: 1rem 3rem; }
    .nav-links { gap: 0.6rem; }
    .card { padding: 2.5rem 2.75rem; border-radius: 22px; }
    input[type="text"], input[type="password"], input[type="number"], select {
        font-size: 1.02rem; padding: 0.8rem 1.05rem; border-radius: 10px;
    }
    .btn { font-size: 1.02rem; padding: 0.8rem 1.7rem; }
    th, td { padding: 1.05rem 1.15rem; }
    th { font-size: 0.9375rem; }
    table { font-size: 1rem; }
    .tab-btn { padding: 0.6rem 1.25rem; font-size: 0.9375rem; }
    .timetable-cell { font-size: 0.9375rem; min-height: 72px; padding: 0.7rem; }
    .timetable-header { font-size: 1rem; padding: 1.1rem 0.6rem; }
    .cell-desc { font-size: 0.8125rem; }
    label { font-size: 0.9375rem; margin-bottom: 0.5rem; }
    .table-responsive { max-height: 78vh; }
}

@media (min-width: 2200px) {
    html { font-size: 18px; }
    .container { max-width: 1900px; }
    .card { padding: 2.75rem 3rem; }
}


/* ═════════════════════════════════════════════════════
 * UI 정리 (2026-10)
 * ═════════════════════════════════════════════════════ */
/* select 화살표가 글자와 겹치지 않게 — 인라인 padding이 덮어써도 오른쪽 여백 보장 */
select:not([multiple]) {
    padding-right: 2rem !important;
    background-position: right 0.65rem center !important;
    background-size: 14px !important;
    /* 인라인 background:white 가 화살표 이미지를 지워버리던 select들 복구 */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
}
/* 표 안의 좁은 select(직종·수업유형 등)는 글자가 잘리지 않게 화살표 여백을 줄임 */
td select:not([multiple]) {
    padding-right: 1.35rem !important;
    padding-left: 0.4rem !important;
    background-position: right 0.35rem center !important;
    background-size: 11px !important;
}

/* 가로 필터줄 안의 select가 전역 width:100% 때문에 한 줄씩 세로로 쌓이던 문제 */
.semester-bar select,
.semester-bar input { width: auto; }
.semester-bar label { display: inline; margin: 0; }
div[style*="display:flex"] > select,
div[style*="display: flex"] > select { width: auto; }

/* 모바일 — 교원 화면(마이페이지/작성) 상단바·표가 찌그러지던 문제 */
@media (max-width: 768px) {
    .container { padding: 1rem; }
    .nav { padding: 0.6rem 1rem; gap: 0.5rem; }
    .nav > div:first-child > span { display: none; }
    .nav > div:first-child > img { height: 30px !important; }
    .nav-links { align-items: center; gap: 0.25rem; }
    .nav-toggle .seg { padding: 0.38rem 0.75rem; font-size: 0.8125rem; }
    .nav-links > a { padding: 0.4rem 0.45rem; font-size: 0.8125rem; white-space: nowrap; }
    .mode-strip { padding: 0.5rem 1rem; font-size: 0.8125rem; align-items: flex-start; }
    .header { flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.25rem; }
    .header h1 { font-size: 1.4rem; }
    .card { padding: 1.1rem; }
    table td, table th { white-space: nowrap; }
}
