/**
 * 主要樣式檔
 * 手機優先設計，響應式佈局
 */

/* 基礎設定 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* 顏色變數 */
  --primary-color: #06C755; /* LINE 綠色 */
  --secondary-color: #00B900;
  --text-color: #333333;
  --text-light: #666666;
  --bg-color: #F5F5F5;
  --card-bg: #FFFFFF;
  --border-color: #E0E0E0;
  --star-white: #E0E0E0;
  --star-green: #4CAF50;
  --star-orange: #FF9800;
  --star-red: #F44336;
  --star-purple: #9C27B0;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft JhengHei', '微軟正黑體', Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  padding-bottom: 54px; /* 為底部導航欄留空間（約原高度 2/3） */
  overflow-x: hidden; /* 隱藏水平滾動條 */
}

/* 隱藏滾動條但保持滾動功能 */
html {
  overflow-x: hidden;
}

/* 隱藏 WebKit 瀏覽器的滾動條 */
::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
  background: transparent;
}

/* 隱藏 Firefox 的滾動條 */
* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* 容器：LINE LIFF 上方已有網址列，不需為劉海留大留白 */
.container {
  max-width: 100%;
  margin: 0 auto;
  padding: 16px;
  padding-top: 12px;
  overflow-x: hidden; /* 防止水平滾動 */
}

/* 標題 */
h1, h2, h3 {
  color: var(--text-color);
  margin-bottom: 16px;
}

h1 {
  font-size: 24px;
  font-weight: 700;
}

h2 {
  font-size: 20px;
  font-weight: 600;
}

h3 {
  font-size: 18px;
  font-weight: 600;
}

/* 按鈕 */
.btn {
  display: inline-block;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.btn-secondary {
  background-color: var(--card-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--bg-color);
}

/* 分享確認對話框：是／否按鈕，不直接跳分享 */
.share-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.share-confirm-box {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 24px;
  max-width: 320px;
  width: 100%;
  box-shadow: var(--shadow-hover);
}
.share-confirm-message {
  margin: 0 0 20px;
  font-size: 16px;
  color: var(--text-color);
  text-align: center;
}
.share-confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.share-confirm-actions .btn {
  min-width: 80px;
}

/* 統一彈窗：單按鈕（提示）與雙按鈕（確認）共用同一風格 */
.app-dialog-overlay .app-dialog-message {
  white-space: pre-wrap;
  word-break: break-word;
}
.app-dialog-actions .app-dialog-btn:only-child {
  min-width: 100px;
}

.btn-small {
  padding: 8px 16px;
  font-size: 14px;
}

.btn-block {
  display: block;
  width: 100%;
}

/* 上一頁按鈕：僅顯示 ‹ 符號，縮小 UI 避免與標題切到 */
/* 固定於頂部不隨內容滾動（行程詳情、成員資料等頁） */
.page-header-with-back {
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-color);
  margin: -16px -16px 0 -16px;
  margin-top: -12px;
  padding: 12px 16px 8px 16px;
  padding-top: 16px;
  /* 保留下方空間，避免標題蓋住字卡 */
  margin-bottom: 12px;
  min-height: 64px;
  box-sizing: border-box;
}
/* 上一頁方形按鈕：40x40，將箭頭視覺上完全置中 */
.btn-back {
  flex-shrink: 0;
  min-width: 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
  font-weight: 300;
  border-radius: 8px;
  color: var(--text-color);
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  /* 微調字元位置（字型本身偏上一點），讓箭頭在方塊裡看起來剛好置中 */
  transform: translateY(1px);
}
.btn-back:hover {
  background-color: var(--bg-color);
}
/* 標題用絕對定位置中，不受左側返回鈕影響，整頁視覺置中 */
.page-header-with-back .page-title-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  width: auto;
  max-width: calc(100% - 100px);
  text-align: center;
}
.page-header-with-back .btn-back {
  position: relative;
  z-index: 1;
}

/* 行程詳情／成員資料：標題與下方內容間距與行程列表一致（12px） */
.page-header-with-back + #loading,
.page-header-with-back + #event-detail,
.page-header-with-back + #edit-form {
  margin-top: 0;
}

