@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;

    --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%;
}

/* 페이지 전환 — 토글이 있는 교원 페이지(입력/마이페이지)에서만 적용 */
.page-anim {
    animation: pageEnter 0.36s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes pageEnter {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}
.page-anim.page-leaving {
    animation: pageLeave 0.22s ease forwards;
}
@keyframes pageLeave {
    to { opacity: 0; transform: translateY(-10px); }
}
@media (prefers-reduced-motion: reduce) {
    .page-anim, .page-anim.page-leaving { animation: 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.9rem;
    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.98rem;
    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.95rem;
}

th {
    font-weight: 600;
    color: var(--text-light);
    white-space: nowrap;
    font-size: 0.85rem;
    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.95rem;
    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);
    gap: 1px;
    background: var(--border-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.timetable-cell {
    background: #fff;
    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.85rem;
}

.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.95rem;
    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.86rem;
    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);
    transition: left 0.34s cubic-bezier(0.34, 1.25, 0.64, 1),
                width 0.34s cubic-bezier(0.34, 1.25, 0.64, 1);
    z-index: 1;
}

/* ───────────────────────────────────────────────
 * 세그먼트 탭 (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.85rem;
    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.9rem; }
    table { font-size: 1rem; }
    .tab-btn { padding: 0.6rem 1.25rem; font-size: 0.98rem; }
    .timetable-cell { font-size: 0.95rem; min-height: 72px; padding: 0.7rem; }
    .timetable-header { font-size: 1rem; padding: 1.1rem 0.6rem; }
    .cell-desc { font-size: 0.82rem; }
    label { font-size: 0.98rem; 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; }
}
