/* BNI Prestige Network Director — 設計系統（玻璃擬態）
   來源：stitch_bni_elite_visitor_system/prestige_network_director/DESIGN.md */

@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700;800&family=Inter:wght@400;500;600;700&family=Noto+Sans+TC:wght@400;500;600;700;800&family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0&display=swap");

:root {
  --primary: #c42140;
  --primary-dark: #8b132a;
  --secondary: #154559;
  --accent: #e3b06b;
  --bg: #fdfbfb;
  --surface: rgba(255, 255, 255, 0.75);
  --on-surface: #1b1c1c;
  --on-surface-variant: #5a4041;
  --outline: rgba(21, 69, 89, 0.2);
  --glass-shadow: 0 16px 40px rgba(139, 19, 42, 0.08);
  --radius-card: 24px;
  --radius-btn: 16px;
  --sidebar-w: 280px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", "Noto Sans TC", system-ui, sans-serif;
  color: var(--on-surface);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse at 12% 0%, rgba(227, 176, 107, 0.14), transparent 45%),
    radial-gradient(ellipse at 100% 10%, rgba(196, 33, 64, 0.10), transparent 40%),
    radial-gradient(ellipse at 50% 100%, rgba(21, 69, 89, 0.08), transparent 55%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display, .headline {
  font-family: "Outfit", "Noto Sans TC", sans-serif;
  letter-spacing: -0.01em;
  margin: 0;
}

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  margin: 0 0 4px;
}

.material-symbols-outlined {
  font-family: "Material Symbols Outlined";
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  vertical-align: middle;
  user-select: none;
}

/* ---------- 版型：側邊欄 + 主內容 ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--secondary);
  color: #eaf2f6;
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .brand {
  font-family: "Outfit", sans-serif;
  font-weight: 800;
  font-size: 20px;
  color: #fff;
  padding: 0 10px 18px;
  line-height: 1.2;
}
.sidebar .brand small { display: block; font-size: 12px; font-weight: 500; color: var(--accent); letter-spacing: .1em; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  color: #cfe0e8;
  cursor: pointer;
  font-weight: 500;
  font-size: 15px;
  border: none; background: transparent; width: 100%; text-align: left;
  position: relative;
  transition: background .2s, color .2s;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(196,33,64,.30), rgba(196,33,64,.05));
  color: #fff;
}
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 4px; border-radius: 4px; background: var(--primary);
}
.sidebar .spacer { flex: 1; }

.main {
  flex: 1;
  padding: 32px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 30px; font-weight: 700; }
.page-head p { color: var(--on-surface-variant); margin: 6px 0 0; }

/* ---------- 玻璃卡片 ---------- */
.glass-card {
  background: var(--surface);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border-top: 1px solid rgba(255,255,255,1);
  border-left: 1px solid rgba(255,255,255,1);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-card);
  padding: 24px;
}

