/* ============================================================
   style.css — Bao-Shuttle Design System v2
   Aesthetic: CloudCourt Neumorphic / Sculpted Minimalism
   CSS 最節約原則：共用狀態統一定義，特殊才疊加
   ============================================================ */

/* ── :root ────────────────────────────────────────────────── */
:root {
  --fs-xs:   calc(10px * 1.0);
  --fs-sm:   calc(10px * 1.1);
  --fs-base: calc(10px * 1.2);
  --fs-md:   calc(10px * 1.3);
  --fs-body: calc(10px * 1.4);
  --fs-lg:   calc(10px * 1.6);
  --fs-xl:   calc(10px * 1.8);
  --fs-2xl:  calc(10px * 2.0);
  --fs-4xl:  calc(10px * 3.2);

  /* Neumorphic shadows */
  --nm-raised:  8px 8px 16px #dadada, -8px -8px 16px #ffffff;
  --nm-inset:   inset 4px 4px 8px #dadada, inset -4px -4px 8px #ffffff;
  --nm-btn:     6px 6px 12px #d1d9e6, -6px -6px 12px #ffffff;
  --nm-sidebar: 8px 8px 16px #dadada, -8px -8px 16px #ffffff;
  --nm-topbar:  0 4px 30px rgba(0,0,0,0.06);
  --nm-float:   0 8px 40px rgba(16,74,240,0.08);

  --tr: 0.2s ease;
  --accent-purple: #7c6fef;
}

/* ── Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'Inter', sans-serif;
  background: #ffffff;
  color: #1a1c1c;
  font-size: var(--fs-body);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

h1,h2,h3,h4,.headline { font-family: 'Plus Jakarta Sans', sans-serif; letter-spacing: -0.02em; }

/* ── Neumorphic Shared Classes ────────────────────────────── */
.nm-raised  { box-shadow: var(--nm-raised); }
.nm-inset   { box-shadow: var(--nm-inset); }
.nm-btn     { box-shadow: var(--nm-btn); }
.nm-btn:active { box-shadow: var(--nm-inset); transform: scale(0.97); }
.nm-float   { box-shadow: var(--nm-float); }

/* ── Layout Shell ─────────────────────────────────────────── */
#sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: 260px;
  background: #f9f9f9;
  box-shadow: var(--nm-sidebar);
  display: flex; flex-direction: column; gap: 0;
  padding: 32px 24px;
  z-index: 50;
  overflow-y: auto;
}

#topbar {
  position: sticky; top: 0; z-index: 40;
  margin-left: 260px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--nm-topbar);
  height: 72px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px;
}

#main-content { margin-left: 260px; padding: 40px 32px; min-height: calc(100vh - 72px); }

/* 未登入狀態：隱藏 sidebar / topbar，main-content 無偏移 */
body:not(.is-auth) #sidebar,
body:not(.is-auth) #topbar { display: none; }
body:not(.is-auth) #main-content { margin-left: 0; padding: 0; min-height: 100vh; display: flex; align-items: center; justify-content: center; }

