/* ─────────────────────────────────────────────────────────────────────────────
   FIFA 2026 BET TRACKER — style.css  (Linear / iOS style)
───────────────────────────────────────────────────────────────────────────── */

:root {
  /* Palette */
  --bg:        #0f0f10;
  --bg2:       #141415;
  --surface:   #1c1c1e;
  --surface2:  #232326;
  --border:    rgba(255,255,255,.08);
  --border2:   rgba(255,255,255,.12);

  --text:      #f5f5f7;
  --text2:     #a1a1aa;
  --text3:     #71717a;

  --accent:    #5e6ad2;   /* Linear purple */
  --accent-bg: rgba(94,106,210,.15);

  --green:     #30d158;
  --green-bg:  rgba(48,209,88,.12);
  --red:       #ff453a;
  --red-bg:    rgba(255,69,58,.12);
  --amber:     #ffd60a;
  --amber-bg:  rgba(255,214,10,.10);
  --blue:      #0a84ff;
  --blue-bg:   rgba(10,132,255,.12);
  --orange:    #ff9f0a;
  --orange-bg: rgba(255,159,10,.12);
  --purple:    #bf5af2;
  --purple-bg: rgba(191,90,242,.12);

  /* Radius */
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  20px;

  /* Type */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;

  /* Safe area */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── TOP NAV ── */
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(15,15,16,.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  padding-top: var(--sat);
}
.topnav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  max-width: 768px;
  margin: 0 auto;
}
.topnav-brand { display: flex; align-items: center; gap: 8px; }
.brand-icon   { font-size: 1.25rem; }
.brand-title  { font-size: 1rem; font-weight: 700; letter-spacing: -.02em; color: var(--text); }
.brand-sub    { font-size: .72rem; color: var(--text3); padding: 2px 7px; background: var(--surface); border-radius: 20px; border: 1px solid var(--border); }

.icon-btn {
  width: 34px; height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all .15s;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:active { background: var(--surface2); color: var(--text); }

/* ── MAIN WRAP ── */
.wrap {
  max-width: 768px;
  margin: 0 auto;
  padding: 16px 16px calc(32px + var(--sab));
}

/* ── STAT CARDS ── */
.stat-section {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  -webkit-tap-highlight-color: transparent;
  font-family: var(--font);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .15s;
}
.stat-card:active::before { opacity: 1; background: rgba(255,255,255,.04); }
.stat-card.active { border-color: var(--accent); }
.stat-card.active::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 2px 2px;
}
.stat-card.green.active  { border-color: var(--green);  }
.stat-card.green.active::after  { background: var(--green); }
.stat-card.red.active    { border-color: var(--red);    }
.stat-card.red.active::after    { background: var(--red); }
.stat-card.amber.active  { border-color: var(--amber);  }
.stat-card.amber.active::after  { background: var(--amber); }
.stat-card.pnl.active    { border-color: var(--accent); }

.sc-val {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card.green .sc-val { color: var(--green); }
.stat-card.red   .sc-val { color: var(--red);   }
.stat-card.amber .sc-val { color: var(--amber); }
.sc-lbl {
  font-size: .6rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text3);
}

/* ── TABS ── */
.tab-scroll { overflow-x: auto; margin-bottom: 14px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.tab-scroll::-webkit-scrollbar { display: none; }
.tabs { display: flex; gap: 4px; padding-bottom: 2px; width: max-content; }
.tab {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  font-family: var(--font);
  font-size: .78rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all .15s;
  -webkit-tap-highlight-color: transparent;
}
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.tab:not(.active):active { background: var(--surface); color: var(--text); }

/* ── SEARCH ── */
.search-wrap {
  position: relative;
  margin-bottom: 16px;
}
.search-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  padding: 10px 40px 10px 38px;
  font-family: var(--font);
  font-size: .9rem;
  outline: none;
  transition: border-color .15s;
  -webkit-appearance: none;
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text3); }
.s-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text3); pointer-events: none;
}
.search-clear {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: var(--surface2); border: none; color: var(--text3);
  width: 20px; height: 20px; border-radius: 50%;
  font-size: .65rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.search-clear.hidden { display: none; }

/* ── PHASE HEADER ── */
.phase-hdr {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text3);
  padding: 18px 4px 8px;
}
.phase-hdr:first-child { padding-top: 4px; }
.matches { display: flex; flex-direction: column; gap: 1px; }

