/* 全站樣式 3/16：單位篩選分段鈕、子分頁列（sub-nav）、Nav 群組下拉、內容區頁首與日期／月份選擇器 */
/* 單位篩選（Apple Segmented Control） */
.unit-filter {
  display: flex;
  justify-content: center;
  background: rgba(118, 118, 128, 0.12);
  border-radius: 8px;
  padding: 2px;
  max-width: 280px;
  margin: 0 auto 8px;
}

.unit-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 6px 16px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
  white-space: nowrap;
}

.unit-btn:hover {
  background: rgba(244, 162, 97, 0.1);
  transform: translateY(-1px);
}
.unit-btn.active {
  background: white;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(60,40,20,.08);
}
.unit-btn.active:hover {
  box-shadow: 0 1px 3px rgba(60,40,20,.08);
  transform: translateY(-1px);
}

/* 班級卡片上的單位標籤 */
.class-card-unit {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--purple);
  color: white;
  font-size: 0.6rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 8px;
}

/* 有年段標籤的卡片，上緣多留一行給標籤站——不然窄螢幕會壓到中間的班級圓圈（2026-09-04） */
.class-card--kg:has(.class-card-grade) { padding-top: 32px; }
.class-card--kg:has(.class-card-unit) { padding-top: 32px; }

.class-card-grade {
  position: absolute;
  max-width: calc(100% - 12px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  top: 6px;
  left: 6px;
  background: rgba(var(--class-tint), 0.16);
  color: rgb(var(--class-tint));
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 8px;
  border: 1px solid rgba(var(--class-tint), 0.28);
  letter-spacing: -0.2px;
}

.class-card {
  position: relative;
}

.sub-nav {
  display: flex;
  gap: 4px;
  background: rgba(248, 243, 235, 0.7);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid rgba(15, 44, 64, 0.05);
  border-radius: 16px;
  padding: 4px;
  max-width: 600px;
  margin: 0 auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 1px 2px rgba(15, 44, 64, 0.03);
}
.sub-nav::-webkit-scrollbar { display: none; }

/* 子元素只有 1-2 顆 tab 時，外框貼合內容靠左，不留右側大片空白 */
.sub-nav:has(> .nav-btn:nth-child(2):last-child),
.sub-nav:has(> .nav-btn:only-child) {
  width: fit-content;
  max-width: 380px;
  margin: 0 auto 0 0;
}
.sub-nav:has(> .nav-btn:nth-child(2):last-child) > .nav-btn,
.sub-nav:has(> .nav-btn:only-child) > .nav-btn {
  flex: 0 1 auto;
  padding: 7px 26px;
}

/* SUNLink：平均分配寬度 */
#nav-parent-portal {
  gap: 2px;
}
#nav-parent-portal .nav-btn {
  flex: 1;
  padding: 7px 4px;
  font-size: 0.75rem;
}

nav {
  max-width: 600px;
  margin: 0 auto;
}

