/* st_app.css — 學生端樣式，設計變數沿用老師端 app.css，保持兩邊視覺一致 */

:root {
  --ink: #14161a;
  --ink-soft: #52565f;
  --paper: #ffffff;
  --paper-dim: #f5f5f4;
  --line: #e3e2df;
  --line-strong: #cfcecb;
  --accent-green: #2f8f5b;
  --accent-green-bg: #e9f5ee;
  --accent-orange: #c9741f;
  --accent-orange-bg: #fbf0e4;
  --accent-red: #c23b3b;
  --accent-red-bg: #fbebeb;
  --radius: 10px;
  --font-ui: 'Inter', 'Noto Sans TC', system-ui, sans-serif;
  --font-cjk: 'Noto Sans TC', 'Inter', system-ui, sans-serif;
  --topbar-h: 52px;
  --bottomnav-h: 56px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-cjk);
  color: var(--ink);
  background: var(--paper-dim);
  -webkit-font-smoothing: antialiased;
}

/* 隱藏捲軸的視覺樣式（功能不受影響，還是可以正常滑動），維持 App 風格的乾淨畫面 */
html,
body {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* 舊版 Edge/IE */
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none; /* Chrome / Safari */
}

.hidden { display: none !important; }

/* ---------- 共用元件 ---------- */

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.field input,
.field select {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px; /* 16px 以上，避免手機瀏覽器 focus 時自動放大畫面 */
  font-family: var(--font-cjk);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent-green);
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 44px; /* 留空間給右側的眼睛按鈕，避免文字被蓋住 */
}

.password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  background: transparent;
  border: none;
  cursor: pointer;
}

.eye-icon {
  width: 20px;
  height: 20px;
}

.eye-slash {
  opacity: 0;
  transition: opacity 0.15s;
}

.password-toggle.is-visible .eye-slash {
  opacity: 1;
}

.btn-primary {
  width: 100%;
  padding: 13px 16px;
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font-cjk);
  color: #fff;
  background: var(--accent-green);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

.btn-primary:active {
  opacity: 0.85;
}

.btn-ghost {
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-cjk);
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
}

.loading-state,
.empty-state,
.error-state {
  padding: 32px 16px;
  text-align: center;
  font-size: 14px;
  color: var(--ink-soft);
}

.error-state {
  color: var(--accent-red);
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
}

.badge-package {
  color: var(--accent-green);
  background: var(--accent-green-bg);
}

.badge-monthly {
  color: var(--accent-orange);
  background: var(--accent-orange-bg);
}

.badge-cancelled {
  color: var(--accent-red);
  background: var(--accent-red-bg);
}

/* ---------- 登入／註冊畫面 ---------- */

#authScreen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  padding: 32px 24px;
  background: var(--paper);
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.auth-mark {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
}

.auth-sub {
  margin: 4px 0 24px;
  font-size: 14px;
  color: var(--ink-soft);
  text-align: center;
}

.auth-tabs {
  display: flex;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.auth-tab {
  flex: 1;
  padding: 10px 0;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-cjk);
  color: var(--ink-soft);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  margin-bottom: -1px;
}

.auth-tab.active {
  color: var(--accent-green);
  border-bottom-color: var(--accent-green);
}

.auth-message {
  min-height: 18px;
  margin: 12px 0 0;
  font-size: 13px;
  text-align: center;
}

/* ---------- App 主畫面 ---------- */

#appScreen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-h);
  padding: 0 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar .brand {
  font-family: var(--font-ui);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}

main {
  flex: 1;
  padding: 16px 16px 88px; /* 底部留給 bottom-nav 的空間 */
}

.page-view {
  max-width: 480px;
  margin: 0 auto;
}

/* ---------- 底部導覽列 ---------- */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  height: var(--bottomnav-h);
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); /* 避免被 iPhone 底部手勢列擋住 */
  z-index: 10;
}

.bottom-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-cjk);
  color: var(--ink-soft);
  background: transparent;
  border: none;
  cursor: pointer;
}

.bottom-nav-icon {
  width: 22px;
  height: 22px;
}

.bottom-nav-btn.active {
  color: var(--accent-green);
  font-weight: 700;
}

/* ---------- 課表：月曆固定不動＋課程卡片列表獨立捲動 ---------- */

/* 這個區塊卡在 topbar 跟 bottom-nav 之間，寬高固定，
   跟 <main> 的 padding 完全脫鉤，避免版面計算互相干擾 */
#scheduleView.page-view {
  position: fixed;
  top: var(--topbar-h);
  bottom: var(--bottomnav-h);
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
  background: var(--paper-dim);
}

