/* ============================================================
   PickQue 共用樣式標準(pickque-style.css)
   所有頁面(rich 開頭、link 開頭的 .html)都應該 <link rel="stylesheet" href="pickque-style.css">
   引用這份檔案,頁面自己的 <style> 只保留真的獨有、跟這頁特定畫面綁死的樣式
   (例如某個頁面專屬的版面排列),顏色、字級、卡片、按鈕、彈窗這些共用元件一律
   用這裡定義的 class,不要在個別頁面重新刻一份。

   設計原則:名片(卡片)區域外——淺色背景 + 深色文字,乾淨易讀;
            名片(卡片)區域內——深色背景 + 淺色文字,拉出視覺焦點,
            角色/結餘這類重點數字用高對比亮色標出來。
   ============================================================ */

:root {
  /* 頁面底色 */
  --page-bg: #f5f6f8;
  --page-text: #1a1a1a;
  --page-text-muted: #666666;
  --page-text-faint: #999999;

  /* 淺色卡片(一般資訊卡,不是名冊那種強調用的深色卡) */
  --card-bg: #ffffff;
  --card-border: #ddd;

  /* 深色名片(俱樂部成員清單這類需要視覺焦點的區塊) */
  --dark-card-bg: #1e1e24;
  --dark-card-border: #333842;
  --dark-card-text: #ffffff;
  --dark-card-text-muted: #a0a4ad;

  /* 品牌色 */
  --brand-green: #2f6f4e;
  --accent-blue: #2196F3;
  --accent-orange: #FF9800;

  /* 深色卡片內的強調色 */
  --role-badge-color: #ffd166;   /* 領隊/幹部這類身份標籤 */
  --balance-positive: #06d6a0;   /* 正結餘 */
  --balance-negative: #ff4d4d;   /* 負結餘 */

  /* 淺色卡片內沿用既有的紅綠配色(跟深色卡的亮色系分開,避免在白底上刺眼) */
  --balance-positive-light: #4CAF50;
  --balance-negative-light: #e53935;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', sans-serif;
  background-color: var(--page-bg);
  color: var(--page-text);
  font-size: 16px;
  margin: 0;
  padding: 16px;
  padding-bottom: 76px; /* 幫底部選單留空間 */
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.page-container { background-color: var(--page-bg); color: var(--page-text); }

/* ===================== 淺色卡片(一般資訊卡) ===================== */
.card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* ===================== 深色名片(俱樂部成員清單) ===================== */
.member-card-list {
  background-color: var(--dark-card-bg);
  border-radius: 12px;
  padding: 6px 12px;
  margin-bottom: 14px;
}

.member-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--dark-card-border);
  color: var(--dark-card-text);
  font-size: 15px;
}

.member-item:last-child { border-bottom: none; }

.member-item .avatar {
  width: 26px; height: 26px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
}

.member-item .avatar-fallback {
  width: 26px; height: 26px; border-radius: 50%;
  background: #555a66; color: #fff; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
}

.member-item .name { flex: 1; }
.member-item .name-muted { color: var(--dark-card-text-muted); }

/* 身份標籤(領隊/幹部/會員/臨打)——亮黃色,在深色卡片上仍然清楚可讀 */
.role-badge { color: var(--role-badge-color); font-weight: 700; font-size: 13px; margin-right: 4px; }

/* 結餘數字——正負分開用亮色標,深色卡片專用 */
.balance-positive { color: var(--balance-positive); font-weight: 700; }
.balance-negative { color: var(--balance-negative); font-weight: 700; }

/* 淺色卡片內如果也要顯示結餘(不在深色名片裡),沿用舊的紅綠配色,不要用上面那組亮色
   (在白底上太刺眼、對比度也不對) */
.balance-positive-light { color: var(--balance-positive-light); font-weight: 700; }
.balance-negative-light { color: var(--balance-negative-light); font-weight: 700; }

