/* BetStar - Telegram Mini App Styles */
:root {
  --bg-primary: #0f1923;
  --bg-secondary: #1a2d45;
  --bg-card: rgba(255,255,255,0.06);
  --bg-card-hover: rgba(255,255,255,0.1);
  --accent: #3b82f6;
  --accent-glow: rgba(59,130,246,0.3);
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --text-primary: #f0f4ff;
  --text-secondary: rgba(240,244,255,0.6);
  --text-muted: rgba(240,244,255,0.35);
  --border: rgba(255,255,255,0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --nav-height: 68px;
  --header-height: 56px;
  --transition: 0.2s ease;
}

/* Telegram theme integration */
body.tg-dark {
  --bg-primary: var(--tg-theme-bg-color, #0f1923);
  --text-primary: var(--tg-theme-text-color, #f0f4ff);
  --accent: var(--tg-theme-button-color, #3b82f6);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  min-height: 100vh;
  padding-bottom: calc(var(--nav-height) + 12px);
}

/* ===== SPLASH SCREEN ===== */
#splash-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(160deg, #0a1628 0%, #0f2040 40%, #1a0a2e 100%);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  animation: splashFade 0.5s ease 14.5s forwards;
}
#splash-screen .splash-logo {
  width: 100px; height: 100px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: 28px;
  display: flex; align-items: center; justify-content: center;
  font-size: 48px; color: #fff;
  box-shadow: 0 20px 60px rgba(59,130,246,0.4);
  animation: logoPulse 2s ease-in-out infinite;
  margin-bottom: 24px;
}
#splash-screen .splash-title {
  font-size: 32px; font-weight: 800;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}
#splash-screen .splash-subtitle { color: rgba(255,255,255,0.5); font-size: 14px; margin-bottom: 40px; }
#splash-screen .splash-banner {
  width: 280px; height: 120px; object-fit: cover;
  border-radius: 16px; margin-bottom: 40px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
#splash-screen .splash-banner-placeholder {
  width: 280px; height: 120px; border-radius: 16px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.3); font-size: 13px; margin-bottom: 40px;
}
.splash-progress-bar {
  width: 200px; height: 3px; background: rgba(255,255,255,0.1);
  border-radius: 2px; overflow: hidden; margin-bottom: 40px;
}
.splash-progress-fill {
  height: 100%; background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  border-radius: 2px;
  animation: splashProgress 15s linear forwards;
}
.splash-social {
  display: flex; gap: 16px; align-items: center;
  animation: fadeInUp 0.5s ease 2s both;
}
.splash-social a {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.7); font-size: 18px;
  text-decoration: none; transition: all 0.2s;
}
.splash-social a:hover { background: rgba(59,130,246,0.3); color: #fff; }

@keyframes splashFade { to { opacity: 0; pointer-events: none; } }
@keyframes logoPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes splashProgress { from { width: 0; } to { width: 100%; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ===== HEADER ===== */
.app-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-height);
  background: rgba(15,25,35,0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 16px; gap: 12px;
}
.app-header .header-title { font-weight: 700; font-size: 18px; flex: 1; }
.notification-btn { position: relative; }
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.avatar-circle {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #fff; overflow: hidden;
}
.avatar-circle img { width: 100%; height: 100%; object-fit: cover; }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: rgba(10,22,40,0.98);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex; align-items: stretch;
  z-index: 100;
  padding: 0 4px;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px; cursor: pointer;
  color: var(--text-muted); font-size: 10px; font-weight: 500;
  transition: color var(--transition);
  padding: 8px 4px;
  border: none; background: none;
  position: relative;
}
.nav-item i { font-size: 20px; transition: transform 0.2s; }
.nav-item.active { color: var(--accent); }
.nav-item.active i { transform: scale(1.15); }
.nav-item.active::before {
  content: '';
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 28px; height: 3px; border-radius: 0 0 3px 3px;
  background: var(--accent); box-shadow: 0 0 12px var(--accent-glow);
}

/* ===== PAGES ===== */
.page { display: none; padding: 0; animation: pageIn 0.25s ease; }
.page.active { display: block; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-hover { transition: all 0.2s; cursor: pointer; }
.card-hover:hover, .card-hover:active { background: var(--bg-card-hover); transform: translateY(-1px); }

/* ===== MATCH CARD ===== */
.match-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.match-card:hover { border-color: rgba(59,130,246,0.3); background: var(--bg-card-hover); }
.match-card .league-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-muted);
  margin-bottom: 12px;
}
.match-card .teams-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.team-block { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.team-logo {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; overflow: hidden;
}
.team-logo img { width: 100%; height: 100%; object-fit: contain; }
.team-name { font-size: 13px; font-weight: 600; text-align: center; line-height: 1.2; }
.match-vs {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.vs-text { font-size: 12px; color: var(--text-muted); font-weight: 700; }
.match-time { font-size: 11px; color: var(--accent); }
.match-date { font-size: 10px; color: var(--text-muted); }
.odds-row {
  display: flex; gap: 8px; margin-top: 14px;
}
.odds-btn {
  flex: 1; background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 4px; text-align: center;
  cursor: pointer; transition: all 0.2s;
  font-size: 12px;
}
.odds-btn .odds-label { color: var(--text-muted); font-size: 10px; }
.odds-btn .odds-value { color: var(--text-primary); font-weight: 700; font-size: 14px; }
.odds-btn:hover, .odds-btn.selected {
  background: rgba(59,130,246,0.15);
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}
.live-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--danger); border-radius: 20px;
  padding: 2px 8px; font-size: 10px; font-weight: 700;
}
.live-badge::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--danger); animation: livePulse 1s infinite;
}
@keyframes livePulse { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* ===== BET SLIP ===== */
.bet-slip {
  background: linear-gradient(135deg, rgba(59,130,246,0.1), rgba(139,92,246,0.05));
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: var(--radius);
  padding: 20px;
  margin: 12px 16px;
}
.bet-slip h4 { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.stake-input-wrap { position: relative; }
.stake-input-wrap input {
  width: 100%;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 14px 16px 14px 48px;
  font-size: 18px; font-weight: 700; color: #fff;
  outline: none; transition: border-color 0.2s;
}
.stake-input-wrap input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.stake-currency {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  font-weight: 800; color: var(--warning); font-size: 16px;
}
.quick-stakes { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.quick-stake-btn {
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 12px; font-size: 12px; color: var(--text-secondary);
  cursor: pointer; transition: all 0.2s;
}
.quick-stake-btn:hover { background: rgba(59,130,246,0.15); border-color: var(--accent); color: #fff; }
.winnings-display {
  background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.2);
  border-radius: 12px; padding: 16px; margin-top: 16px; text-align: center;
}
.winnings-display .winnings-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.winnings-display .winnings-amount { font-size: 28px; font-weight: 800; color: var(--success); }
.btn-place-bet {
  width: 100%; margin-top: 16px; padding: 16px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border: none; border-radius: 14px; color: #fff;
  font-size: 16px; font-weight: 700; cursor: pointer;
  transition: all 0.2s; letter-spacing: 0.3px;
}
.btn-place-bet:hover { background: linear-gradient(135deg, #60a5fa, #3b82f6); transform: translateY(-1px); }
.btn-place-bet:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ===== WALLET ===== */
.wallet-hero {
  background: linear-gradient(135deg, #1a2d45, #0f2040);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-align: center; margin: 16px;
}
.wallet-balance { font-size: 42px; font-weight: 800; line-height: 1; }
.wallet-currency { font-size: 16px; color: var(--text-muted); margin-top: 4px; }
.wallet-actions { display: flex; gap: 12px; margin-top: 20px; }
.wallet-action-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 8px;
  cursor: pointer; transition: all 0.2s; color: var(--text-primary);
}
.wallet-action-btn i { font-size: 22px; }
.wallet-action-btn span { font-size: 12px; font-weight: 500; }
.wallet-action-btn:hover { background: rgba(59,130,246,0.15); border-color: var(--accent); }

/* ===== TRANSACTION LIST ===== */
.txn-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.txn-item:last-child { border-bottom: none; }
.txn-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
}
.txn-icon.deposit   { background: rgba(16,185,129,0.15); color: var(--success); }
.txn-icon.withdrawal{ background: rgba(239,68,68,0.15);  color: var(--danger); }
.txn-icon.bet       { background: rgba(59,130,246,0.15); color: var(--accent); }
.txn-icon.win       { background: rgba(245,158,11,0.15); color: var(--warning); }
.txn-icon.refund    { background: rgba(139,92,246,0.15); color: #a78bfa; }
.txn-info { flex: 1; }
.txn-desc { font-size: 14px; font-weight: 500; }
.txn-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.txn-amount { font-size: 15px; font-weight: 700; }
.txn-amount.positive { color: var(--success); }
.txn-amount.negative { color: var(--danger); }

/* ===== PROFILE ===== */
.profile-hero {
  background: linear-gradient(135deg, rgba(59,130,246,0.1), rgba(139,92,246,0.1));
  border-bottom: 1px solid var(--border);
  padding: 32px 16px; text-align: center;
}
.profile-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 700; color: #fff;
  margin: 0 auto 16px; overflow: hidden;
  border: 3px solid rgba(59,130,246,0.3);
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-name { font-size: 22px; font-weight: 700; }
.profile-username { font-size: 14px; color: var(--text-muted); margin-top: 4px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--border); }
.stat-item { background: var(--bg-primary); padding: 16px 8px; text-align: center; }
.stat-value { font-size: 20px; font-weight: 700; }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.settings-row {
  display: flex; align-items: center; padding: 14px 16px;
  border-bottom: 1px solid var(--border); cursor: pointer;
  transition: background 0.15s;
}
.settings-row:hover { background: rgba(255,255,255,0.04); }
.settings-row i:first-child { width: 32px; color: var(--accent); }
.settings-row .settings-label { flex: 1; font-size: 15px; }
.settings-row i:last-child { color: var(--text-muted); font-size: 12px; }

/* ===== LEADERBOARD ===== */
.lb-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.lb-rank { width: 28px; text-align: center; font-weight: 700; color: var(--text-muted); font-size: 14px; }
.lb-rank.gold   { color: #f59e0b; }
.lb-rank.silver { color: #94a3b8; }
.lb-rank.bronze { color: #b45309; }
.lb-info { flex: 1; }
.lb-name { font-size: 14px; font-weight: 600; }
.lb-wins { font-size: 12px; color: var(--text-muted); }
.lb-amount { font-size: 15px; font-weight: 700; color: var(--warning); }

/* ===== SECTION HEADERS ===== */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 16px 12px;
}
.section-title { font-size: 18px; font-weight: 700; }
.section-action { font-size: 13px; color: var(--accent); cursor: pointer; }

/* ===== SPORT TABS ===== */
.sport-tabs {
  display: flex; gap: 8px; overflow-x: auto; padding: 0 16px 12px;
  scrollbar-width: none;
}
.sport-tabs::-webkit-scrollbar { display: none; }
.sport-tab {
  flex-shrink: 0; display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 20px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); color: var(--text-secondary);
  cursor: pointer; transition: all 0.2s; white-space: nowrap; background: none;
}
.sport-tab.active {
  background: rgba(59,130,246,0.15); border-color: var(--accent); color: var(--accent);
}

/* ===== MODAL ===== */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  align-items: flex-end; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-sheet {
  width: 100%; max-width: 480px;
  background: #0f1d30; border-radius: 24px 24px 0 0;
  padding: 8px 0 32px; max-height: 92vh; overflow-y: auto;
  animation: sheetUp 0.3s ease;
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-handle {
  width: 36px; height: 4px; border-radius: 2px;
  background: rgba(255,255,255,0.2); margin: 8px auto 16px;
}
.modal-title { font-size: 18px; font-weight: 700; padding: 0 20px 16px; }

/* ===== UTILITIES ===== */
.page-content { padding: 0 16px; }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger)  !important; }
.text-warning { color: var(--warning) !important; }
.text-muted   { color: var(--text-muted) !important; }
.fw-bold { font-weight: 700; }
.fs-sm { font-size: 12px; }
.fs-xs { font-size: 11px; }
.mt-2 { margin-top: 8px; }
.mb-2 { margin-bottom: 8px; }
.p-4 { padding: 16px; }
.badge-status {
  display: inline-block; font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 20px;
}
.badge-pending  { background: rgba(245,158,11,0.15); color: var(--warning); border: 1px solid rgba(245,158,11,0.3); }
.badge-won      { background: rgba(16,185,129,0.15); color: var(--success); border: 1px solid rgba(16,185,129,0.3); }
.badge-lost     { background: rgba(239,68,68,0.15);  color: var(--danger);  border: 1px solid rgba(239,68,68,0.3); }
.badge-refunded { background: rgba(139,92,246,0.15); color: #a78bfa;       border: 1px solid rgba(139,92,246,0.3); }
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--text-muted);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; display: block; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 12px; font-size: 15px; font-weight: 600;
  cursor: pointer; border: none; transition: all 0.2s;
}
.btn-primary { background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: #fff; }
.btn-success { background: linear-gradient(135deg, #10b981, #059669); color: #fff; }
.btn-danger  { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-primary); }
.btn-full { width: 100%; }
.input-field {
  width: 100%; background: rgba(255,255,255,0.06);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; font-size: 16px; color: #fff; outline: none;
  transition: border-color 0.2s;
}
.input-field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.input-label { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; display: block; }
.form-group { margin-bottom: 16px; }
.toggle-switch {
  position: relative; width: 50px; height: 26px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; cursor: pointer;
  background: rgba(255,255,255,0.15); border-radius: 26px; transition: 0.3s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 20px; height: 20px; border-radius: 50%;
  left: 3px; top: 3px; background: #fff; transition: 0.3s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(24px); }
.loading-spinner {
  width: 32px; height: 32px; border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  background: #1e3a5f; border: 1px solid rgba(59,130,246,0.3);
  border-radius: 12px; padding: 12px 20px;
  color: #fff; font-size: 14px; font-weight: 500;
  z-index: 9000; animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  max-width: 320px; text-align: center;
}
.toast.error { background: #3f1515; border-color: rgba(239,68,68,0.3); }
.toast.success { background: #0d3a2a; border-color: rgba(16,185,129,0.3); }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(-12px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(-50%) translateY(-12px); } }
