/* TokenPocket Web - Mobile Wallet UI */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --blue: #2980FF;
    --blue-dark: #1a6fe0;
    --green: #52C41A;
    --green-dark: #45a816;
    --up: #00C087;
    --down: #FF4D4F;
    --bg: #F5F6F8;
    --card: #fff;
    --text: #1a1a1a;
    --text2: #999;
    --border: #eee;
    --nav-h: 56px;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    color: var(--text);
    background: #e8e8e8;
    line-height: 1.4;
    -webkit-tap-highlight-color: transparent;
}

.phone-frame {
    max-width: 430px;
    min-height: 100vh;
    margin: 0 auto;
    background: var(--bg);
    position: relative;
    overflow-x: hidden;
}

.has-bottom-nav .phone-frame { padding-bottom: var(--nav-h); }
.has-bottom-nav .main-scroll { padding-bottom: 16px; }
.has-action-bar .phone-frame { padding-bottom: calc(var(--nav-h) + 60px); }

/* ===== Bottom Tab ===== */
.bottom-tab {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    height: var(--nav-h);
    background: #fff;
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 100;
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: none;
    background: none;
    color: var(--text2);
    font-size: 10px;
    cursor: pointer;
    padding: 4px 0;
    position: relative;
}

.tab-item.active { color: var(--blue); }
.tab-icon { position: relative; display: flex; align-items: center; justify-content: center; }
.tab-badge {
    position: absolute;
    top: -2px;
    right: -6px;
    width: 6px;
    height: 6px;
    background: var(--down);
    border-radius: 50%;
}

/* Tab panels */
.tab-panel { display: none; min-height: calc(100vh - var(--nav-h)); }
.tab-panel.active { display: block; }
.tab-panel img.static-shot { width: 100%; display: block; vertical-align: top; }

/* ===== Home Header ===== */
.home-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg);
}

.home-header-left, .home-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-btn {
    background: none;
    border: none;
    color: #333;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #FFC107;
    border-radius: 50%;
}

/* ===== Balance Card ===== */
.balance-card {
    margin: 0 16px 16px;
    padding: 20px 18px;
    background: linear-gradient(135deg, #3B9AFF 0%, #2980FF 100%);
    border-radius: 16px;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.balance-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 13px;
}

.wallet-name { display: flex; align-items: center; gap: 6px; }
.copy-icon { opacity: 0.8; cursor: pointer; }

.backup-btn {
    border: 1px solid rgba(255,255,255,0.6);
    background: transparent;
    color: #fff;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
}

.more-btn { background: none; border: none; color: #fff; position: relative; cursor: pointer; }
.more-btn .dot {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 6px;
    background: var(--down);
    border-radius: 50%;
}

.balance-amount {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 36px;
    font-weight: 600;
    letter-spacing: -1px;
}

.eye-btn { background: none; border: none; color: rgba(255,255,255,0.8); cursor: pointer; padding: 4px; }

.balance-watermark {
    position: absolute;
    right: -10px;
    bottom: -10px;
    width: 100px;
    height: 100px;
    opacity: 0.15;
    pointer-events: none;
}

/* ===== Quick Actions ===== */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 0 16px 20px;
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text);
    font-size: 12px;
}

.quick-action-icon {
    width: 52px;
    height: 52px;
    background: #fff;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

/* ===== Asset Tabs ===== */
.section-tabs {
    display: flex;
    align-items: center;
    padding: 0 16px 12px;
    gap: 24px;
}

.section-tab {
    font-size: 16px;
    color: var(--text2);
    background: none;
    border: none;
    padding-bottom: 8px;
    cursor: pointer;
    position: relative;
}

.section-tab.active {
    color: var(--text);
    font-weight: 600;
}

.section-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--text);
    border-radius: 2px;
}

.section-tabs .add-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text2);
    cursor: pointer;
}

/* ===== Asset List ===== */
.asset-list { background: var(--bg); }

.asset-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    text-decoration: none;
    color: inherit;
    background: var(--bg);
    border-bottom: 1px solid #f0f0f0;
}

.asset-item:active { background: #eee; }

.asset-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 12px;
    object-fit: cover;
    flex-shrink: 0;
}

