/* ============================================================
   Design Contract — Ballers Club Prototype
   style: industrial-minimal · 欧美简约工业风
   aesthetic: restrained / editorial / high information clarity
   ============================================================ */

/* ---------- Design Tokens ---------- */
:root {
  /* Colors */
  --c-primary: #0d5c36;          /* 台球桌绿 */
  --c-primary-dark: #0a4429;
  --c-primary-light: #1a7a4a;
  --c-black: #111111;
  --c-dark: #1f2933;
  --c-gray-1: #3c4858;
  --c-gray-2: #6b7280;
  --c-gray-3: #9ca3af;
  --c-gray-4: #d1d5db;
  --c-gray-5: #e5e7eb;
  --c-gray-6: #f4f4f5;
  --c-surface: #ffffff;
  --c-bg: #fafafa;
  --c-danger: #dc2626;
  --c-warning: #d97706;
  --c-success: #059669;

  /* Typography */
  --font-display: -apple-system, "SF Pro Display", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  --font-body: -apple-system, "SF Pro Text", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  --scale-xs: 11px;
  --scale-sm: 13px;
  --scale-md: 15px;
  --scale-lg: 17px;
  --scale-xl: 20px;
  --scale-2xl: 24px;
  --scale-3xl: 28px;

  /* Spacing (4px base) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;

  /* Radius */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-full: 999px;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(17,17,17,.06);
  --shadow-md: 0 4px 12px rgba(17,17,17,.08);
  --shadow-lg: 0 8px 24px rgba(17,17,17,.1);

  /* Icon */
  --icon-s: 16px;
  --icon-m: 20px;
  --icon-l: 24px;
  --stroke-w: 1.8;

  /* Layout */
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
  --tabbar-h: 64px;
  --header-h: 52px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  font-family: var(--font-body);
  font-size: var(--scale-md);
  color: var(--c-dark);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  overscroll-behavior: none;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; outline: none; border: none; }
img { display: block; max-width: 100%; }
ul, ol { list-style: none; }

/* ---------- Phone Frame (prototype container) ---------- */
.phone {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--c-bg);
  position: relative;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom));
}

/* ---------- SVG Reset ---------- */
svg {
  display: inline-block;
  vertical-align: middle;
  width: 20px;
  height: 20px;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
/* Sizes - override with inline style or specific parent selector */
svg.icon-s { width: 16px; height: 16px; }
svg.icon-m { width: 20px; height: 20px; }
svg.icon-l { width: 24px; height: 24px; }
svg.icon-xl { width: 28px; height: 28px; }

/* ---------- Header ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-gray-5);
  height: calc(var(--header-h) + var(--safe-top));
  padding-top: var(--safe-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: var(--s-4);
  padding-right: var(--s-4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.header .title {
  font-size: var(--scale-lg);
  font-weight: 600;
  color: var(--c-black);
  letter-spacing: -0.01em;
}
.header .icon-btn {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-full);
  color: var(--c-gray-1);
  transition: background .15s;
}
.header .icon-btn svg { width: 22px; height: 22px; }
.header .icon-btn:active { background: var(--c-gray-6); }
.header .left, .header .right { display: flex; gap: var(--s-1); }

/* Search bar in header */
.search-bar {
  flex: 1;
  margin: 0 var(--s-3);
  height: 36px;
  background: var(--c-gray-6);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  padding: 0 var(--s-3);
  gap: var(--s-2);
  color: var(--c-gray-3);
  font-size: var(--scale-sm);
}
.search-bar input {
  flex: 1;
  background: none;
  font-size: var(--scale-sm);
  color: var(--c-dark);
}

/* ---------- Tab Bar (bottom nav) ---------- */
.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 430px;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--c-surface);
  border-top: 1px solid var(--c-gray-5);
  display: flex;
  z-index: 200;
}
.tabbar .tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--c-gray-3);
  font-size: var(--scale-xs);
  font-weight: 500;
  transition: color .15s;
  padding-top: 4px;
  position: relative;
}
.tabbar .tab.active { color: var(--c-primary); font-weight: 600; }
.tabbar .tab.active::after {
  content: '';
  position: absolute;
  top: 6px;
  width: 20px;
  height: 2px;
  background: var(--c-primary);
  border-radius: 2px;
}
.tabbar .tab svg {
  width: 24px; height: 24px;
  stroke-width: var(--stroke-w);
  transition: stroke-width .15s;
}
.tabbar .tab.active svg {
  stroke-width: 2.2;
}

/* ---------- Content padding ---------- */
.content { padding: var(--s-4); }
.content-no-pad { padding: 0; }