/* ===================== 按鈕 ===================== */
.btn {
  display: inline-block;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 15px;
  border: none;
  color: #fff;
  cursor: pointer;
  background: var(--balance-positive-light);
}
.btn:disabled { background: #ccc; cursor: default; }
.btn-write { background: var(--accent-blue); }
.btn-write:disabled { background: #90CAF9; }
.btn-danger { background: var(--balance-negative-light); }
.btn-danger:disabled { background: #ef9a9a; }

/* ===================== 表單元件 ===================== */
label { display: block; font-size: 14px; color: var(--page-text-muted); margin: 10px 0 4px; }
label:first-child { margin-top: 0; }
input, select, textarea {
  width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 6px;
  box-sizing: border-box; font-size: 15px; background: #fff; color: var(--page-text);
}
input:disabled, select:disabled, textarea:disabled { background: #f5f5f5; color: #999; }

/* ===================== 彈窗(Modal) ===================== */
.modal-bg {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45); display: flex; align-items: flex-end;
  justify-content: center; z-index: 200;
}
.modal-bg.hidden { display: none; }
.modal {
  background: #fff; border-radius: 16px 16px 0 0; width: 100%; max-width: 520px;
  max-height: 88vh; overflow-y: auto; padding: 0 0 20px;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid #eee; position: sticky; top: 0; background: #fff;
}
.modal-header h3 { margin: 0; font-size: 17px; }
.modal-close { cursor: pointer; font-size: 18px; color: #999; }
.modal-body { padding: 16px 20px; }
.modal-submit-btn {
  display: block; width: calc(100% - 40px); margin: 16px 20px 0; padding: 12px;
  border-radius: 8px; border: none; background: var(--accent-blue); color: #fff;
  font-size: 16px; font-weight: 700; cursor: pointer;
}
.form-error { color: var(--balance-negative-light); font-size: 14px; min-height: 18px; margin: 6px 0; }

/* ===================== 頁籤(頂部大頁籤、內部子頁籤統一長相) =====================
   膠囊式分段按鈕:整排頁籤包在一個有底色的外框裡,選中的那顆是實心品牌綠膠囊。
   不放小圖示(舊頁面如果還留著 <span class="icon">,這裡直接藏起來)。 */
.top-tabs, .tabs {
  display: flex; gap: 4px; padding: 4px; margin-bottom: 14px;
  background: #e6e9ed; border: 1px solid #dde1e6; border-radius: 999px;
}
.top-tab, .tab {
  flex: 1; text-align: center; padding: 8px 4px; border-radius: 999px; border: none;
  color: #5f6670; font-weight: 700; font-size: 15px; cursor: pointer; white-space: nowrap;
  -webkit-tap-highlight-color: transparent; transition: background-color .15s, color .15s;
}
.top-tab.active, .tab.active {
  background: var(--brand-green); color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.top-tab .icon, .tab .icon { display: none; }

/* ===================== 子頁面標題列(左上角返回鍵 + 標題) ===================== */
.sub-header {
  display: flex; align-items: center; gap: 4px; position: sticky; top: 0; z-index: 50;
  background: var(--page-bg); margin: -16px -16px 12px; padding: 10px 8px;
  border-bottom: 1px solid #eceef1;
}
.back-btn {
  width: 40px; height: 40px; border: none; background: transparent; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--page-text);
  -webkit-tap-highlight-color: transparent;
}
.back-btn:active { background: #e4e7eb; }
.sub-title { font-size: 19px; font-weight: 800; color: var(--page-text); }

/* ===================== 底部選單 ===================== */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid #eee;
  display: flex; z-index: 100; padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottom-nav a {
  flex: 1; text-align: center; padding: 8px 0 6px; text-decoration: none;
  color: var(--page-text-faint); font-size: 12px;
}
.bottom-nav a.active { color: var(--balance-positive-light); font-weight: 700; }
.bottom-nav .nav-icon { font-size: 20px; display: block; margin-bottom: 2px; }

/* ===================== 骨架載入畫面 ===================== */
@keyframes skeleton-pulse { 0% { opacity: 1; } 50% { opacity: 0.55; } 100% { opacity: 1; } }
.skeleton-block { background: #e2e2e2; border-radius: 6px; animation: skeleton-pulse 1.2s ease-in-out infinite; height: 16px; margin-bottom: 10px; }

/* ===================== 小工具 class ===================== */
.hidden { display: none !important; }
.status-line { font-size: 14px; color: var(--balance-negative-light); }
.action-btn {
  display: inline-block; padding: 4px 10px; border-radius: 6px; font-size: 13px;
  font-weight: 700; color: #fff; background: var(--brand-green); cursor: pointer; border: none;
}