.sch-calendar {
  flex-shrink: 0; /* 月曆固定不參與捲動 */
  margin: 0 -16px;
  padding: 12px 16px 8px;
  background: var(--paper-dim);
  border-bottom: 1px solid var(--line);
}

.sch-cal-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 4px;
}

.sch-cal-today-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-bottom: 8px;
}

.sch-cal-today-btn {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-cjk);
  color: var(--accent-green);
  background: var(--accent-green-bg);
  border: none;
  border-radius: 999px;
  cursor: pointer;
}

.sch-cal-label {
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  min-width: 100px;
  text-align: center;
}

.sch-cal-nav {
  width: 28px;
  height: 28px;
  font-size: 16px;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
}

.sch-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.sch-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.sch-cal-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--ink);
  background: transparent;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

.sch-cal-cell-empty {
  cursor: default;
}

.sch-cal-cell-today .sch-cal-daynum {
  color: #fff;
  background: var(--accent-green);
  border-radius: 999px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sch-cal-dot {
  width: 7px;
  height: 7px;
  margin-top: 2px;
  border-radius: 999px;
  background: var(--accent-green);
}

/* 這一塊是唯一會捲動的地方，月曆完全不受影響 */
.sch-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 0 24px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.sch-list::-webkit-scrollbar {
  display: none;
}

.sch-date-header {
  margin: 16px 0 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
}

.sch-date-header:first-child {
  margin-top: 4px;
}

.sch-card {
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.sch-card-active {
  border-color: var(--accent-green);
  box-shadow: 0 0 0 2px var(--accent-green-bg);
}

.sch-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.sch-card-time {
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.sch-card-content {
  margin: 0;
  font-size: 14px;
  color: var(--ink-soft);
}

.sch-card-note {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--accent-red);
}

.sch-cancel-btn-row {
  display: grid;
  justify-items: center;
  row-gap: 22px;
  margin-top: 10px;
}

.sch-cancel-btn {
  width: 100%;
  padding: 8px 0;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-cjk);
  color: var(--accent-red);
  background: var(--accent-red-bg);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

.sch-cancel-panel {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.sch-cancel-hint {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--ink-soft);
}

.sch-cancel-hint-warn {
  color: var(--accent-red);
}

.sch-cancel-note {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 14px;
  font-family: var(--font-cjk);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  resize: vertical;
}

.sch-cancel-error {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--accent-red);
}

.sch-cancel-actions {
  display: flex;
  gap: 8px;
}

.sch-cancel-actions .btn-ghost,
.sch-cancel-actions .btn-primary {
  flex: 1;
  width: auto;
  padding: 10px 0;
}

/* ---------- 首頁卡片（st_dashboard.js 動態渲染的內容） ---------- */

.dash-student-name {
  margin: 4px 0 16px;
  font-family: var(--font-ui);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

.dash-announcement {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: var(--accent-orange-bg);
  border-radius: var(--radius);
}

.dash-announcement-icon {
  flex-shrink: 0;
  font-size: 16px;
  line-height: 1.4;
}

.dash-announcement-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  white-space: pre-wrap;
}

.dash-card {
  padding: 20px;
  margin-bottom: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.dash-card-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.dash-next-date {
  margin: 0 0 4px;
  font-family: var(--font-ui);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

.dash-next-content {
  margin: 0;
  font-size: 14px;
  color: var(--ink-soft);
}

.dash-stat-row {
  display: flex;
  gap: 12px;
}

.dash-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  background: var(--paper-dim);
  border-radius: var(--radius);
}

.dash-stat-value {
  font-family: var(--font-ui);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.dash-stat-label {
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-soft);
}

/* ---------- 詞語提示（st_terms.js） ---------- */

.term-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 3px;
  font-size: 11px;
  line-height: 1;
  color: var(--ink-soft);
  background: var(--paper-dim);
  border-radius: 999px;
  cursor: pointer;
  vertical-align: middle;
}

.term-modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  z-index: 100;
}

.term-modal-card {
  position: relative;
  width: 100%;
  max-width: 480px;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  background: var(--paper);
  border-radius: var(--radius) var(--radius) 0 0;
}

.term-modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 28px;
  height: 28px;
  font-size: 18px;
  color: var(--ink-soft);
  background: var(--paper-dim);
  border: none;
  border-radius: 999px;
  cursor: pointer;
}

.term-modal-zh {
  margin: 0 0 16px;
  font-family: var(--font-cjk);
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
}

.term-modal-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 15px;
  color: var(--ink);
}

.term-modal-label {
  flex-shrink: 0;
  width: 40px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
}

/* ---------- 電腦螢幕：加大邊距，內容維持置中，不做完全不同的桌面版排版 ---------- */

@media (min-width: 600px) {
  main {
    padding: 24px 16px 96px;
  }
}