/* ---------- Cards ---------- */
.card {
  background: var(--c-surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-padded { padding: var(--s-4); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  height: 44px;
  padding: 0 var(--s-5);
  border-radius: var(--r-md);
  font-size: var(--scale-md);
  font-weight: 600;
  transition: transform .1s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn-primary {
  background: var(--c-black);
  color: #fff;
}
.btn-outline {
  border: 1.5px solid var(--c-black);
  color: var(--c-black);
  background: transparent;
}
.btn-ghost {
  color: var(--c-gray-1);
  background: var(--c-gray-6);
}
.btn-green {
  background: var(--c-primary);
  color: #fff;
}
.btn-sm { height: 34px; padding: 0 var(--s-3); font-size: var(--scale-sm); border-radius: var(--r-sm); }
.btn-block { width: 100%; }

/* ---------- Badges / Tags ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--r-full);
  font-size: var(--scale-xs);
  font-weight: 500;
  background: var(--c-gray-6);
  color: var(--c-gray-1);
}
.tag-green { background: rgba(13,92,54,.1); color: var(--c-primary); }
.tag-dark { background: var(--c-black); color: #fff; }
.tag-outline { background: transparent; border: 1px solid var(--c-gray-4); color: var(--c-gray-1); }

/* ---------- Utility ---------- */
.divider { height: 1px; background: var(--c-gray-5); }
.safe-bottom { padding-bottom: var(--safe-bottom); }
.row { display: flex; align-items: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.col { display: flex; flex-direction: column; }
.col-center { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gap-1 { gap: var(--s-1); }
.gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); }
.text-sm { font-size: var(--scale-sm); }
.text-xs { font-size: var(--scale-xs); }
.text-lg { font-size: var(--scale-lg); }
.text-xl { font-size: var(--scale-xl); }
.text-2xl { font-size: var(--scale-2xl); }
.text-gray { color: var(--c-gray-2); }
.text-gray-light { color: var(--c-gray-3); }
.text-primary { color: var(--c-primary); }
.text-black { color: var(--c-black); font-weight: 600; }
.font-bold { font-weight: 600; }
.font-medium { font-weight: 500; }
.mt-1 { margin-top: var(--s-1); }
.mt-2 { margin-top: var(--s-2); }
.mt-3 { margin-top: var(--s-3); }
.mt-4 { margin-top: var(--s-4); }
.mt-6 { margin-top: var(--s-6); }
.mb-2 { margin-bottom: var(--s-2); }
.mb-3 { margin-bottom: var(--s-3); }
.mb-4 { margin-bottom: var(--s-4); }
.flex-1 { flex: 1; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Page Load Animation ---------- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-in > * {
  animation: fadeInUp .35s ease-out both;
}
.animate-in > *:nth-child(1) { animation-delay: .02s; }
.animate-in > *:nth-child(2) { animation-delay: .06s; }
.animate-in > *:nth-child(3) { animation-delay: .10s; }
.animate-in > *:nth-child(4) { animation-delay: .14s; }
.animate-in > *:nth-child(5) { animation-delay: .18s; }
.animate-in > *:nth-child(6) { animation-delay: .22s; }
.animate-in > *:nth-child(7) { animation-delay: .26s; }
.animate-in > *:nth-child(8) { animation-delay: .30s; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  background: rgba(17,17,17,.92);
  color: #fff;
  padding: var(--s-3) var(--s-5);
  border-radius: var(--r-md);
  font-size: var(--scale-sm);
  z-index: 9999;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.toast.show { opacity: 1; }

/* ---------- Modal / Bottom Sheet ---------- */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17,17,17,.4);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.backdrop.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  bottom: 0;
  width: 100%;
  max-width: 430px;
  background: var(--c-surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  z-index: 301;
  transition: transform .3s cubic-bezier(.32,.72,0,1);
  padding: var(--s-4);
  padding-bottom: calc(var(--s-4) + var(--safe-bottom));
  max-height: 80vh;
  overflow-y: auto;
}
.sheet.show { transform: translateX(-50%) translateY(0); }
.sheet-handle {
  width: 36px; height: 4px;
  background: var(--c-gray-4);
  border-radius: 2px;
  margin: 0 auto var(--s-4);
}

/* ---------- Segmented Control ---------- */
.segmented {
  display: flex;
  background: var(--c-gray-6);
  border-radius: var(--r-md);
  padding: 3px;
  gap: 2px;
}
.segmented .seg {
  flex: 1;
  padding: var(--s-2) var(--s-3);
  text-align: center;
  font-size: var(--scale-sm);
  font-weight: 500;
  color: var(--c-gray-2);
  border-radius: var(--r-sm);
  transition: all .15s;
}
.segmented .seg.active {
  background: var(--c-surface);
  color: var(--c-black);
  box-shadow: var(--shadow-sm);
}

/* Scrollbar hide */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
