/* ============================================================
   BetViper — استایل Mini App
   تم: تاریک، اسپرت، با لهجه‌ی سبز نئونی چمن
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;700;800&family=Manrope:wght@600;800&display=swap');

:root {
    --bg:          #0a0e0d;
    --surface:     #121817;
    --surface-2:   #1a2321;
    --border:      #243029;
    --text:        #e8f0ec;
    --text-dim:    #8a9a92;
    --accent:      #2dd673;
    --accent-dim:  #1c9b52;
    --accent-glow: rgba(45, 214, 115, 0.25);
    --danger:      #ff5a6e;
    --gold:        #ffd23f;
    --radius:      16px;
    --radius-sm:   10px;
    --shadow:      0 8px 32px rgba(0, 0, 0, 0.4);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Vazirmatn', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
}

body {
    background-image:
        radial-gradient(circle at 20% 0%, rgba(45, 214, 115, 0.08), transparent 45%),
        radial-gradient(circle at 90% 100%, rgba(28, 155, 82, 0.06), transparent 40%);
    min-height: 100vh;
}

#app {
    max-width: 520px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 76px;
}

/* ---------- هدر ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    background: rgba(10, 14, 13, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 9px; }
.brand-mark { font-size: 22px; }
.brand-name {
    font-family: 'Manrope', sans-serif;
    font-weight: 800;
    font-size: 19px;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--accent), #7af0a8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.balance {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 7px 14px;
    border-radius: 100px;
    font-weight: 700;
    font-size: 15px;
}
.balance-icon { color: var(--gold); }

/* ---------- محتوا ---------- */
.view { flex: 1; padding: 18px; animation: fadeUp 0.4s ease; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.section-title {
    font-family: 'Manrope', sans-serif;
    font-weight: 800;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-dim);
    margin-bottom: 14px;
}

/* ---------- کارت مسابقه ---------- */
.match-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
    transition: border-color 0.2s, transform 0.15s;
}
.match-card:active { transform: scale(0.99); }

.match-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 12px;
}
.match-league { font-weight: 700; color: var(--accent); }

.match-teams {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}
.team { flex: 1; font-weight: 700; font-size: 15px; }
.team.away { text-align: left; }
.vs { color: var(--text-dim); font-size: 12px; font-weight: 700; }

.odds-row { display: flex; gap: 8px; }
.odd-btn {
    flex: 1;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px 6px;
    color: var(--text);
    font-family: inherit;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
}
.odd-btn:active { transform: scale(0.96); }
.odd-btn .odd-label { display: block; font-size: 10px; color: var(--text-dim); margin-bottom: 3px; }
.odd-btn .odd-value { display: block; font-weight: 800; font-size: 16px; color: var(--accent); }
.odd-btn:hover { border-color: var(--accent-dim); }

/* ---------- لیست عمومی ---------- */
.list-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.list-card .sub { font-size: 12px; color: var(--text-dim); margin-top: 3px; }

.badge {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 100px;
}
.badge.pending { background: rgba(255, 210, 63, 0.15); color: var(--gold); }
.badge.won     { background: var(--accent-glow); color: var(--accent); }
.badge.lost    { background: rgba(255, 90, 110, 0.15); color: var(--danger); }

/* ---------- رده‌بندی ---------- */
.rank-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}
.rank-num {
    width: 28px; height: 28px;
    display: grid; place-items: center;
    border-radius: 50%;
    font-weight: 800;
    font-size: 13px;
    background: var(--surface-2);
}
.rank-row:nth-child(1) .rank-num { background: linear-gradient(135deg, #ffd23f, #ff9f1c); color: #000; }
.rank-row:nth-child(2) .rank-num { background: linear-gradient(135deg, #d8d8d8, #a0a0a0); color: #000; }
.rank-row:nth-child(3) .rank-num { background: linear-gradient(135deg, #cd7f32, #a05a2c); color: #000; }
.rank-name { flex: 1; font-weight: 600; }
.rank-points { font-weight: 800; color: var(--accent); }

/* ---------- نوار پایین ---------- */
.tabbar {
    position: fixed;
    bottom: 0; left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 520px;
    display: flex;
    background: rgba(18, 24, 23, 0.92);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    z-index: 20;
}
.tab {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-dim);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: color 0.2s;
}
.tab .tab-icon { font-size: 19px; }
.tab.active { color: var(--accent); }

/* ---------- لودر ---------- */
.loader { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 60px 0; color: var(--text-dim); }
.spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty { text-align: center; padding: 50px 20px; color: var(--text-dim); }
.empty-icon { font-size: 44px; opacity: 0.4; margin-bottom: 12px; }

/* ---------- مودال ---------- */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: grid; place-items: end center;
    z-index: 50;
    animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px 24px 0 0;
    width: 100%;
    max-width: 520px;
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
    position: relative;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-close {
    position: absolute; top: 16px; left: 16px;
    width: 30px; height: 30px;
    border: none; border-radius: 50%;
    background: var(--surface-2); color: var(--text);
    font-size: 20px; cursor: pointer;
}
.modal h3 { font-size: 18px; margin-bottom: 6px; }
.modal .modal-sub { color: var(--text-dim); font-size: 13px; margin-bottom: 18px; }

.stake-input {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    color: var(--text);
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 14px;
}
.stake-input:focus { outline: none; border-color: var(--accent); }

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--accent), var(--accent-dim));
    color: #04140b;
    border: none;
    border-radius: var(--radius-sm);
    padding: 15px;
    font-family: inherit;
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    box-shadow: 0 6px 20px var(--accent-glow);
    transition: transform 0.15s;
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.pick-pills { display: flex; gap: 8px; margin-bottom: 16px; }
.pick-pill {
    flex: 1;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 6px;
    color: var(--text);
    font-family: inherit;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
}
.pick-pill.selected {
    border-color: var(--accent);
    background: var(--accent-glow);
    color: var(--accent);
}
.pick-pill .pp-label { display: block; font-size: 11px; color: var(--text-dim); }
.pick-pill.selected .pp-label { color: var(--accent); }
.pick-pill .pp-odd { display: block; font-weight: 800; margin-top: 3px; }

/* ---------- توست ---------- */
.toast {
    position: fixed;
    bottom: 90px; left: 50%;
    transform: translateX(-50%);
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 20px;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 600;
    z-index: 100;
    box-shadow: var(--shadow);
    animation: toastIn 0.3s;
}
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.success { border-color: var(--accent); color: var(--accent); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