.asset-info { flex: 1; min-width: 0; }
.asset-name { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.asset-price-row { font-size: 12px; color: var(--text2); }
.asset-price-row .change.up { color: var(--up); margin-left: 6px; }
.asset-price-row .change.down { color: var(--down); margin-left: 6px; }

.asset-balance { text-align: right; flex-shrink: 0; }
.asset-balance-num { font-weight: 600; font-size: 15px; }
.asset-balance-usd { font-size: 12px; color: var(--text2); margin-top: 4px; }

/* ===== Sub Pages ===== */
.sub-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 10;
}

.sub-header h1 { font-size: 17px; font-weight: 600; flex: 1; text-align: center; }
.back-btn { color: #333; text-decoration: none; display: flex; width: 40px; }
.sub-header-right { width: 40px; }

.sub-page { background: var(--bg); min-height: 100vh; padding-bottom: 80px; }

/* Asset detail header */
.asset-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
}

.asset-summary-left { display: flex; align-items: center; gap: 10px; }
.asset-summary-left img { width: 44px; height: 44px; border-radius: 50%; }
.asset-summary-left span { font-size: 18px; font-weight: 600; }

.asset-summary-right { text-align: right; }
.asset-summary-balance { font-size: 28px; font-weight: 600; }
.asset-summary-usd { font-size: 13px; color: var(--text2); }

.market-card {
    margin: 0 16px 16px;
    padding: 16px;
    background: #fff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.market-card-label { color: var(--text2); font-size: 13px; }
.market-card-price { font-size: 18px; font-weight: 600; text-align: center; }
.market-card-sub { font-size: 12px; color: var(--text2); text-align: center; }

.market-change-btn {
    background: var(--up);
    color: #fff;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
}

.market-change-btn.down { background: var(--down); }

/* Record tabs */
.record-tabs {
    display: flex;
    align-items: center;
    padding: 0 16px 12px;
    gap: 24px;
    border-bottom: 1px solid var(--border);
}

.record-tab {
    background: none;
    border: none;
    font-size: 15px;
    color: var(--text2);
    padding-bottom: 10px;
    cursor: pointer;
    position: relative;
    text-decoration: none;
}

.record-tab.active { color: var(--text); font-weight: 600; }
.record-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--text);
}

.record-filter { margin-left: auto; color: var(--text2); }

/* Record list */
.record-list { background: #fff; }

.record-item {
    display: flex;
    align-items: flex-start;
    padding: 14px 16px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f5f5f5;
}

.record-item:active { background: #fafafa; }

.record-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e8f8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
    color: var(--up);
}

.record-item.type-out .record-icon { color: var(--up); }
.record-item.type-in .record-icon { color: var(--blue); background: #e8f0ff; }

.record-body { flex: 1; min-width: 0; }
.record-name { font-weight: 500; display: flex; align-items: center; gap: 4px; }
.record-type-label { font-size: 12px; color: var(--text2); margin-top: 2px; }

.record-right { text-align: right; flex-shrink: 0; }
.record-amount { font-weight: 600; color: var(--up); font-size: 15px; }
.record-amount.negative { color: var(--up); }
.record-amount.positive { color: var(--blue); }
.record-time { font-size: 11px; color: var(--text2); margin-top: 4px; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 40px;
    color: var(--text2);
}

.empty-state svg { opacity: 0.3; margin-bottom: 16px; }
.empty-state p { margin-bottom: 8px; }
.empty-state a { color: var(--blue); text-decoration: none; }

/* Action bar (transfer/receive/swap) */
.action-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid var(--border);
    z-index: 50;
}

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
}

