/* PumpiD Mini App v3 — Premium Visual */
:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-card-hover: rgba(40, 55, 75, 0.8);
    --bg-glass: rgba(15, 23, 42, 0.6);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --green: #10b981;
    --green-bright: #34d399;
    --green-dim: rgba(16, 185, 129, 0.15);
    --green-glow: rgba(16, 185, 129, 0.4);
    --red: #ef4444;
    --red-bright: #f87171;
    --red-dim: rgba(239, 68, 68, 0.15);
    --blue: #3b82f6;
    --blue-bright: #60a5fa;
    --blue-dim: rgba(59, 130, 246, 0.15);
    --yellow: #f59e0b;
    --purple: #8b5cf6;
    --border: rgba(148, 163, 184, 0.1);
    --border-glow: rgba(59, 130, 246, 0.3);
    --radius: 16px;
    --radius-sm: 10px;
    --font: -apple-system, BlinkMacSystemFont, 'Inter', 'SF Pro Display', sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 80px;
}

/* === Animated background === */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 20% 50%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 20%, rgba(16, 185, 129, 0.06) 0%, transparent 50%),
                radial-gradient(ellipse at 50% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 50%);
    animation: bgFloat 20s ease-in-out infinite;
    z-index: -1;
    pointer-events: none;
}
@keyframes bgFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(2%, -2%) rotate(1deg); }
    66% { transform: translate(-1%, 1%) rotate(-1deg); }
}

/* === Header === */
.header {
    padding: 20px 20px 16px;
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.95) 0%, rgba(10, 14, 23, 0.8) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-name {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}
.header-balance {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -1px;
    margin-top: 4px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.header-pnl {
    font-size: 14px;
    margin-top: 4px;
    font-weight: 500;
}

/* === Glass Cards === */
.cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 16px 20px;
}
.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, border-color 0.3s;
}
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--blue), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}
.card:active {
    transform: scale(0.97);
}
.card:active::before { opacity: 1; }
.card-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}
.card-value {
    font-size: 24px;
    font-weight: 800;
    margin-top: 6px;
    letter-spacing: -0.5px;
}
.card-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* === Glow numbers === */
.text-green {
    color: var(--green-bright);
    text-shadow: 0 0 20px var(--green-glow);
}
.text-red {
    color: var(--red-bright);
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
}

/* === Chart === */
.chart-container {
    padding: 0 20px;
    margin-bottom: 16px;
}
.chart-wrapper {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 16px;
    height: 200px;
    position: relative;
    overflow: hidden;
}
.chart-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.chart-tab {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}
.chart-tab.active {
    background: var(--blue-dim);
    color: var(--blue-bright);
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.2);
}

/* === Section === */
.section {
    padding: 0 20px;
    margin-bottom: 16px;
}
.section-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* === Live pulse indicator === */
.live-dot {
    width: 8px;
    height: 8px;
    background: var(--green-bright);
    border-radius: 50%;
    display: inline-block;
    animation: livePulse 2s ease-in-out infinite;
    box-shadow: 0 0 8px var(--green-glow);
}
@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* === Demo Table === */
.demo-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
    backdrop-filter: blur(12px);
}
.demo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    white-space: nowrap;
}
.demo-table thead th {
    padding: 12px 14px;
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border);
    background: rgba(17, 24, 39, 0.8);
    position: sticky;
    top: 0;
}
.demo-table tbody tr {
    border-bottom: 1px solid rgba(148, 163, 184, 0.06);
    transition: background 0.2s;
}
.demo-table tbody tr:last-child { border-bottom: none; }
.demo-table tbody tr:active { background: var(--bg-card-hover); }
.demo-table td {
    padding: 12px 14px;
    vertical-align: middle;
}
.demo-table .td-symbol {
    font-weight: 800;
    font-size: 14px;
    letter-spacing: -0.3px;
}
.demo-table .td-side {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    display: inline-block;
    letter-spacing: 0.5px;
}
.demo-table .td-side-short {
    background: var(--red-dim);
    color: var(--red-bright);
}
.demo-table .td-side-long {
    background: var(--green-dim);
    color: var(--green-bright);
}
.demo-table .td-reason { font-size: 12px; }
.demo-table .td-pnl {
    font-weight: 800;
    font-size: 14px;
    text-align: right;
}
.demo-table .td-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* === Trade items (connected) === */
.trade-item {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.15s, border-color 0.2s;
}
.trade-item:active { transform: scale(0.98); border-color: var(--border-glow); }
.trade-left { flex: 1; }
.trade-symbol { font-size: 15px; font-weight: 700; }
.trade-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.trade-pnl { font-size: 16px; font-weight: 800; text-align: right; }
.trade-reason { font-size: 11px; text-align: right; margin-top: 2px; color: var(--text-muted); }

/* === Positions === */
.position-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}
.position-card::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 60px; height: 60px;
    border-radius: 50%;
    filter: blur(30px);
    opacity: 0.15;
    pointer-events: none;
}
.position-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.position-symbol { font-size: 17px; font-weight: 800; }
.position-side {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}
.side-short { background: var(--red-dim); color: var(--red-bright); }
.side-long { background: var(--green-dim); color: var(--green-bright); }
.position-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 6px;
}
.position-row span:last-child { color: var(--text-primary); font-weight: 600; }