/* 新增行程頁：標題固定於頂部不隨表單滾動 */
.page-header-sticky {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-color);
  margin: -16px -16px 12px -16px;
  margin-top: -12px;
  padding: 16px 16px 12px 16px;
  padding-top: 16px;
  /* 保留下方空間，避免標題蓋住表單字卡 */
  min-height: 64px;
  box-sizing: border-box;
}

/* 新增行程頁：標題與下方表單間距與行程列表一致（12px，由 .page-header-sticky margin-bottom 提供） */
.page-header-sticky + .card {
  margin-top: 0;
}

/* ========== 新增行程頁：標題固定、僅表單可捲動（與行程列表圖層一致） ========== */
.page-add-event.container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 54px);
  overflow: hidden;
  padding-top: 12px;
  padding-bottom: 0;
}

.page-add-event .page-header-fixed {
  flex-shrink: 0;
  position: relative;
  z-index: auto;
  margin: 0;
  padding: 0 0 0 0;
  padding-top: 0;
  min-height: 0;
  background: transparent;
}

.page-add-event .add-event-page-title {
  margin: 0 0 12px 0;
}

.page-add-event .add-event-content-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ========== 行程詳情頁：標題固定、僅內容可捲動（與行程列表圖層一致） ========== */
.page-event-detail.container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 54px);
  overflow: hidden;
  padding-top: 12px;
  padding-bottom: 0;
}

.page-event-detail .page-header-with-back,
.page-event-detail .page-header-fixed {
  flex-shrink: 0;
  position: relative;
  z-index: auto;
  margin: 0;
  margin-bottom: 12px;
  padding: 0;
  min-height: 0;
}

/* 成員詳情頁：僅標題列，無上一頁按鈕（LIFF 瀏覽器本身有） */
.page-member-detail .page-header-fixed {
  flex-shrink: 0;
  margin-bottom: 12px;
}

.page-event-detail .event-detail-content-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* 開發模式：精簡按鈕，少佔空間（僅圖示，hover 顯示說明） */
.dev-banner-compact {
  display: none;
  position: fixed;
  top: 6px;
  right: 6px;
  z-index: 9999;
  gap: 4px;
}
.dev-banner-compact a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 14px;
  text-decoration: none;
  color: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.dev-banner-compact a:first-child { background: #06C755; }
.dev-banner-compact a:last-child { background: #333; }

/* ========== 行事曆頁：月曆下緣固定在螢幕一半（50vh） ========== */
.page-calendar.container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 54px);
  overflow: hidden;
  padding-top: 12px;
  padding-bottom: 0;
  padding-left: 12px;
  padding-right: 12px;
}

/* 上半屏（50vh）：僅標題 + 月曆，下緣 = 50vh */
.calendar-page-fixed {
  height: 50vh;
  min-height: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-color);
}

.calendar-page-title {
  flex-shrink: 0;
  margin: 0 0 6px 0;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  color: var(--text-color);
}

/* 月曆填滿固定區剩餘空間，下緣即 50vh */
.page-calendar .calendar-page-fixed .calendar {
  flex: 1;
  min-height: 0;
  height: auto;
  max-height: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 8px 10px;
  margin-bottom: 0;
}
.page-calendar .calendar .calendar-header {
  flex-shrink: 0;
  margin-bottom: 6px;
}
.page-calendar .calendar .calendar-header h2 {
  font-size: 15px;
  margin: 0;
}
.page-calendar .calendar .calendar-nav-btn {
  padding: 2px 6px;
  font-size: 16px;
}
/* 月曆 7 列等高、高度動態：依上方區塊剩餘空間分配，不固定高度避免裁切 */
/* 行事曆：固定 7 欄（日～六），避免來回切換時日或六整欄不見 */
.page-calendar .calendar .calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  gap: 2px;
  grid-auto-rows: minmax(0, 1fr);
}
/* 星期標題列：緊湊留白，與日期列同高（由 grid 等高決定） */
.page-calendar .calendar .calendar-day-header {
  padding: 2px 1px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* 日期格與星期列同高，不因 aspect-ratio 撐大 */
.page-calendar .calendar .calendar-day {
  font-size: 11px;
  border-radius: 4px;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* 小螢幕點點樣式 */
.page-calendar .calendar .calendar-day .event-dots {
  bottom: 1px;
  gap: 1px;
}
.page-calendar .calendar .calendar-day .event-dot {
  width: 3px;
  height: 3px;
}

/* 「今日行程」與「新增行程」：與月曆留間距，不貼在月曆下緣 */
.today-section-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  margin-bottom: 8px;
  min-height: 36px;
}

.selected-date-title-compact {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
}

/* 新增行程按鈕：與「今日行程」同高，不佔滿寬 */
.btn-add-inline {
  flex-shrink: 0;
  padding: 6px 14px !important;
  font-size: 14px !important;
  line-height: 1.3;
  height: auto;
  min-height: 32px;
  display: inline-flex !important;
  align-items: center;
  width: auto !important;
}

/* 僅此區可捲動：行程字卡 */
.today-events-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ========== 列表頁：標題與分頁固定，僅行程字卡可捲動 ========== */
.page-list.container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 54px);
  overflow: hidden;
  padding-top: 12px;
  padding-bottom: 0;
}

.page-list .list-page-fixed,
.page-list .list-tabs-fixed {
  flex-shrink: 0;
}

.page-list .list-page-title {
  margin: 0 0 12px 0;
}

/* 列表頁：月份切換列（仿行事曆 [<] 2026年2月 [>]） */
.month-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--card-bg);
  border-radius: 12px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.month-nav-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.month-nav-btn:hover {
  background: #05b34a;
  transform: scale(1.05);
}

.month-nav-btn:active {
  transform: scale(0.95);
}

.month-display {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-color);
  text-align: center;
  flex: 1;
  letter-spacing: 0.5px;
}

/* 列表頁：月份標題列右側按鈕由 JS 產生（分享整月 + 新增） */

.page-list .tab-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-bottom: 0;
}

.page-list .tab-cards-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ========== 成員頁：標題與邀請按鈕固定，僅成員字卡可捲動 ========== */
.page-members.container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 54px);
  overflow: hidden;
  padding-top: 12px;
  padding-bottom: 0;
}

.page-members .members-page-fixed {
  flex-shrink: 0;
}

.page-members .members-cards-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* 卡片 */
.card {
  background-color: var(--card-bg);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-hover);
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.card-content {
  color: var(--text-light);
  font-size: 14px;
}

/* 行程字卡 */
.event-card {
  background-color: var(--card-bg);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  position: relative;
}

.event-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.event-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-color);
  flex: 1;
}

.event-type {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  background-color: var(--bg-color);
  color: var(--text-color);
  margin-left: 8px;
}

.event-type.學員上課 {
  background-color: #FFF9C4;
  color: #F57F17;
  border: 1px solid #FBC02D;
}

.event-type.活動 {
  background-color: #FFEBEE;
  color: #C62828;
  border: 1px solid #E53935;
}

.event-type.諮詢簽約 {
  background-color: #E8F5E9;
  color: #2E7D32;
  border: 1px solid #4CAF50;
}

.event-type.紫星行程聊聊 {
  background-color: #F3E5F5;
  color: #7B1FA2;
  border: 1px solid #AB47BC;
}

.event-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.event-info-item {
  display: flex;
  align-items: center;
  font-size: 14px;
  color: var(--text-light);
}

.event-info-item i {
  margin-right: 8px;
  width: 20px;
}

.event-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  justify-content: space-between;
}