/* ── MATCH ROW (Linear list style) ── */
.match-row {
  background: var(--surface);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: background .1s;
  margin-bottom: 1px;
}
.match-row + .match-row { margin-top: 1px; }

/* first/last in group get rounded corners like a section list */
.matches .match-row:first-child { border-radius: var(--r-md) var(--r-md) var(--r-sm) var(--r-sm); }
.matches .match-row:last-child  { border-radius: var(--r-sm) var(--r-sm) var(--r-md) var(--r-md); }
.matches .match-row:only-child  { border-radius: var(--r-md); }

.match-row.has-bet  { background: var(--bg2); border: 1px solid rgba(94,106,210,.25); }
.match-row.expanded { background: var(--bg2); border: 1px solid rgba(94,106,210,.4); }

/* tap row */
.match-tap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.match-tap:active { background: rgba(255,255,255,.03); }

.match-left { flex: 1; min-width: 0; }

.match-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}
.grp-pill {
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--accent-bg);
  color: var(--accent);
  flex-shrink: 0;
}
.match-date { font-size: .72rem; color: var(--text3); }
.match-venue{ font-size: .68rem; color: var(--text3); margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }

.match-teams-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tm-home { font-size: .92rem; font-weight: 600; flex: 1; text-align: right; }
.tm-sep  {
  font-size: .7rem;
  color: var(--text3);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.tm-away { font-size: .92rem; font-weight: 600; flex: 1; }

.bet-dot-wrap { display: flex; gap: 3px; align-items: center; flex-shrink: 0; }
.bet-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  opacity: .7;
}

.match-chevron {
  color: var(--text3);
  flex-shrink: 0;
  transition: transform .2s;
}
.match-chevron.open { transform: rotate(90deg); }

/* ── BET PANEL ── */
.bet-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height .28s ease;
  border-top: 0 solid var(--border);
}
.bet-panel.open {
  max-height: 1600px;
  border-top-width: 1px;
}

/* period toggle */
.period-toggle {
  display: flex;
  padding: 10px 14px 0;
  gap: 6px;
}
.pt-btn {
  flex: 1;
  padding: 7px 0;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  font-family: var(--font);
  font-size: .76rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  -webkit-tap-highlight-color: transparent;
}
.pt-btn.active {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* period content */
.period-body { display: none; padding: 12px 14px 14px; flex-direction: column; gap: 8px; }
.period-body.active { display: flex; }

/* score row */
.score-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border-radius: var(--r-sm);
  padding: 8px 12px;
}
.score-lbl {
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text3);
  flex: 1;
}
.score-fields { display: flex; align-items: center; gap: 6px; }
.score-inp {
  width: 46px; height: 34px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: .88rem;
  text-align: center;
  outline: none;
  -webkit-appearance: none;
}
.score-inp:focus { border-color: var(--green); }
.score-sep { color: var(--text3); font-weight: 700; font-size: .8rem; }

