/* ═══════════════════════════════════════════════════
   Game Top-Up WebApp — Dark Glassmorphism Theme
   PAYSTARS uslubida — transparent, yorqin, premium
   ═══════════════════════════════════════════════════ */

:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #101624;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --bg-glass: rgba(16, 22, 36, 0.7);
    --border: rgba(255, 255, 255, 0.08);
    --border-active: rgba(0, 180, 255, 0.4);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.55);
    --text-muted: rgba(255, 255, 255, 0.3);
    --accent: #00b4ff;
    --accent-dark: #0066ff;
    --accent-gradient: linear-gradient(135deg, #00b4ff, #0066ff);
    --success: #00e676;
    --warning: #ffab40;
    --danger: #ff5252;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 8px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --nav-height: 70px;
    --header-height: 60px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100%;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

body {
    background: linear-gradient(180deg, #0a0e1a 0%, #0d1222 50%, #101830 100%);
}

#app {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* ─── Header ──────────────────────────────────────── */

.header {
    height: var(--header-height);
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(10, 14, 26, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: white;
}

.header-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.balance-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 100px;
    backdrop-filter: blur(10px);
}

.balance-icon {
    font-size: 14px;
}

.balance-amount {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.balance-currency {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.balance-add {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent-gradient);
    border: none;
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.balance-add:active {
    transform: scale(0.9);
}

/* ─── Main ────────────────────────────────────────── */

.main {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: var(--nav-height);
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* ─── Pages ───────────────────────────────────────── */

.page {
    display: none;
    padding: 16px;
    animation: fadeIn 0.25s ease;
    min-height: calc(100vh - var(--header-height) - var(--nav-height));
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── Banner ──────────────────────────────────────── */

.banner {
    position: relative;
    padding: 24px 20px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, rgba(0, 102, 255, 0.2), rgba(0, 180, 255, 0.1));
    border: 1px solid rgba(0, 180, 255, 0.15);
    overflow: hidden;
    margin-bottom: 20px;
}

.banner-title {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 4px;
    position: relative;
    z-index: 1;
}

.banner-text {
    font-size: 13px;
    color: var(--text-secondary);
    position: relative;
    z-index: 1;
}

.banner-glow {
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 180, 255, 0.15), transparent 70%);
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* ─── Section title ───────────────────────────────── */

.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-left: 2px;
}

/* ─── Games Grid ──────────────────────────────────── */

.games-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.game-card {
    position: relative;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.25s ease;
    overflow: hidden;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.game-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 180, 255, 0.05), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.game-card:active {
    transform: scale(0.97);
    border-color: var(--border-active);
}

.game-card:active::before {
    opacity: 1;
}

.game-card-img {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    object-fit: cover;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.game-card-name {
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    color: var(--text-primary);
}

.game-card-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 9px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(0, 230, 118, 0.15);
    color: var(--success);
    border: 1px solid rgba(0, 230, 118, 0.2);
}

/* ─── Game Detail ─────────────────────────────────── */

.back-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 0;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font);
}

.game-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

.game-detail-img {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    object-fit: cover;
}

.game-detail-name {
    font-size: 20px;
    font-weight: 700;
}

.game-detail-badge {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(0, 230, 118, 0.12);
    color: var(--success);
    font-weight: 600;
}

/* ─── Category tabs ───────────────────────────────── */

.category-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar {
    display: none;
}

.cat-tab {
    flex-shrink: 0;
    padding: 8px 16px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
    white-space: nowrap;
}

.cat-tab.active {
    background: var(--accent-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 12px rgba(0, 180, 255, 0.3);
}

/* ─── Products Grid ───────────────────────────────── */

.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.product-card {
    padding: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    backdrop-filter: blur(10px);
}

.product-card:active {
    transform: scale(0.97);
    border-color: var(--border-active);
    background: var(--bg-card-hover);
}

.product-name {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
    line-height: 1.3;
}

.product-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
}

.product-price-label {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ─── Order page ──────────────────────────────────── */

.order-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    backdrop-filter: blur(10px);
}

.order-product-info {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.order-product-name {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.order-product-price {
    font-size: 20px;
    font-weight: 800;
    color: var(--accent);
}

.form-group {
    margin-bottom: 14px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    font-size: 16px;
    font-family: var(--font);
    font-weight: 500;
    outline: none;
    transition: border-color 0.2s;
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 180, 255, 0.1);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: rgba(0, 230, 118, 0.08);
    border: 1px solid rgba(0, 230, 118, 0.2);
    border-radius: var(--radius-xs);
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--success);
}

/* ─── Buttons ─────────────────────────────────────── */

.btn {
    width: 100%;
    padding: 16px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    margin-top: 8px;
}

.btn:active {
    transform: scale(0.98);
}

.btn-validate {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    color: var(--text-primary);
    backdrop-filter: blur(10px);
}

.btn-validate:active {
    background: rgba(255, 255, 255, 0.1);
}

.btn-order {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 20px rgba(0, 180, 255, 0.3);
}

.btn-order:active {
    box-shadow: 0 2px 10px rgba(0, 180, 255, 0.2);
}

.btn:disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ─── History list ────────────────────────────────── */

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    backdrop-filter: blur(10px);
}