.event-actions .btn {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 500;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.event-actions .btn-secondary {
  background-color: #F5F5F5;
  color: #333333;
  border: 1px solid #E0E0E0;
}

.event-actions .btn-secondary:hover {
  background-color: #EEEEEE;
  border-color: #CCCCCC;
}

.event-actions .btn-danger {
  background-color: #FF4444;
  color: white;
  border: none;
}

.event-actions .btn-danger:hover {
  background-color: #DD2222;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(255, 68, 68, 0.3);
}

.event-actions .btn-primary {
  background-color: var(--primary-color);
  color: white;
  border: none;
}

.event-actions .btn-primary:hover {
  background-color: var(--secondary-color);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(6, 199, 85, 0.3);
}

/* 行事曆 */
.calendar {
  background-color: var(--card-bg);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.calendar-nav-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-color);
  padding: 8px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.calendar-day-header {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  padding: 8px 4px;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.calendar-day:hover {
  background-color: var(--bg-color);
}

/* 今天：淡色框線，不實心填色，避免與選取框混淆 */
.calendar-day.today {
  background-color: transparent;
  color: var(--text-color);
  border: 1px solid var(--border-color);
  font-weight: 600;
}

.calendar-day.has-events {
  position: relative;
}

/* 多個顏色點點容器：水平排列，置底 */
.calendar-day .event-dots {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
  align-items: center;
  justify-content: center;
}

/* 單個顏色點點：小圓點 */
.calendar-day .event-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* 選取日期：僅顏色框框，不實心填色；且同一時間只有一個選取 */
.calendar-day.selected {
  background-color: transparent;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
  font-weight: 600;
}
/* 若選取的是今天，仍以選取框為主 */
.calendar-day.today.selected {
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
}

/* 列表模式 */
.tab-container {
  background-color: var(--card-bg);
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.tab-header {
  display: flex;
  border-bottom: 2px solid var(--border-color);
}

.tab-btn {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.tab-btn.active {
  color: var(--primary-color);
  font-weight: 600;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--primary-color);
}

/* 列表頁：縮小分頁觸發範圍，避免點「分享整月」「新增」時誤觸切換分頁 */
.page-list .tab-header {
  padding: 0 4px;
  border-bottom-width: 1px;
}
.page-list .tab-btn {
  padding: 6px 8px;
  font-size: 15px;
  min-height: 36px;
  /* 僅在按鈕文字區域內可點，不讓整塊往下延伸 */
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
/* 分頁列與下方「月份＋分享整月／新增」之間留足間距，減少誤觸分頁 */
.page-list .tab-content {
  padding-top: 18px;
}

.tab-content-wrapper {
  position: relative;
  overflow: hidden;
  /* 已取消滑動切換分頁，不設定 touch-action: pan-x，僅保留垂直捲動 */
}

.tab-content {
  display: none;
  padding: 16px;
}

.tab-content.active {
  display: block;
}

/* 成員卡片 */
.member-card {
  background-color: var(--card-bg);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.member-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.member-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
}

.member-info {
  flex: 1;
}

.member-name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 2px;
}

.member-real-name {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 4px;
}

.member-card-arrow {
  flex-shrink: 0;
  font-size: 18px;
  color: var(--text-light);
  margin-left: 8px;
}

.member-star {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
}

.member-star::before {
  content: '';
  width: 18px;
  height: 18px;
  display: inline-block;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23FFD700' d='M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  line-height: 1;
}

.member-star.白星 {
  background-color: #F5F5F5;
  color: #666666;
  border: 1px solid #E0E0E0;
}

.member-star.白星::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23CCCCCC' d='M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z'/%3E%3C/svg%3E");
  opacity: 0.6;
}

.member-star.綠星 {
  background-color: #E8F5E9;
  color: #2E7D32;
  border: 1px solid #4CAF50;
}

.member-star.綠星::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%234CAF50' d='M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z'/%3E%3C/svg%3E");
}

.member-star.橙星 {
  background-color: #FFF3E0;
  color: #E65100;
  border: 1px solid #FF9800;
}

.member-star.橙星::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23FF9800' d='M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z'/%3E%3C/svg%3E");
}

.member-star.紅星 {
  background-color: #FFEBEE;
  color: #C62828;
  border: 1px solid #F44336;
}

.member-star.紅星::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23F44336' d='M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z'/%3E%3C/svg%3E");
}

.member-star.紫星 {
  background-color: #F3E5F5;
  color: #6A1B9A;
  border: 1px solid #9C27B0;
}

.member-star.紫星::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%239C27B0' d='M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z'/%3E%3C/svg%3E");
}

/* 表單 */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-color);
}

/* 長字串換行：在標點（、，。）處換行，避免詞彙中間斷行（如「夢想清單專班」「財商」「天耀簽約」被拆開） */
.text-wrap-nice {
  word-break: keep-all;
  overflow-wrap: break-word;
  white-space: normal;
}

/* 標題輸入框下方的灰色提示詞（依行程類型顯示）；單行時不換行，放不下時由 JS 改為換行避免被切掉 */
.form-hint.form-hint-below {
  margin-top: 6px;
  margin-bottom: 0;
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  line-height: 1.4;
  word-break: keep-all;
  overflow-wrap: break-word;
}
.form-hint.form-hint-below.hint-single-line {
  white-space: nowrap;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  transition: all 0.3s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(6, 199, 85, 0.1);
}

/* 時間選擇器容器 */
.time-picker-container {
  display: flex;
  gap: 8px;
  align-items: center;
}

.time-picker-input {
  flex: 1;
  position: relative;
}

.time-picker-input input {
  width: 100%;
  padding: 12px 40px 12px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  background-color: white;
}

.time-picker-input input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(6, 199, 85, 0.1);
}

.time-picker-input::after {
  content: '🕐';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 18px;
}

/* 時間選擇器彈窗（類似Google表單的滾輪式） */
.time-picker-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.time-picker-modal.active {
  display: flex;
}

.time-picker-content {
  background-color: white;
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 320px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.time-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.time-picker-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-color);
}

.time-picker-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-light);
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.time-picker-close:hover {
  background-color: var(--bg-color);
}

.time-picker-wheels {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
}

.time-picker-wheel {
  flex: 1;
  max-width: 80px;
  position: relative;
  height: 200px;
  overflow: hidden;
  display: flex;
  justify-content: center;
}

.time-picker-wheel-scroll {
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
  box-sizing: border-box;
}

/* 項目高度與字體縮小，避免上下被裁切（日夜完整顯示） */
.time-picker-item {
  height: 36px;
  min-height: 36px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-color);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  padding: 0 8px;
  box-sizing: border-box;
  text-align: center;
}

.time-picker-item.selected {
  font-size: 20px;
  font-weight: 600;
  color: var(--primary-color);
  transform: scale(1.05);
}

.time-picker-item:not(.selected) {
  opacity: 0.35;
  font-size: 14px;
}

.time-picker-wheel-scroll {
  padding: 72px 0;
}

.time-picker-actions {
  display: flex;
  gap: 12px;
}

.time-picker-actions .btn {
  flex: 1;
  padding: 12px;
  font-size: 16px;
  border-radius: 8px;
}

/* 日期選擇器：與時間選擇器同風格，僅分隔符與滾輪區微調 */
.date-picker-sep {
  display: flex;
  align-items: center;
  font-size: 24px;
  color: var(--text-color);
  padding: 0 4px;
  font-weight: 600;
}
.date-picker-wheels .time-picker-wheel {
  max-width: 72px;
}

/* 年的欄位加寬，避免「2024年」等四位數年被左側裁切 */
.date-picker-wheels #date-year-wheel {
  min-width: 100px;
  max-width: 100px;
}
.date-picker-wheels #date-year-wheel .time-picker-item {
  padding-left: 12px;
  padding-right: 12px;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

/* 複選框群組 */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}

.checkbox-label:hover {
  background-color: var(--bg-color);
}

.checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-right: 12px;
  cursor: pointer;
  accent-color: var(--primary-color);
}

.checkbox-label span {
  font-size: 16px;
  color: var(--text-color);
}

/* 個人資料星等顯示 */
.profile-star-display {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 底部導航欄：高度約為原本的 2/3，圖示與文字等比縮小不裁切 */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--card-bg);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 4px 0 6px;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  min-height: 52px;
}

/* 功能 BAR 項目：縮小為約 2/3 比例，保持圖示與文字完整不變形 */
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text-light);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  transition: all 0.3s ease;
  padding: 2px 12px;
}

.nav-item.active {
  color: var(--primary-color);
}

/* 圖示（Emoji）等比縮小，不裁切 */
.nav-item > div:first-child {
  font-size: 20px;
  margin-bottom: 2px;
  line-height: 1;
  flex-shrink: 0;
}

.nav-item i {
  font-size: 20px;
  margin-bottom: 2px;
  flex-shrink: 0;
}

