/* ============================================================================
   심화치과임플란트기공학 과제 제출 — 학생 페이지
   디자인 방향: 「티타늄 게이지」
   임플란트 어버트먼트·드라이버의 양극산화 색상(티타늄 골드)에서 팔레트를,
   버니어 캘리퍼스에서 주차 선택·진행 표시의 형태를 가져왔다.
   ========================================================================== */

:root {
  /* 지르코니아 화이트 계열 지면 */
  --paper:      #F2F3F1;
  --surface:    #FFFFFF;
  --surface-2:  #FAFBF9;

  /* 잉크 */
  --ink:        #131A20;
  --ink-2:      #59636D;
  --ink-3:      #8B959D;

  /* 괘선 */
  --line:       #DCDFDA;
  --line-2:     #E9EBE7;

  /* 양극산화 티타늄 골드 — 유일한 액센트 */
  --gold:       #C08B2C;
  --gold-deep:  #8A6114;
  --gold-wash:  #F7EFDD;

  /* 양극산화 퍼플 — 중간과제 전용. 주차 타임라인 밖의 것임을 표시 */
  --purple:     #6B5B95;
  --purple-wash:#EFECF5;

  --ok:         #2F7D52;
  --ok-wash:    #E8F3EC;
  --danger:     #A63A2A;
  --danger-wash:#F8EBE8;

  --sans: 'IBM Plex Sans KR', -apple-system, BlinkMacSystemFont, 'Malgun Gothic', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;

  --r: 4px;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 2px;
}

.container { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 20px; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ── 헤더 ─────────────────────────────────────────────────────────────────── */
.masthead {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.masthead-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 0;
}
/* 가로 3.5:1 워드마크다. 정사각형에 가두면 글자가 읽히지 않으므로
   높이를 기준으로 잡고 너비는 비율대로 따라가게 둔다. */
.masthead-logo {
  height: 40px;
  width: auto;
  flex-shrink: 0;
}
.masthead-text { flex: 1; min-width: 0; }
.masthead-dept {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 3px;
}
.masthead-course {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0;
  color: var(--ink);
}
.semester-chip {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--gold-deep);
  background: var(--gold-wash);
  border: 1px solid #E8D9B6;
  border-radius: var(--r);
  padding: 5px 10px;
}

/* ── 페이지 ───────────────────────────────────────────────────────────────── */
main { padding: 28px 0 64px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 22px;
  margin-bottom: 18px;
}

.panel-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-2);
}
.panel-head h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}
.panel-head .count {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  margin-left: auto;
}

/* ── 공지사항 ─────────────────────────────────────────────────────────────── */
.notice {
  padding: 14px 0;
  border-bottom: 1px solid var(--line-2);
}
.notice:last-child { border-bottom: 0; padding-bottom: 0; }
.notice:first-child { padding-top: 0; }
.notice.pinned {
  border-left: 2px solid var(--gold);
  padding-left: 14px;
  margin-left: -16px;
}
.notice h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 5px;
  letter-spacing: -0.01em;
}
.notice p {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
  white-space: pre-wrap;
}
.notice-date {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 8px;
}
.notice-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.file-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: 13px;
  color: var(--ink-2);
  text-decoration: none;
}
.file-link:hover { border-color: var(--gold); color: var(--gold-deep); }

/* ── 폼 ───────────────────────────────────────────────────────────────────── */
.field { margin-bottom: 18px; }
.field-row { display: flex; gap: 14px; }
.field-row > .field { flex: 1; min-width: 0; }

label, .field-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.req { color: var(--gold-deep); }
.field-hint { font-weight: 400; color: var(--ink-3); }

input[type="text"], input[type="password"], textarea, select {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  transition: border-color .12s;
}

/* 기본 화살표를 지우고 금색 셰브런을 직접 그린다 */
select {
  appearance: none;
  cursor: pointer;
  padding-right: 34px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--gold) 50%),
    linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
select:hover, select:focus { border-color: var(--gold); }
input.mono-input {
  font-family: var(--mono);
  letter-spacing: 0.06em;
}
input:hover, textarea:hover { border-color: #C4C9C0; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(192,139,44,.12);
}
input::placeholder, textarea::placeholder { color: #B6BDB4; }
textarea { resize: vertical; min-height: 62px; }

.note-under {
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 6px;
  line-height: 1.5;
}

/* ── 제출 현황 체크리스트 ──────────────────────────────────────────────────
   중간과제 · 주차별 과제 · 기말과제를 한 줄로 훑어볼 수 있게 한다. */
.week-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0 4px;
}
.week-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  white-space: nowrap;
}
.week-chip.done {
  background: var(--gold-wash);
  border-color: #E0CB9C;
  color: var(--gold-deep);
  font-weight: 600;
}

/* ── 파일 첨부 ────────────────────────────────────────────────────────────── */
.dropzone {
  position: relative;
  border: 1px dashed #C4C9C0;
  border-radius: var(--r);
  background: var(--surface-2);
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .12s, background-color .12s;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--gold);
  background: var(--gold-wash);
}
.dropzone input[type="file"] {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0; cursor: pointer;
}
.dropzone-icon { font-size: 22px; line-height: 1; margin-bottom: 7px; }
.dropzone-text { font-size: 13.5px; color: var(--ink-2); }
.dropzone-text strong { color: var(--ink); font-weight: 600; }
.dropzone-text small { display: block; margin-top: 3px; font-size: 11.5px; color: var(--ink-3); }

.preview {
  display: none;
  position: relative;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.preview img { display: block; width: 100%; max-height: 260px; object-fit: contain; background: var(--surface-2); }
.preview-remove {
  position: absolute; top: 7px; right: 7px;
  width: 26px; height: 26px;
  border: 0; border-radius: 50%;
  background: rgba(19,26,32,.78);
  color: #fff; font-size: 13px; line-height: 1;
  cursor: pointer;
}

/* ── 버튼 ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: var(--r);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: background-color .12s, border-color .12s, color .12s;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #000; }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover:not(:disabled) { background: var(--gold-deep); }
.btn-outline { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-outline:hover:not(:disabled) { border-color: var(--ink); }
.btn-full { width: 100%; }

/* ── 알림 ─────────────────────────────────────────────────────────────────── */
.alert {
  padding: 11px 14px;
  border-radius: var(--r);
  font-size: 13.5px;
  margin-bottom: 16px;
  border: 1px solid;
}
.alert-error   { background: var(--danger-wash); border-color: #E8CFC9; color: var(--danger); }
.alert-success { background: var(--ok-wash);     border-color: #C8E2D2; color: var(--ok); }
.alert-info    { background: var(--gold-wash);   border-color: #E8D9B6; color: var(--gold-deep); }

.toast-container {
  position: fixed; bottom: 20px; left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
  width: calc(100% - 40px); max-width: 400px;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  padding: 12px 15px;
  background: var(--ink);
  color: #F2F3F1;
  border-radius: var(--r);
  font-size: 13.5px;
  box-shadow: 0 6px 20px rgba(19,26,32,.2);
  animation: toast-in .22s ease;
}
.toast.error   { background: var(--danger); }
.toast.success { background: var(--ok); }
.toast.fade-out { opacity: 0; transition: opacity .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── 제출물 썸네일 ────────────────────────────────────────────────────────── */
.submission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.thumb {
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .12s;
  text-align: left;
  padding: 0;
  font: inherit;
  width: 100%;
}
.thumb:hover { border-color: var(--gold); }
.thumb-media {
  height: 92px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
}
.thumb-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-ext { font-family: var(--mono); font-size: 10px; font-weight: 600; color: var(--ink-3); letter-spacing: .06em; }
.thumb-body { padding: 8px 10px 10px; }
.thumb-week {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}
.thumb-date { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); margin-top: 2px; }
.thumb-note {
  font-size: 11.5px; color: var(--ink-2); margin-top: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.empty {
  padding: 22px 0;
  text-align: center;
  font-size: 13.5px;
  color: var(--ink-3);
}

/* ── 이미지 확대 ──────────────────────────────────────────────────────────── */
.lightbox {
  display: none;
  position: fixed; inset: 0;
  background: rgba(19,26,32,.9);
  z-index: 300;
  align-items: center; justify-content: center;
  padding: 24px;
  cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ── 반응형 ───────────────────────────────────────────────────────────────── */
@media (max-width: 620px) {
  .container { padding: 0 14px; }
  .panel { padding: 18px 16px; }
  .field-row { flex-direction: column; gap: 0; }
  /* 좁은 화면에서는 로고와 학기를 한 줄에 두고,
     과목명은 아랫줄 전체 폭을 쓰게 한다. 한 줄에 다 넣으면 3줄로 깨진다. */
  .masthead-inner { flex-wrap: wrap; gap: 10px 12px; padding: 14px 0; }
  .masthead-logo { height: 30px; order: 1; }
  .semester-chip { order: 2; margin-left: auto; align-self: center; }
  .masthead-text { order: 3; flex: 1 0 100%; }
  .masthead-course { font-size: 18px; }
  .notice.pinned { margin-left: -10px; padding-left: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