/* ── Sidebar Nav ─────────────────────────────────────────── */
.sidebar-logo { font-family: 'Plus Jakarta Sans',sans-serif; font-size: var(--fs-2xl); font-weight: 900; color: #1d4ed8; letter-spacing: -0.03em; margin-bottom: 6px; }
.sidebar-sub  { font-size: var(--fs-xs); font-weight: 700; color: #94a3b8; letter-spacing: 0.02em; margin-bottom: 28px; }

.nav-link {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 16px;
  border-radius: 16px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: var(--fs-lg); font-weight: 700;
  color: #64748b;
  cursor: pointer; border: none; background: transparent; width: 100%; text-align: left;
  transition: color var(--tr), transform var(--tr), box-shadow var(--tr);
  margin-bottom: 4px;
}
.nav-link:hover { color: #104af0; transform: translateX(4px); }
.nav-link.active {
  box-shadow: var(--nm-inset);
  color: #104af0; font-weight: 800;
  transform: none;
}

.sidebar-footer { margin-top: auto; padding-top: 20px; }

/* ── Topbar Components ────────────────────────────────────── */
.search-bar {
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--nm-inset);
  border-radius: 9999px;
  padding: 8px 16px;
  background: transparent;
  width: 280px;
}
.search-bar input {
  background: transparent; border: none; outline: none;
  font-family: 'Inter', sans-serif; font-size: var(--fs-body);
  color: #1a1c1c; width: 100%;
}
.search-bar input::placeholder { color: #94a3b8; }

.icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  box-shadow: var(--nm-btn);
  border: none; background: transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #64748b;
  transition: color var(--tr), box-shadow var(--tr);
}
.icon-btn:hover  { color: #104af0; }
.icon-btn:active { box-shadow: var(--nm-inset); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 22px;
  border-radius: 14px !important;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: var(--fs-body); font-weight: 700;
  border: none !important; cursor: pointer;
  transition: box-shadow var(--tr), transform var(--tr), background var(--tr);
}
.btn:active { transform: scale(0.97); }

.btn-primary { background: #104af0; color: #fff; box-shadow: 0 8px 16px rgba(16,74,240,0.25); }
.btn-primary:hover  { box-shadow: 0 12px 28px rgba(16,74,240,0.35); transform: translateY(-1px); }
.btn-primary:active { box-shadow: 0 2px 6px rgba(16,74,240,0.2); transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-ghost { background: #fff; color: #104af0; box-shadow: var(--nm-btn); }

.btn-success { background: #059669; color: #fff; box-shadow: 0 8px 16px rgba(5,150,105,0.25); }
.btn-success:hover  { box-shadow: 0 12px 28px rgba(5,150,105,0.35); transform: translateY(-1px); }
.btn-success:active { box-shadow: 0 2px 6px rgba(5,150,105,0.2); transform: scale(0.98); }

.btn-danger { background: rgba(186,26,26,0.08); color: #ba1a1a; box-shadow: var(--nm-btn); }

.btn-sm { padding: 7px 14px; font-size: var(--fs-base); border-radius: 10px; }

/* ── Form Inputs ─────────────────────────────────────────── */
.nm-input {
  width: 100%; padding: 14px 16px;
  border-radius: 16px !important; border: none !important; outline: none;
  background: transparent;
  box-shadow: var(--nm-inset);
  font-family: 'Inter', sans-serif; font-size: var(--fs-body); color: #1a1c1c;
  transition: box-shadow var(--tr);
}
.nm-input:focus { box-shadow: var(--nm-inset), 0 0 0 2px #104af0; }
.nm-input::placeholder { color: #94a3b8; }

label.form-label { display: block; font-size: var(--fs-sm); font-weight: 700; color: #64748b; margin-bottom: 6px; margin-left: 4px; text-transform: uppercase; letter-spacing: 0.04em; }

select.nm-input { appearance: none; -webkit-appearance: none; cursor: pointer; }

/* ── Password toggle ─────────────────────────────────────── */
.pw-wrap { position: relative; }
.pw-wrap .nm-input { padding-right: 46px; }
.pw-eye {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none !important; cursor: pointer; padding: 4px;
  color: #94a3b8; display: flex; align-items: center;
  transition: color var(--tr);
  z-index: 2;
}
.pw-eye:hover { color: #104af0; }
.pw-eye .material-symbols-outlined { font-size: 20px; }

/* ── Rainbow Status ───────────────────────────────────────── */
/* 共用 badge 基底 */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: 9999px;
  font-size: var(--fs-xs); font-weight: 700;
}
.badge-blue   { background: #dde1ff; color: #0035bd; }
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-red    { background: #ffdad6; color: #ba1a1a; }
.badge-orange { background: #ffd7f3; color: #76546e; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-gray   { background: #f3f4f6; color: #6b7280; }

/* 付款方式圓點 */
.pay-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.pay-linepay { background: #10b981; }
.pay-jieshou { background: #ba1a1a; }
.pay-bank    { background: #104af0; }
.pay-cash    { background: #f59e0b; }

/* 狀態指示點（pulse for active）*/
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot-primary { background: #104af0; animation: pulse 2s infinite; }
.dot-error   { background: #ba1a1a; }
.dot-gray    { background: #9ca3af; }

@keyframes pulse {
  0%,100% { opacity:1; }
  50% { opacity: 0.4; }
}

/* Rainbow border（連續請假警示）*/
.rainbow-border {
  border: 3px solid transparent;
  background-image: linear-gradient(#ffffff,#ffffff),
    linear-gradient(to right, #ba1a1a, #76546e, #104af0);
  background-origin: border-box;
  background-clip: padding-box, border-box;
}

/* Rainbow alert bar */
.rainbow-alert {
  background: linear-gradient(90deg, #104af0, #76546e, #ba1a1a, #104af0);
  background-size: 300% 100%;
  color: #fff;
  animation: shimmer 4s linear infinite;
}
@keyframes shimmer { 0% { background-position:0% 50%; } 100% { background-position:100% 50%; } }

/* ── Cards & Containers ───────────────────────────────────── */
.card { background: #ffffff; border-radius: 32px; padding: 28px; box-shadow: var(--nm-raised); }
.card-inner { background: #f3f3f4; border-radius: 20px; padding: 20px; box-shadow: var(--nm-inset); }

/* ── Player card micro ────────────────────────────────────── */
.player-avatar {
  width: 40px; height: 40px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: var(--fs-lg); font-weight: 800;
}

/* ── Table ────────────────────────────────────────────────── */
.nm-table { width: 100%; text-align: left; border-collapse: separate; border-spacing: 0 12px; }
.nm-table thead th { font-size: var(--fs-xs); font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: 0.1em; padding: 4px 20px; }
.nm-table tbody tr { box-shadow: var(--nm-raised); border-radius: 16px; background: #fff; transition: transform var(--tr); }
.nm-table tbody tr:hover { transform: scale(1.005); }
.nm-table tbody td { padding: 18px 20px; }
.nm-table tbody td:first-child { border-radius: 16px 0 0 16px; }
.nm-table tbody td:last-child  { border-radius: 0 16px 16px 0; }

/* ── Tabs ─────────────────────────────────────────────────── */
.tab-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 28px;
  border-radius: 16px;
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: var(--fs-body); font-weight: 700;
  border: none; cursor: pointer;
  transition: box-shadow var(--tr), color var(--tr), background var(--tr);
}
.tab-btn.active { box-shadow: none; color: #fff; background: #104af0; }
.tab-btn:not(.active) { box-shadow: var(--nm-raised); color: #64748b; background: #fff; }

/* ── Bento Stat Card ──────────────────────────────────────── */
.stat-bento {
  background: #fff;
  border-radius: 20px; padding: 24px;
  box-shadow: var(--nm-raised);
}
.stat-bento.primary-fill { background: linear-gradient(135deg, #104af0, #3b5bd5); color: #fff; }

/* ── Modals ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(26,28,28,0.35); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box {
  background: #fff; border-radius: 32px; padding: 36px;
  width: 100%; max-width: 500px;
  box-shadow: var(--nm-float);
}

/* ── Toast ────────────────────────────────────────────────── */
#toast-wrap { position:fixed; top:20px; right:20px; z-index:300; display:flex; flex-direction:column; gap:8px; }
.toast {
  background: #fff; border-radius: 14px;
  padding: 12px 18px;
  box-shadow: var(--nm-float);
  display: flex; align-items: center; gap: 10px;
  font-size: var(--fs-body); font-weight: 500;
  animation: toastIn 0.2s ease;
  min-width: 220px;
}
.toast-success { border-left: 4px solid #10b981; }
.toast-error   { border-left: 4px solid #ba1a1a; }
.toast-info    { border-left: 4px solid #104af0; }
@keyframes toastIn { from{opacity:0;transform:translateX(16px)} to{opacity:1;transform:translateX(0)} }

/* ── Pagination ───────────────────────────────────────────── */
.pager { display:flex; gap:12px; padding:6px; border-radius:9999px; box-shadow: var(--nm-inset); background:#f3f3f4; }
.pager-btn { width:40px; height:40px; border-radius:50%; border:none; cursor:pointer; font-weight:700; font-family:'Plus Jakarta Sans',sans-serif; transition:box-shadow var(--tr), color var(--tr); background:transparent; color:#64748b; }
.pager-btn.active { box-shadow: var(--nm-btn); background:#fff; color:#104af0; }
.pager-btn:not(.active):hover { color:#104af0; }

/* ── Chart bars ───────────────────────────────────────────── */
.chart-bar { border-radius: 6px 6px 0 0; transition: opacity 0.2s; }
.chart-bar:hover { opacity: 0.75; }

/* ── Utilities ────────────────────────────────────────────── */
.hidden { display: none !important; }
.no-scrollbar::-webkit-scrollbar { display:none; }
.no-scrollbar { -ms-overflow-style:none; scrollbar-width:none; }
.text-primary { color: #104af0; }
.text-muted   { color: #64748b; }
.text-error   { color: #ba1a1a; }
.text-success { color: #065f46; }

/* ── Settings view helpers ────────────────────────────────── */
.gradient-success { background: linear-gradient(135deg, #059669, #047857); }
.panel-warn { background: #fef3c7; border-radius: 16px; padding: 14px 20px; color: #92400e; }
.card-tinted { background: #f3f3f4; }

/* hide number spin buttons in tier inputs */
input[type=number].no-spin::-webkit-inner-spin-button,
input[type=number].no-spin::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number].no-spin { -moz-appearance: textfield; }

/* 移除 date/time input 右側原生瀏覽器 icon */
input[type=date]::-webkit-calendar-picker-indicator,
input[type=time]::-webkit-calendar-picker-indicator { display: none; }

/* 租賃日期預設值灰色（使用者輸入後由 JS 移除 is-default） */
input[type=date].is-default { color: #94a3b8; }

/* ── Login Page ──────────────────────────────────────────── */
body.login-page {
  background: #f9f9f9;
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
}

.login-card {
  background: #ffffff;
  border-radius: 40px;
  padding: 48px 44px;
  width: 100%; max-width: 440px;
  box-shadow: var(--nm-float);
}

.login-logo {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 36px; font-weight: 900;
  color: #104af0; letter-spacing: -0.04em; line-height: 1.1;
}

.login-subtitle {
  font-size: 12px; font-weight: 700;
  color: #94a3b8; letter-spacing: 0.08em; text-transform: uppercase;
}

.login-footer {
  text-align: center; font-size: 11px;
  color: #cbd5e1; margin-top: 32px; font-weight: 500;
}

.err-msg {
  font-size: 13px; font-weight: 600; color: #ba1a1a;
  text-align: center; min-height: 20px;
}

.live-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #10b981; animation: pulse 2s infinite; margin-right: 6px;
}

/* Background decoration blobs */
.deco-blob { position: absolute; border-radius: 50%; }
.deco-blob-tr {
  top: -120px; right: -100px; width: 480px; height: 480px;
  background: radial-gradient(circle, rgba(16,74,240,0.06) 0%, transparent 70%);
}
.deco-blob-bl {
  bottom: -80px; left: -60px; width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(16,74,240,0.04) 0%, transparent 70%);
}

/* ── Inline style 整合（從 admin.html 搬移） ─────────────── */

/* Material Icon filled 變體 */
.icon-filled { font-variation-settings: 'FILL' 1; }

/* Icon 色塊容器（w-12 / w-10 rounded-xl nm-raised） */
.icon-block-green    { background: #d1fae5; color: #059669; }
.icon-block-primary  { background: #dde1ff; color: #104af0; }
.icon-block-tertiary { background: #ffd7f3; color: #76546e; }
.icon-block-green:hover,
.icon-block-primary:hover,
.icon-block-tertiary:hover { transform: scale(1.05); transition: transform var(--tr); }

/* Sessions 右側 hero 漸層 */
.session-hero { background: linear-gradient(135deg, #104af0, #3b5bd5); }

/* 下拉選擇器 wrapper 最小寬度 */
.picker-wrap { min-width: 200px; }

/* 可點擊的 nm-input wrapper（含 date/time 子 input） */
.nm-input-clickable,
.nm-input-clickable input { cursor: pointer; }

/* 歷史區塊分隔線 */
.section-border-top { border-top: 1px solid #eeeeee; }

/* 裝飾性超大 icon */
.icon-deco { font-size: 7rem; }

/* 翠綠 accent 文字（報表數值用） */
.text-emerald { color: #059669; }

/* Sidebar avatar 與 avatar preview 預設底色 */
#sidebar-avatar,
#club-avatar-preview { background: #dde1ff; }

/* 收支概況統計數值色 */
#report-sessions,
#report-players,
#report-monthly-rent { color: #059669; }

/* ── Session Picker (plain select) ───────────────────────── */
.session-picker {
  border: none;
  outline: none;
  background: transparent;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: .875rem;
  color: #1a1c1c;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  max-width: 200px;
}

/* ── Type Circle (月/零 badge) ────────────────────────────── */
.type-circle {
  width: 2.25rem; height: 2.25rem;
  border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 900;
  font-size: .875rem;
  flex-shrink: 0;
  box-shadow: var(--nm-btn);
}
.type-monthly { background: #dde1ff; color: #104af0; }
.type-casual  { background: #ffd7f3; color: #76546e; }

/* ── Birthday Toggle Button ───────────────────────────────── */
.birthday-btn { transition: box-shadow var(--tr), transform var(--tr); }

/* ── Mobile Sidebar ───────────────────────────────────────── */
@media (max-width: 1023px) {
  #sidebar { transform: translateX(-100%); transition: transform 0.25s ease; }
  #sidebar.open { transform: translateX(0); }
  #topbar, #main-content { margin-left: 0; }
  #sidebar-back { display: flex; }
}
#sidebar-back {
  display: none; position: fixed; inset: 0; z-index: 49;
  background: rgba(26,28,28,0.35);
}

/* ── Action buttons (small outline, matches public leave btn style) ── */
.action-btn {
  font-size: .68rem; font-weight: 800;
  border: 1.5px solid; padding: .275rem .7rem;
  border-radius: .5rem; cursor: pointer;
  font-family: inherit; transition: background .15s, color .15s;
  white-space: nowrap; line-height: 1.4;
}
.action-btn-orange { color:#b45309; border-color:#fcd34d; background:#fffbeb; }
.action-btn-orange:hover { background:#fef3c7; }
.action-btn-red    { color:#ba1a1a; border-color:#ffb4ab; background:#fce8e8; }
.action-btn-red:hover { background:#fee2e2; }
.action-btn-blue   { color:#104af0; border-color:#c7d2ff; background:#eef2ff; }
.action-btn-blue:hover { background:#dde1ff; }
.action-btn-gray   { color:#49454f; border-color:#cac4d0; background:#f3f0f7; }
.action-btn-gray:hover { background:#ece6f0; }
.action-btn-green  { color:#1a6b34; border-color:#a5d6b0; background:#e8f5ec; }
.action-btn-green:hover { background:#d4edda; }

/* ── Autocomplete ────────────────────────────────────────────── */
.ac-wrap { position:relative; }
.ac-drop {
  position:absolute; top:calc(100% + 4px); left:0; right:0; z-index:200;
  background:#f0f2f8;
  border-radius:.75rem;
  box-shadow:4px 4px 10px rgba(0,0,0,.08),-4px -4px 10px rgba(255,255,255,.9);
  max-height:200px; overflow-y:auto;
}
.ac-item {
  padding:.55rem 1rem; cursor:pointer;
  font-size:.8125rem; font-family:inherit; font-weight:600;
  border-bottom:1px solid rgba(0,0,0,.04);
}
.ac-item:last-child { border-bottom:none; }
.ac-item:hover { background:#dde1ff; color:#104af0; }