/* === Filters === */
.filters {
    display: flex;
    gap: 8px;
    padding: 0 20px;
    margin-bottom: 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.filter-btn {
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.2s;
}
.filter-btn.active {
    background: var(--blue-dim);
    color: var(--blue-bright);
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.15);
}

/* === Stat bars === */
.stat-bar {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
}
.stat-bar-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}
.stat-bar-label { font-size: 14px; font-weight: 600; }
.stat-bar-value { font-size: 14px; font-weight: 800; }
.stat-bar-track {
    height: 6px;
    background: rgba(148, 163, 184, 0.08);
    border-radius: 3px;
    overflow: hidden;
}
.stat-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.8s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* === WR bar === */
.wr-bar {
    display: flex;
    height: 36px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-top: 8px;
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
}
.wr-win { background: linear-gradient(135deg, var(--green), var(--green-bright)); }
.wr-loss { background: linear-gradient(135deg, var(--red), var(--red-bright)); }
.wr-bar-label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    color: #fff;
    min-width: 40px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* === Onboarding === */
.onboard-container {
    padding: 40px 20px 20px;
    text-align: center;
}
.onboard-icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: floatIcon 3s ease-in-out infinite;
}
@keyframes floatIcon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}
.onboard-title { font-size: 24px; font-weight: 800; margin-bottom: 8px; }
.onboard-desc { font-size: 14px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 24px; }
.onboard-steps { text-align: left; margin: 16px 0; }
.step-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}
.step-item:last-child { border-bottom: none; }
.step-num {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue-dim), rgba(59, 130, 246, 0.25));
    color: var(--blue-bright);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    flex-shrink: 0;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.15);
}
.input-group { text-align: left; margin-bottom: 16px; }
.input-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    margin-bottom: 6px;
}
.input-field {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'SF Mono', monospace;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.input-field:focus {
    border-color: var(--blue);
    box-shadow: 0 0 16px rgba(59, 130, 246, 0.15);
}
.input-field::placeholder { color: var(--text-muted); }

/* === Buttons === */
.btn-primary {
    width: 100%;
    padding: 16px;
    background: var(--blue);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-glow {
    background: linear-gradient(135deg, #10b981, #34d399) !important;
    box-shadow: 0 4px 24px rgba(16, 185, 129, 0.3), 0 0 60px rgba(16, 185, 129, 0.1);
    animation: glowPulse 2.5s ease-in-out infinite;
    border: none;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 0.5px;
    padding: 18px 32px;
}
@keyframes glowPulse {
    0%, 100% { box-shadow: 0 4px 24px rgba(16, 185, 129, 0.3), 0 0 40px rgba(16, 185, 129, 0.1); }
    50% { box-shadow: 0 4px 32px rgba(16, 185, 129, 0.5), 0 0 80px rgba(16, 185, 129, 0.2); }
}
.btn-rocket { position: relative; overflow: hidden; }
.rocket-icon {
    display: inline-block;
    animation: rocketBounce 1.5s ease-in-out infinite;
    font-size: 20px;
}
@keyframes rocketBounce {
    0%, 100% { transform: translateY(0) rotate(-15deg); }
    50% { transform: translateY(-5px) rotate(-15deg); }
}
.btn-rocket::after {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: linear-gradient(45deg, transparent 40%, rgba(255,255,255,0.12) 50%, transparent 60%);
    animation: btnShine 3s ease-in-out infinite;
}
@keyframes btnShine {
    0% { transform: translateX(-100%) rotate(45deg); }
    30% { transform: translateX(100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

/* === Tab Bar === */
.tab-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    display: flex;
    padding: 6px 0;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    z-index: 200;
}
.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s;
    position: relative;
}
.tab-item:active { transform: scale(0.9); }
.tab-icon { font-size: 20px; transition: transform 0.2s; }
.tab-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    transition: color 0.2s;
}
.tab-item.active .tab-label { color: var(--blue-bright); }
.tab-item.active .tab-icon { transform: scale(1.15); }
.tab-item.active::before {
    content: '';
    position: absolute;
    top: 0; left: 25%; right: 25%;
    height: 2px;
    background: var(--blue-bright);
    border-radius: 0 0 2px 2px;
    box-shadow: 0 0 8px var(--blue);
}

/* === Loading === */
.loading {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    gap: 12px;
}
.spinner {
    width: 36px; height: 36px;
    border: 3px solid rgba(148, 163, 184, 0.1);
    border-top-color: var(--blue-bright);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    box-shadow: 0 0 16px rgba(59, 130, 246, 0.2);
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-text { font-size: 14px; }

/* === Animations === */
.fade-in { animation: fadeIn 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.demo-row-anim {
    animation: rowSlideIn 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) both;
}
@keyframes rowSlideIn {
    from { opacity: 0; transform: translateX(-16px); }
    to { opacity: 1; transform: translateX(0); }
}

/* === Stagger cards animation === */
.card { animation: cardIn 0.5s cubic-bezier(0.25, 0.8, 0.25, 1) both; }
.cards .card:nth-child(1) { animation-delay: 0.1s; }
.cards .card:nth-child(2) { animation-delay: 0.2s; }
.cards .card:nth-child(3) { animation-delay: 0.3s; }
.cards .card:nth-child(4) { animation-delay: 0.4s; }
@keyframes cardIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* === Utilities === */
.text-yellow { color: var(--yellow); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }
