/* 前台版面：導覽列、hero、列表、底部 tab bar。 */

/* -------------------------------- 導覽列 --------------------------------- */

#shell {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 60px;
}
.nav-logo {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.nav-logo:hover { color: var(--accent); }
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-actions { display: flex; align-items: center; gap: 10px; }

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  color: var(--ink-soft);
  text-decoration: none;
}
.nav-link:hover { background: var(--paper-2); color: var(--ink); }
.nav-link.active { color: var(--accent); font-weight: 500; }

.bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  text-decoration: none;
  font-size: 17px;
}
.bell:hover { background: var(--paper-2); }
.bell-dot {
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  line-height: 17px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------- hero ---------------------------------- */

.hero { padding: 44px 0 28px; }
.hero h1 { font-size: 30px; }
.hero p { margin-top: 10px; color: var(--ink-soft); max-width: 60ch; }

.notice {
  background: var(--accent-soft);
  border: 1px solid #d3ddfa;
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  font-size: 14.5px;
  color: var(--accent-deep);
  white-space: pre-wrap;
  margin-top: 18px;
}

.section { padding: 22px 0 8px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.section-head h2 { font-size: 19px; }
/* 內文裡的「看更多」連結。不要重用 .nav-link —— 那是導覽列的樣式，
   會被 mobile-audit 當成需要 44px 的控制項而誤報。 */
.more-link { font-size: 14px; text-decoration: none; white-space: nowrap; }
.more-link:hover { text-decoration: underline; }

/* ------------------------------ 課程 / 場次卡 ----------------------------- */

.list { display: flex; flex-direction: column; gap: 10px; }

.item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 17px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
a.item:hover { border-color: var(--accent); box-shadow: var(--shadow); }

/* 左側日期塊：讓時間表一眼掃得到 */
.item-date {
  flex: none;
  width: 54px;
  text-align: center;
  padding-top: 2px;
}
.item-date .d { font-size: 20px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.item-date .m { font-size: 12px; color: var(--ink-faint); }

.item-body { flex: 1; min-width: 0; }
.item-title { font-weight: 600; font-size: 15.5px; }
.item-meta { font-size: 13px; color: var(--ink-faint); margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; }
.item-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

/* 課程類型的色條：靠形狀而不只靠顏色區分 */
.kind-bar { width: 3px; align-self: stretch; border-radius: 3px; flex: none; }
.kind-course { background: var(--kind-course); }
.kind-study_group { background: var(--kind-study); }
.kind-event { background: var(--kind-event); }

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-weight: 600;
  font-size: 15px;
  flex: none;
}

.empty-state {
  text-align: center;
  padding: 44px 20px;
  color: var(--ink-faint);
  background: var(--paper);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}
.empty-state strong { display: block; color: var(--ink-soft); font-size: 15px; margin-bottom: 6px; }

/* --------------------------------- 頁尾 ---------------------------------- */

footer.site-foot {
  margin-top: 56px;
  padding: 24px 0 40px;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: 13px;
}
footer.site-foot .wrap { display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; }
footer.site-foot a { color: var(--ink-faint); }

/* ------------------------------ 登入類頁面 ------------------------------- */

.auth-shell { max-width: 420px; margin: 0 auto; padding: 44px 20px 60px; }
.auth-shell h1 { font-size: 24px; margin-bottom: 6px; }
.auth-shell .sub { color: var(--ink-faint); font-size: 14px; margin-bottom: 24px; }
.auth-foot { margin-top: 18px; text-align: center; font-size: 14px; color: var(--ink-faint); }

.terms-box {
  max-height: 150px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.75;
  color: var(--ink-soft);
  background: var(--paper-2);
  white-space: pre-wrap;
}

/* ------------------------------ 底部 tab bar ------------------------------ */

#tabbar { display: none; }

/* ================================ 手機 ==================================== */

@media (max-width: 720px) {
  .nav-inner { min-height: 54px; gap: 12px; }
  /* 主導覽在手機收起來，改用底部 tab bar */
  .nav-links { display: none; }
  /* 觸控目標 >= 44px：桌機的 38px 在手機上按不準（mobile-audit 會抓）。
     用 padding 撐高度而不是 min-height，才不會把 header 整條拉高。 */
  .nav-actions .nav-link { padding: 11px 8px; font-size: 14px; min-height: 44px; }

  .hero { padding: 28px 0 20px; }
  .hero h1 { font-size: 24px; }

  .item { padding: 13px 14px; gap: 11px; }
  .item-date { width: 46px; }

  /* 內容要讓開被 tab bar 蓋住的高度 */
  body.has-tabbar { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }

  #tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 56px;
    text-decoration: none;
    color: var(--ink-faint);
    font-size: 11px;
  }
  .tab-item.active { color: var(--accent); }
  .tab-icon { position: relative; font-size: 19px; line-height: 1; }
  .tab-dot {
    position: absolute;
    top: -2px;
    right: -6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
  }
  .tab-label { letter-spacing: 0.02em; }

  .auth-shell { padding: 28px 16px 60px; }
}