.grid { display: grid; gap: 24px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- 統計卡 ---------- */
.stat-card .label { font-size: 13px; color: var(--on-surface-variant); }
.stat-card .value { font-family: "Outfit"; font-size: 34px; font-weight: 800; margin-top: 6px; }
.stat-card .value.red { color: var(--primary); }
.stat-card .value.blue { color: var(--secondary); }
.stat-card .value.gold { color: #b9842f; }

/* ---------- 按鈕 ---------- */
.btn {
  font-family: inherit; font-weight: 600; font-size: 15px;
  border-radius: var(--radius-btn); padding: 12px 22px;
  border: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  transition: transform .15s, box-shadow .2s, background .2s;
}
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border-top: 1px solid rgba(255,255,255,.4);
  box-shadow: 0 4px 12px rgba(139,19,42,.2);
}
.btn-primary:hover { transform: translateY(-2px); }
.btn-ghost { background: rgba(196,33,64,.06); color: var(--primary); }
.btn-ghost:hover { background: rgba(196,33,64,.12); }
.btn-outline { background: transparent; border: 1px solid var(--outline); color: var(--secondary); }

/* ---------- 表單 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.field label { font-size: 14px; color: var(--on-surface-variant); font-weight: 500; }
.input, select.input, textarea.input {
  width: 100%;
  background: rgba(255,255,255,.55);
  border: 1px solid var(--outline);
  border-radius: 12px;
  padding: 11px 14px;
  font-family: inherit; font-size: 15px; color: var(--on-surface);
  transition: border-color .2s, box-shadow .2s;
}
.input:focus, select.input:focus, textarea.input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(196,33,64,.15);
}
textarea.input { resize: vertical; min-height: 84px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 8px; }
.col-span-2 { grid-column: 1 / -1; }

/* ---------- 標籤 / 膠囊 ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.chip-gold { background: rgba(227,176,107,.22); color: #8a5a12; }
.chip-blue { background: rgba(21,69,89,.12); color: var(--secondary); }
.chip-red  { background: rgba(196,33,64,.12); color: var(--primary); }
.chip-gray { background: rgba(90,64,65,.1); color: var(--on-surface-variant); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left; padding: 12px 14px; color: var(--on-surface-variant);
  font-weight: 600; font-size: 12px; letter-spacing: .04em; text-transform: uppercase;
  border-bottom: 1px solid rgba(21,69,89,.12);
}
table.data td { padding: 14px; border-bottom: 1px solid rgba(21,69,89,.08); }
table.data tr:hover td { background: rgba(255,255,255,.4); }

/* ---------- 雜項 ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--secondary); color: #fff; padding: 12px 22px; border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); z-index: 100; opacity: 0;
  transition: opacity .3s, transform .3s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.hidden { display: none !important; }

/* ---------- Modal ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: grid; place-items: center; padding: 16px;
}
.modal { width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.icon-btn {
  background: rgba(196,33,64,.06); color: var(--primary); border: none; cursor: pointer;
  border-radius: 12px; width: 38px; height: 38px; display: grid; place-items: center;
}
.flag { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--on-surface-variant); cursor: pointer; }
.link-btn { background: none; border: none; color: var(--primary); cursor: pointer; font: inherit; font-weight: 600; padding: 6px 10px; }
.view { display: none; }
.view.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px);} to {opacity:1; transform:none;} }

/* ---------- 登入頁 ---------- */
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 420px; }
.login-error { color: var(--primary); font-size: 14px; }

/* ---------- 平板中間尺寸：窄側欄、內容更寬 ---------- */
@media (min-width: 881px) and (max-width: 1100px) {
  :root { --sidebar-w: 212px; }
  .sidebar { padding: 22px 12px; }
  .sidebar .brand { font-size: 18px; padding: 0 8px 16px; }
  .nav-item { padding: 10px 12px; font-size: 14px; gap: 10px; }
  .main { padding: 24px; }
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- 手機版頂列 + 漢堡抽屜（桌機隱藏）---------- */
.mobile-topbar { display: none; }
.drawer-backdrop { display: none; }

/* ---------- RWD ---------- */
@media (max-width: 880px) {
  /* 頂列：漢堡 + 品牌 */
  .mobile-topbar {
    display: flex; align-items: center; gap: 12px;
    position: sticky; top: 0; z-index: 80;
    background: var(--secondary); color: #fff;
    padding: 12px 16px;
    box-shadow: 0 4px 16px rgba(21,69,89,.25);
  }
  .hamburger {
    background: rgba(255,255,255,.14); border: none; color: #fff;
    width: 42px; height: 42px; border-radius: 12px; cursor: pointer;
    display: grid; place-items: center; flex-shrink: 0;
  }
  .hamburger:active { background: rgba(255,255,255,.28); }
  .mobile-brand { font-family: "Outfit", sans-serif; font-weight: 800; font-size: 17px; }

  .app-shell { flex-direction: column; }

  /* 側邊欄改為左側滑入抽屜 */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    height: 100vh; width: 270px; max-width: 82vw;
    transform: translateX(-100%);
    transition: transform .3s cubic-bezier(.4, 0, .2, 1);
    z-index: 95;
    flex-direction: column; flex-wrap: nowrap; gap: 6px;
    box-shadow: 0 0 48px rgba(0,0,0,.35);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar .brand { width: auto; padding-bottom: 18px; }
  .sidebar .spacer { display: block; flex: 1; }
  .nav-item { width: 100%; }

  /* 抽屜背景遮罩 */
  .drawer-backdrop.show {
    display: block; position: fixed; inset: 0; z-index: 90;
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  }

  .main { padding: 18px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