/* 載入動畫（舊版，保留給未改用資料加載動畫的區塊） */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-light);
}

.spinner {
  border: 3px solid var(--bg-color);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

/* 資料加載動畫：與行事曆進入動畫一致，透明毛玻璃 + 康九 logo，套用於所有資料讀取 */
.data-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: 40px;
  text-align: center;
  color: var(--text-color);
}

/* 覆蓋式資料加載：覆蓋該區塊並顯示透明毛玻璃，與首頁進入動畫一致 */
.data-loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  min-height: 0;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 24px;
}
.data-loading-overlay .data-loading-logo {
  width: 88px;
  height: 88px;
}
.data-loading-overlay .data-loading-text {
  font-size: 16px;
}
/* 個人資料頁：載入動畫取消磨砂玻璃感 */
.page-profile .data-loading-overlay {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
/* 父層需設 position: relative，覆蓋層才會正確覆蓋該區塊 */
/* 並給 min-height，否則絕對定位的載入區會讓父層塌陷為 0 高度，看不到毛玻璃 */
.data-loading-parent {
  position: relative;
  min-height: 220px;
}

.data-loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.data-loading-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  animation: data-loading-pulse 1.2s ease-in-out infinite;
}
.data-loading-text {
  margin: 0;
  font-size: 14px;
  color: var(--text-light);
}
@keyframes data-loading-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.06); opacity: 0.9; }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 空狀態 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.empty-state i {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* 分享按鈕 */
.share-btn {
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.share-btn:hover {
  background-color: var(--secondary-color);
}

/* 響應式設計 */
@media (min-width: 768px) {
  .container {
    max-width: 768px;
  }
}

/* 工具類 */
.text-center {
  text-align: center;
}

.mt-16 {
  margin-top: 16px;
}

/* 頁面標題：與行事曆標題大小統一（18px） */
.page-title {
  margin-top: 0 !important;
  padding-top: 0;
  font-size: 18px !important;
  font-weight: 700;
}

/* 標題列：左側清除快取按鈕 + 標題置中（所有層級共用） */
.page-header-row {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 40px;
  margin-bottom: 12px;
}
.page-header-row .page-title,
.page-header-row .calendar-page-title,
.page-header-row .list-page-title {
  margin: 0 !important;
}
/* 清除快取／重新整理按鈕：對齊左邊、僅圖示無文字 */
.btn-refresh-cache {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: var(--border-color);
  color: var(--text-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.btn-refresh-cache:hover {
  background: var(--shadow);
}
.btn-refresh-cache:active {
  opacity: 0.85;
}
.btn-refresh-cache svg {
  width: 22px;
  height: 22px;
  display: block;
}

/* 邀請按鈕：對齊右邊、圖示+文字 */
.btn-invite-header {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 36px;
  padding: 0 14px;
  border: none;
  border-radius: 18px;
  background: #17c950;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
  font-weight: 600;
  white-space: nowrap;
  min-width: fit-content;
  -webkit-tap-highlight-color: transparent;
}
.btn-invite-header:hover {
  background: #13a842;
}
.btn-invite-header:active {
  opacity: 0.85;
}
.btn-invite-icon {
  font-size: 18px;
  line-height: 1;
  display: inline-block;
}
.btn-invite-text {
  font-size: 15px;
  line-height: 1;
  display: inline-block;
  letter-spacing: 0.5px;
}

.mb-16 {
  margin-bottom: 16px;
}

.hidden {
  display: none !important;
}

/* 模態框 */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.modal-content {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: var(--shadow-hover);
  width: 100%;
  max-width: 600px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-color);
  color: var(--text-color);
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--border-color);
}

/* 小按鈕 */
.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  min-height: 32px;
  border-radius: 6px;
}

.btn-success {
  background: #17c950;
  color: #ffffff;
}

.btn-success:hover {
  background: #13a842;
}

/* 進入層：資料加載動畫（透明毛玻璃）+ 登入頁（僅首頁 index 使用） */
.entry-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  /* 透明毛玻璃：去背、半透明白 + 模糊，不要整片綠色 */
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--text-color);
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
.entry-overlay-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
/* 資料加載動畫：康九 logo + 載入中文字 */
.entry-animation {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.entry-animation .data-loading-logo {
  width: 88px;
  height: 88px;
  object-fit: contain;
  animation: data-loading-pulse 1.2s ease-in-out infinite;
}
.entry-text {
  margin: 0;
  font-size: 16px;
  color: var(--text-light);
}
.entry-login {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 280px;
}
.entry-login h2 {
  margin: 0 0 12px;
  font-size: 22px;
  color: var(--text-color);
}
.entry-login p {
  margin: 0 0 24px;
  color: var(--text-light);
  font-size: 15px;
}
.entry-login .btn-line-login {
  padding: 14px 32px;
  font-size: 18px;
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 28px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  transition: transform 0.2s, box-shadow 0.2s;
}
.entry-login .btn-line-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
.entry-login .btn-line-login:active { transform: translateY(0); }
.entry-login .btn-line-login:disabled { opacity: 0.8; cursor: not-allowed; }

/* LINE 登入 overlay：非開發模式且未登入時顯示（非首頁時使用） */
.liff-login-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: linear-gradient(135deg, #06C755 0%, #00B900 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: #fff;
}
.liff-login-overlay h2 {
  color: #fff;
  margin-bottom: 12px;
  font-size: 22px;
}
.liff-login-overlay p {
  color: rgba(255,255,255,0.95);
  margin-bottom: 24px;
  text-align: center;
  max-width: 280px;
}
.liff-login-overlay .btn-line-login {
  padding: 14px 32px;
  font-size: 18px;
  background: #fff;
  color: #06C755;
  border: none;
  border-radius: 28px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  transition: transform 0.2s, box-shadow 0.2s;
}
.liff-login-overlay .btn-line-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
.liff-login-overlay .btn-line-login:active {
  transform: translateY(0);
}
.liff-login-overlay .btn-line-login:disabled {
  opacity: 0.8;
  cursor: not-allowed;
}

/* ========== 方案 3：日期／時間快捷與 Chip ========== */
.date-input-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.date-input-row .form-input {
  flex: 1;
  min-width: 0;
}
.date-shortcuts {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.btn-date-shortcut {
  padding: 8px 12px;
  font-size: 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-color);
  cursor: pointer;
  white-space: nowrap;
}
.btn-date-shortcut:active {
  background: var(--border-color);
}
.time-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.time-chip {
  display: inline-block;
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 20px;
  border: 1px solid var(--primary-color);
  background: rgba(6, 199, 85, 0.08);
  color: var(--primary-color);
  cursor: pointer;
}
.time-chip:active {
  background: var(--primary-color);
  color: #fff;
}

/* ================ ?????? ================ */
.member-role-badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.member-role-badge.manager {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffc107;
}
.member-role-badge.admin {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #dc3545;
}
.member-role-badge.member {
  background: var(--bg-color);
  color: var(--text-light);
  border: 1px solid var(--border-color);
}

/* ?????? */
.role-select {
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: white;
  cursor: pointer;
}

/* ================ ?????? ================ */
.tabs-container {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0;
  background: var(--card-bg);
  border-radius: 12px 12px 0 0;
  overflow: hidden;
}
.page-management .tab-btn {
  flex: 1;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  background: transparent;
  color: var(--text-light);
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: -2px;
}
.page-management .tab-btn:hover {
  color: var(--primary-color);
  background: rgba(6, 199, 85, 0.04);
}
.page-management .tab-btn.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}
.page-management .tab-content {
  display: block;
}
.page-management .tab-content.hidden {
  display: none;
}
.data-item {
  transition: background 0.2s;
}
.data-item:hover {
  background: var(--bg-color);
}

/* ?????????????? */
.btn-management {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 36px;
  padding: 0 14px;
  border: none;
  border-radius: 18px;
  background: linear-gradient(135deg, #06C755 0%, #00B900 100%);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(6, 199, 85, 0.3);
  transition: all 0.2s;
}
.btn-management:hover {
  transform: translateY(-50%) translateY(-1px);
  box-shadow: 0 4px 12px rgba(6, 199, 85, 0.4);
}
.btn-management:active {
  opacity: 0.85;
}