.action-transfer { background: var(--green); color: #fff; }
.action-receive { background: var(--blue); color: #fff; }
.action-swap { background: #fff; color: var(--text); border: 1px solid var(--border); flex: 0.7; }

.has-action-bar .action-bar { bottom: 0; }

/* ===== Transfer Page ===== */
.transfer-page, .receive-page, .detail-page { background: var(--bg); min-height: 100vh; padding-bottom: 100px; }

.form-section { padding: 16px; }

.form-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-label-row a { color: var(--blue); text-decoration: none; font-size: 13px; }

.form-box {
    background: #fff;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 16px;
}

.form-input {
    width: 100%;
    border: none;
    font-size: 15px;
    outline: none;
    background: transparent;
}

.form-input::placeholder { color: #ccc; }

.input-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-row .form-input { flex: 1; }

.btn-all {
    border: 1px solid var(--blue);
    color: var(--blue);
    background: #fff;
    padding: 4px 12px;
    border-radius: 14px;
    font-size: 12px;
    cursor: pointer;
}

.balance-row {
    display: flex;
    justify-content: space-between;
    padding-top: 12px;
    margin-top: 12px;
    border-top: 1px solid #f0f0f0;
    font-size: 13px;
    color: var(--text2);
}

.fee-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.fee-option {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 6px;
    text-align: center;
    cursor: pointer;
    font-size: 11px;
}

.fee-option.active { border-color: var(--blue); color: var(--blue); }
.fee-option .fee-title { font-weight: 600; margin-bottom: 4px; font-size: 12px; }
.fee-option .fee-time { color: var(--text2); margin-top: 4px; }

.btn-primary {
    display: block;
    width: calc(100% - 32px);
    margin: 24px 16px;
    padding: 14px;
    background: var(--blue);
    color: #fff;
    border: none;
    border-radius: 24px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
}

.btn-primary:active { background: var(--blue-dark); }

/* ===== Receive Page ===== */
.receive-header {
    background: linear-gradient(180deg, #3B9AFF 0%, #2980FF 100%);
    color: #fff;
    padding-bottom: 40px;
}

.receive-header .sub-header { background: transparent; color: #fff; }
.receive-header .sub-header h1, .receive-header .back-btn { color: #fff; }

.receive-card {
    margin: -30px 16px 0;
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.receive-warning {
    background: #FFF7E6;
    color: #E67E22;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 12px;
    margin-bottom: 20px;
    display: flex;
    gap: 6px;
    align-items: flex-start;
}

.qr-wrap {
    display: flex;
    justify-content: center;
    padding: 20px 0;
}

.qr-wrap canvas, .qr-wrap img { max-width: 200px; }

.address-box {
    background: #F5F7F9;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 16px;
}

.address-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--text2);
}

.address-tag {
    border: 1px solid var(--blue);
    color: var(--blue);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
}

.address-text {
    font-size: 13px;
    word-break: break-all;
    line-height: 1.6;
    font-family: monospace;
}

.receive-actions {
    display: flex;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.receive-action {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--text);
    font-size: 12px;
    cursor: pointer;
    border-right: 1px solid var(--border);
}

.receive-action:last-child { border-right: none; }

/* ===== Detail Page ===== */
.detail-status {
    text-align: center;
    padding: 24px 16px;
    background: #fff;
}

.detail-status-icon {
    width: 56px;
    height: 56px;
    background: var(--up);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    color: #fff;
}

.detail-status-text { color: var(--up); font-size: 15px; margin-bottom: 8px; }
.detail-amount { font-size: 28px; font-weight: 600; }

.detail-card {
    margin: 12px 16px;
    background: #fff;
    border-radius: 12px;
    padding: 16px;
}

.detail-row {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 13px;
}

.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text2); width: 70px; flex-shrink: 0; }
.detail-value { flex: 1; word-break: break-all; display: flex; align-items: flex-start; gap: 6px; }
.detail-value .copy-btn { background: none; border: none; color: var(--text2); cursor: pointer; flex-shrink: 0; }

.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.detail-tag {
    background: #f5f5f5;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
}

.detail-more { color: var(--blue); font-size: 13px; text-align: center; padding: 8px; cursor: pointer; }

.detail-qr-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f5f5f5;
}

.detail-qr { flex-shrink: 0; }
.detail-qr canvas { width: 80px !important; height: 80px !important; }

/* Toast */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0,0,0,0.75);
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    opacity: 0;
    transition: all 0.3s;
    z-index: 200;
    pointer-events: none;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.hidden-balance { filter: blur(6px); user-select: none; }