.nav-btn {
  position: relative;
  flex: 1;
  flex-shrink: 0;
  min-width: 0;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: -0.2px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.nav-badge {
  align-items: center;
  justify-content: center;
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  min-width: 16px;
  height: 16px;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0 4px;
  margin-left: 4px;
  line-height: 1;
  vertical-align: 1px;
}
.nav-btn:hover {
  background: rgba(244, 162, 97, 0.08);
  color: var(--text);
}
.nav-btn.active:hover {
  transform: translateY(-1px);
}
.nav-btn .nav-icon {
  margin-right: 2px;
}
.nav-icon {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .nav-btn { font-size: 0.75rem; padding: 7px 4px; }
  .sub-nav:not(.sub-nav-grid) { flex-wrap: wrap; }
}
@media (max-width: 380px) {
  .nav-btn { font-size: 0.75rem; padding: 6px 3px; }
  .nav-badge { min-width: 14px; height: 14px; font-size: 0.58rem; margin-left: 3px; }
}

/* ====== Nav 群組（才藝系統收費/補課）====== */

/* 桌面：群組容器透明，子按鈕直接流入 flex */
@media (min-width: 769px) {
  .nav-group { display: contents; }
  .nav-group-trigger { display: none !important; }
  .nav-group-popup { display: contents; }
}

/* 手機：群組容器變成一個 flex item + 下拉 */
@media (max-width: 768px) {
  #nav-talent, #nav-parent-portal, #nav-billing-sys { flex-wrap: nowrap; overflow: visible; } /* overflow:visible 讓下拉不被剪裁 */
  .nav-group {
    position: relative;
    flex: 1;
    flex-shrink: 0;
  }
  .nav-group-trigger {
    width: 100%;
  }
  .nav-group-trigger::after {
    content: ' ▾';
    font-size: 0.6em;
    vertical-align: middle;
    opacity: 0.7;
  }
  .nav-group-popup {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--card);
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(60,40,20,.14);
    z-index: 200;
    padding: 4px;
    flex-direction: column;
    min-width: 110px;
    white-space: nowrap;
  }
  .nav-group.open .nav-group-popup {
    display: flex;
  }
  /* 最左／最右邊那一組，下拉靠邊對齊就好，置中會凸出畫面外把整頁撐寬 */
  .sub-nav > .nav-group:last-child .nav-group-popup {
    left: auto;
    right: 0;
    transform: none;
  }
  .sub-nav > .nav-group:first-child .nav-group-popup {
    left: 0;
    right: auto;
    transform: none;
  }
  .nav-group-popup .nav-btn,
  #nav-parent-portal .nav-group-popup .nav-btn {
    flex: none;
    text-align: left;
    padding: 9px 14px;
    font-size: 0.8125rem;
    border-radius: 8px;
    white-space: nowrap;
  }
  .nav-group-trigger.group-active {
    background: var(--card);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(60,40,20,.08);
    border-radius: 8px;
  }
  body.dark-mode .nav-group-popup {
    box-shadow: 0 8px 28px rgba(60,40,20,.14);
  }
}

@media (max-width: 420px) {
  #nav-talent, #nav-parent-portal, #nav-billing-sys { flex-wrap: nowrap !important; }
}

.nav-btn.active {
  background: #ffffff;
  font-weight: 700;
  color: var(--accent-dark);
  letter-spacing: -0.2px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 1px 2px rgba(244, 162, 97, 0.08),
    0 4px 12px -4px rgba(244, 162, 97, 0.22);
}
.nav-btn.active::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-dark));
  animation: navIndicatorIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes navIndicatorIn {
  from { width: 0; opacity: 0; }
  to { width: 18px; opacity: 1; }
}

.nav-btn.hidden { display: none; }

.nav-btn.nav-btn-ext {
  color: var(--accent);
  font-weight: 600;
}
.nav-btn.nav-btn-ext.active {
  color: var(--accent);
}

/* 收費系統分頁列：不再自訂樣式，改用與才藝系統相同的預設 .sub-nav / .nav-btn 效果
   （白膠囊選中 + 置中動畫底線 + 玻璃底容器；桌面群組沿用預設 display:contents 攤平） */


/* ============================================
   內容區
   ============================================ */
main {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px 16px 60px;
}

.section-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}

/* 統一的頁面標頭（標題 + 右側工具） */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 10px;
}
.section-header .section-title { margin: 0; }
/* 標題不准被右邊的日期框擠成兩行（手機版「班級點名」跳行的真因：
   日期元件在頁面隱藏時量不到寬度，會 fallback 成 width:100% 把整行吃光）*/
.section-header > .section-title { white-space: nowrap; flex: 0 0 auto; }
.section-header > *:not(.section-title) { min-width: 0; }

/* 統一的日期/月份選擇器 */
/* 月份選擇器：整合 "月份" 標籤 + input 成一個按鈕 */
.month-picker {
  display: flex;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--separator);
  border-radius: 12px;
  padding: 0 4px 0 14px;
  box-shadow: 0 1px 3px rgba(60,40,20,.08);
  margin-bottom: 12px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.month-picker:hover { border-color: var(--accent); }
.month-picker:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(244,162,97,0.15); }
.month-picker-label {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-right: 10px;
  flex-shrink: 0;
}
.month-picker-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 6px;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  outline: none;
  width: 100%;
  cursor: pointer;
}
.month-picker-input::-webkit-calendar-picker-indicator {
  opacity: 0.6;
  cursor: pointer;
}

.input-date {
  padding: 8px 12px;
  border: 1px solid var(--separator);
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.8125rem;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(60,40,20,.08);
}