.history-item-left {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.history-item-game {
    font-size: 13px;
    font-weight: 600;
}

.history-item-product {
    font-size: 11px;
    color: var(--text-secondary);
}

.history-item-right {
    text-align: right;
}

.history-item-price {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
}

.history-item-status {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-top: 3px;
}

.status-completed {
    background: rgba(0, 230, 118, 0.12);
    color: var(--success);
}

.status-pending {
    background: rgba(255, 171, 64, 0.12);
    color: var(--warning);
}

.status-processing {
    background: rgba(0, 180, 255, 0.12);
    color: var(--accent);
}

.status-failed {
    background: rgba(255, 82, 82, 0.12);
    color: var(--danger);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ─── Profile ─────────────────────────────────────── */

.profile-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    backdrop-filter: blur(10px);
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 800;
    color: white;
    margin-bottom: 12px;
    box-shadow: 0 4px 20px rgba(0, 180, 255, 0.3);
}

.profile-name {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 2px;
}

.profile-username {
    font-size: 13px;
    color: var(--text-secondary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.stat-card {
    text-align: center;
    padding: 16px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    backdrop-filter: blur(10px);
}

.stat-value {
    font-size: 16px;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ─── Bottom Navigation ───────────────────────────── */

.bottom-nav {
    height: var(--nav-height);
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: rgba(10, 14, 26, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
    font-family: var(--font);
}

.nav-item.active {
    color: var(--accent);
}

.nav-icon {
    font-size: 20px;
}

.nav-label {
    font-size: 10px;
    font-weight: 600;
}

/* ─── Modal ───────────────────────────────────────── */

.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 400px;
    padding: 28px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    text-align: center;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}

.modal-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

.card-number {
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 12px;
    font-family: 'Inter', monospace;
}

.modal-hint {
    font-size: 12px;
    color: var(--success);
    margin-bottom: 16px;
}

.btn-close-modal {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

/* ─── Loading ─────────────────────────────────────── */

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 14, 26, 0.8);
    backdrop-filter: blur(8px);
}

.spinner {
    width: 40px;
    height: 40px;
    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);
    }
}

/* ─── Toast ───────────────────────────────────────── */

.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: var(--radius-xs);
    font-size: 13px;
    font-weight: 600;
    z-index: 400;
    animation: toastIn 0.3s ease;
    backdrop-filter: blur(20px);
    max-width: 90%;
    text-align: center;
}

.toast.success {
    background: rgba(0, 230, 118, 0.15);
    border: 1px solid rgba(0, 230, 118, 0.3);
    color: var(--success);
}

.toast.error {
    background: rgba(255, 82, 82, 0.15);
    border: 1px solid rgba(255, 82, 82, 0.3);
    color: var(--danger);
}

.toast.info {
    background: rgba(0, 180, 255, 0.15);
    border: 1px solid rgba(0, 180, 255, 0.3);
    color: var(--accent);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ─── Deposit Modal ───────────────────────────────── */

.deposit-modal-content {
    padding-bottom: 32px;
}

.deposit-step {
    animation: fadeIn 0.25s ease;
}

.deposit-input-wrap {
    position: relative;
    margin-bottom: 8px;
}

.deposit-amount-input {
    padding-right: 60px !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    text-align: center;
}

.deposit-currency {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
}

.deposit-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-align: center;
}

.deposit-quick-amounts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.quick-amount-btn {
    padding: 10px 8px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s;
}

.quick-amount-btn:active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: scale(0.95);
}

.btn-deposit {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 20px rgba(0, 180, 255, 0.3);
}

.deposit-amount-display {
    font-size: 28px;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.card-number-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 16px;
    font-family: 'Inter', monospace;
    cursor: pointer;
    transition: all 0.2s;
}

.card-number-box:active {
    border-color: var(--accent);
    background: rgba(0, 180, 255, 0.05);
}

.copy-icon {
    font-size: 16px;
    opacity: 0.6;
}

.deposit-timer-wrap {
    margin-bottom: 12px;
}

.deposit-timer-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.deposit-timer-fill {
    height: 100%;
    width: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 1s linear, background 0.5s ease;
}

.deposit-timer-text {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.deposit-status-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    animation: pulseText 2s ease-in-out infinite;
}

@keyframes pulseText {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

.btn-check-payment {
    background: rgba(0, 230, 118, 0.12);
    border: 1px solid rgba(0, 230, 118, 0.3);
    color: var(--success);
    font-size: 16px;
}

.deposit-result-icon {
    font-size: 56px;
    margin-bottom: 12px;
}

/* ─── Helpers ─────────────────────────────────────── */

.hidden {
    display: none !important;
}