/* bet type block */
.bt-block {
  background: var(--bg);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.bt-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.bt-summary:active { background: rgba(255,255,255,.02); }

.bt-badge {
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 5px;
  flex-shrink: 0;
}
.badge-1x2  { background: var(--blue-bg);   color: var(--blue);   }
.badge-hcap { background: var(--orange-bg); color: var(--orange); }
.badge-ou   { background: var(--purple-bg); color: var(--purple); }

.bt-status { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.bt-pick-label { font-size: .78rem; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.oc-badge {
  font-size: .62rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  flex-shrink: 0;
}
.oc-win  { background: var(--green-bg);  color: var(--green); }
.oc-loss { background: var(--red-bg);    color: var(--red);   }
.oc-push { background: var(--surface2);  color: var(--text3); }
.oc-pend { background: var(--amber-bg);  color: var(--amber); }

.pnl-tag { font-size: .75rem; font-weight: 600; flex-shrink: 0; }
.pnl-pos { color: var(--green); }
.pnl-neg { color: var(--red);   }

.bt-clear {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: .7rem;
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.bt-clear:active { color: var(--red); }

.bt-chevron { color: var(--text3); transition: transform .2s; flex-shrink: 0; }
.bt-chevron.open { transform: rotate(90deg); }

/* bet fields */
.bt-fields {
  max-height: 0;
  overflow: hidden;
  transition: max-height .22s ease;
}
.bt-fields.open { max-height: 300px; }

.bt-fields-inner {
  padding: 0 12px 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.bt-fields-inner.three { grid-template-columns: 1fr 1fr 1fr; }

.f-group { display: flex; flex-direction: column; gap: 4px; }
.f-lbl {
  font-size: .62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text3);
}

/* shared input / select */
.f-inp, .f-sel {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: .82rem;
  padding: 8px 10px;
  outline: none;
  -webkit-appearance: none;
  transition: border-color .15s;
}
.f-inp:focus, .f-sel:focus { border-color: var(--accent); }
.f-inp::placeholder { color: var(--text3); }
.f-sel {
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2371717a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  cursor: pointer;
}
.f-sel option { background: #1c1c1e; color: var(--text); }

/* colour states for select */
.f-sel.pick-home  { border-color: var(--blue);   color: var(--blue);   }
.f-sel.pick-draw  { border-color: var(--accent);  color: var(--accent); }
.f-sel.pick-away  { border-color: var(--red);     color: var(--red);    }
.f-sel.pick-over  { border-color: var(--purple);  color: var(--purple); }
.f-sel.pick-under { border-color: var(--green);   color: var(--green);  }
.f-sel.pick-set   { border-color: var(--orange);  color: var(--orange); }

/* ── BOTTOM SHEET (export modal) ── */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.sheet-overlay.hidden { display: none; }
.sheet {
  width: 100%;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 12px 16px calc(24px + var(--sab));
  animation: slideUp .25s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.sheet-handle {
  width: 36px; height: 4px;
  border-radius: 2px;
  background: var(--border2);
  margin: 0 auto 16px;
}
.sheet-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text);
}
.sheet-opts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.sheet-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  width: 100%;
  text-align: left;
  font-family: var(--font);
  color: var(--text);
  transition: background .15s;
}
.sheet-opt:active { background: var(--surface2); }
.sheet-opt-icon { font-size: 1.3rem; flex-shrink: 0; }
.sheet-opt-text { flex: 1; }
.sheet-opt-text strong { display: block; font-size: .9rem; font-weight: 600; margin-bottom: 2px; }
.sheet-opt-text span   { font-size: .75rem; color: var(--text3); }
.chevron { color: var(--text3); flex-shrink: 0; }
.sheet-cancel {
  width: 100%;
  padding: 13px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text2);
  font-family: var(--font);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s;
}
.sheet-cancel:active { background: var(--surface2); }

/* ── EMPTY ── */
.empty      { text-align: center; padding: 48px 0; color: var(--text3); }
.empty-icon { font-size: 2.5rem; margin-bottom: 10px; }
.empty-txt  { font-size: .88rem; }

/* ── RESPONSIVE ── */
@media (min-width: 600px) {
  .stat-section { grid-template-columns: repeat(5, 1fr); }
  .bt-fields-inner.three { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 599px) {
  .stat-section { grid-template-columns: repeat(3, 1fr); }
  .stat-card:nth-child(4),
  .stat-card:nth-child(5) { grid-column: span 1; }
  /* Make 5 cards fit: 3 + 2 */
  .stat-section { grid-template-columns: repeat(3, 1fr); }
  .stat-card:nth-child(4) { grid-column: 1 / 2; }
  .stat-card:nth-child(5) { grid-column: 2 / 4; }
  .match-venue { display: none; }
  .bt-fields-inner.three { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 380px) {
  .sc-val { font-size: 1.1rem; }
  .stat-section { grid-template-columns: repeat(2, 1fr); }
  .stat-card:nth-child(5) { grid-column: span 2; }
}
