/**
 * Binance/OKX Style Design System
 * 专业交易所风格 - 深色主题 + 黄色强调色
 * Mobile-first responsive design
 */

/* ========================================
   CSS Variables - 币安配色方案
   ======================================== */
:root {
    /* 主色调 - 币安经典配色 */
    --bg-primary: #0B0E11;       /* 最深背景 */
    --bg-secondary: #12161C;      /* 卡片背景 */
    --bg-tertiary: #1E2329;       /* 输入框/hover背景 */
    --bg-hover: #2B3139;          /* 悬停状态 */

    /* 品牌色 - 币安黄 */
    --brand-yellow: #F0B90B;      /* 主要强调色 */
    --brand-yellow-hover: #FCD535; /* 黄色hover */
    --brand-yellow-light: rgba(240, 185, 11, 0.1);
    --brand-yellow-medium: rgba(240, 185, 11, 0.2);

    /* 文字颜色 */
    --text-primary: #EAECEF;      /* 主要文字 */
    --text-secondary: #B7BDC6;    /* 次要文字 */
    --text-tertiary: #848E9C;     /* 辅助文字 */
    --text-disabled: #5E6673;     /* 禁用文字 */

    /* 功能色 */
    --success: #0ECB81;           /* 涨/成功 - 绿色 */
    --success-bg: rgba(14, 203, 129, 0.1);
    --danger: #F6465D;            /* 跌/错误 - 红色 */
    --danger-bg: rgba(246, 70, 93, 0.1);
    --warning: #F0B90B;           /* 警告 */
    --info: #1E80FF;              /* 信息 */

    /* 边框 */
    --border-color: #2B3139;
    --border-light: #1E2329;
    --border-focus: #F0B90B;

    /* 圆角 */
    --radius-xs: 2px;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* 间距 */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;

    /* 字体 */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Courier New', monospace;

    /* 字号 */
    --text-xs: 12px;
    --text-sm: 14px;
    --text-base: 16px;
    --text-lg: 18px;
    --text-xl: 20px;
    --text-2xl: 24px;
    --text-3xl: 30px;
    --text-4xl: 36px;

    /* 阴影 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);

    /* 过渡 */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.2s ease;
    --transition-slow: 0.3s ease;

    /* 安全区域 */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ========================================
   Reset & Base
   ======================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    font-size: var(--text-sm);
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
}

img {
    max-width: 100%;
    height: auto;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
}

/* ========================================
   Layout
   ======================================== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

.page-wrapper {
    min-height: 100vh;
    padding-bottom: calc(60px + var(--safe-bottom));
}

@media (min-width: 768px) {
    .page-wrapper {
        padding-bottom: 0;
    }
}

/* ========================================
   Navigation - 顶部导航
   ======================================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    padding: 0 var(--space-4);
    z-index: 100;
}

.navbar-brand {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--brand-yellow);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.navbar-brand img {
    height: 24px;
}

.navbar-menu {
    display: none;
    align-items: center;
    gap: var(--space-1);
    margin-left: var(--space-8);
}

@media (min-width: 768px) {
    .navbar-menu {
        display: flex;
    }
}

.navbar-actions {
    display: flex;
    align-items: center;
    margin-left: auto;
    gap: var(--space-4);
}

.navbar-link {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast);
}

.navbar-link:hover,
.navbar-link.active {
    color: var(--text-primary);
}

.navbar-link.active {
    color: var(--brand-yellow);
}

.navbar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-left: auto;
    background: transparent;
    border: none;
    color: var(--text-primary);
}

@media (min-width: 768px) {
    .navbar-toggle {
        display: none;
    }
}

/* ========================================
   Bottom Tab Bar - 底部导航 (移动端)
   ======================================== */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(60px + var(--safe-bottom));
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-light);
    display: flex;
    padding-bottom: var(--safe-bottom);
    z-index: 100;
}

@media (min-width: 768px) {
    .tab-bar {
        display: none;
    }
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--text-tertiary);
    transition: color var(--transition-fast);
}

.tab-item.active {
    color: var(--brand-yellow);
}

.tab-icon {
    font-size: 22px;
    line-height: 1;
}

.tab-icon svg {
    width: 22px;
    height: 22px;
}

.tab-label {
    font-size: 10px;
    font-weight: 500;
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    height: 40px;
    padding: 0 var(--space-4);
    font-size: var(--text-sm);
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-sm {
    height: 32px;
    padding: 0 var(--space-3);
    font-size: var(--text-xs);
}

.btn-lg {
    height: 48px;
    padding: 0 var(--space-6);
    font-size: var(--text-base);
}

.btn-block {
    width: 100%;
}

/* Primary Button - 黄色 */
.btn-primary {
    background: var(--brand-yellow);
    color: var(--bg-primary);
}

.btn-primary:hover {
    background: var(--brand-yellow-hover);
}

.btn-primary:disabled {
    background: var(--text-disabled);
    color: var(--text-tertiary);
    cursor: not-allowed;
}

/* Secondary Button - 边框 */
.btn-secondary {
    background: transparent;
    color: var(--brand-yellow);
    border: 1px solid var(--brand-yellow);
}

.btn-secondary:hover {
    background: var(--brand-yellow-light);
}

/* Ghost Button */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Success/Danger Buttons */
.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

/* ========================================
   Cards
   ======================================== */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: var(--space-4);
}

.card-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--border-light);
}

/* ========================================
   Form Elements
   ======================================== */
.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.form-input {
    width: 100%;
    height: 48px;
    padding: 0 var(--space-4);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: var(--text-sm);
    transition: border-color var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--brand-yellow);
}

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

.form-input:disabled {
    background: var(--bg-hover);
    color: var(--text-disabled);
    cursor: not-allowed;
}

/* Input with icon */
.input-group {
    position: relative;
}

.input-icon {
    position: absolute;
    left: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
}

.input-group .form-input {
    padding-left: 44px;
}

.input-action {
    position: absolute;
    right: var(--space-2);
    top: 50%;
    transform: translateY(-50%);
}

/* ========================================
   Product Card - 理财产品卡片
   ======================================== */
.product-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    transition: border-color var(--transition-fast);
}

.product-card:hover {
    border-color: var(--brand-yellow);
}

.product-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-4);
}

.product-name {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
}

.product-tag {
    padding: 2px 8px;
    font-size: var(--text-xs);
    font-weight: 500;
    border-radius: var(--radius-xs);
}

.product-tag.hot {
    background: var(--danger-bg);
    color: var(--danger);
}

.product-tag.new {
    background: var(--success-bg);
    color: var(--success);
}

.product-apy {
    text-align: center;
    padding: var(--space-4);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
}

.product-apy-label {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-bottom: var(--space-1);
}

.product-apy-value {
    font-family: var(--font-mono);
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--success);
}

.product-apy-value span {
    font-size: var(--text-lg);
}

.product-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.product-stat {
    text-align: center;
}

.product-stat-label {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-bottom: 2px;
}

.product-stat-value {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
}

/* ========================================
   Asset Display - 资产展示
   ======================================== */
.asset-card {
    background: linear-gradient(135deg, #1E2329 0%, #12161C 100%);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
}

.asset-label {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    margin-bottom: var(--space-2);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.asset-value {
    font-family: var(--font-mono);
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.asset-unit {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

.asset-change {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-xs);
    padding: 2px 6px;
    border-radius: var(--radius-xs);
}

.asset-change.up {
    background: var(--success-bg);
    color: var(--success);
}

.asset-change.down {
    background: var(--danger-bg);
    color: var(--danger);
}

/* ========================================
   Action Buttons Grid - 操作按钮
   ======================================== */
.action-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-3);
    padding: var(--space-4);
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.action-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.action-btn-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    font-size: 20px;
}

.action-btn-label {
    font-size: var(--text-xs);
}

/* ========================================
   List Items
   ======================================== */
.list-item {
    display: flex;
    align-items: center;
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition-fast);
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:hover {
    background: var(--bg-tertiary);
}

.list-item-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: 50%;
    margin-right: var(--space-3);
    font-size: 18px;
}

.list-item-content {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.list-item-subtitle {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.list-item-value {
    text-align: right;
}

.list-item-amount {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.list-item-amount.success {
    color: var(--success);
}

.list-item-amount.danger {
    color: var(--danger);
}

.list-item-status {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

/* ========================================
   Modal
   ======================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 200;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

@media (min-width: 768px) {
    .modal-overlay {
        align-items: center;
    }
}

.modal-content {
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@media (min-width: 768px) {
    .modal-content {
        border-radius: var(--radius-xl);
        animation: fadeIn 0.2s ease;
    }
}

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

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-light);
    position: relative;
}

.modal-title {
    font-size: var(--text-lg);
    font-weight: 600;
    text-align: center;
}

.modal-close {
    position: absolute;
    right: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    font-size: 24px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.modal-close:hover,
.modal-close:active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-4);
    overflow-y: auto;
}

.modal-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: var(--space-3);
}

.modal-footer .btn {
    flex: 1;
}

/* ========================================
   Toast Notifications
   ======================================== */
.toast-container {
    position: fixed;
    top: calc(70px + var(--safe-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease;
    pointer-events: auto;
}

.toast.success {
    border-color: var(--success);
}

.toast.error {
    border-color: var(--danger);
}

.toast.warning {
    border-color: var(--warning);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.toast-icon {
    font-size: 18px;
}

.toast-message {
    font-size: var(--text-sm);
    color: var(--text-primary);
}

/* ========================================
   VIP Card
   ======================================== */
.vip-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.vip-card:hover {
    border-color: var(--brand-yellow);
    box-shadow: 0 0 20px rgba(240, 185, 11, 0.1);
}

.vip-card-header {
    padding: var(--space-4);
    position: relative;
}

.vip-card-header.bronze { background: linear-gradient(135deg, #8B4513 0%, #A0522D 100%); }
.vip-card-header.silver { background: linear-gradient(135deg, #5C6370 0%, #7B8794 100%); }
.vip-card-header.gold { background: linear-gradient(135deg, #B8860B 0%, #DAA520 100%); }
.vip-card-header.platinum { background: linear-gradient(135deg, #1E3A5F 0%, #2E5A8F 100%); }
.vip-card-header.diamond { background: linear-gradient(135deg, #4B0082 0%, #8B008B 100%); }

.vip-level {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.vip-badge {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    font-size: var(--text-xl);
    font-weight: 700;
    color: #fff;
}

.vip-name {
    font-size: var(--text-lg);
    font-weight: 600;
    color: #fff;
}

.vip-price {
    position: absolute;
    right: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    text-align: right;
}

.vip-price-value {
    font-family: var(--font-mono);
    font-size: var(--text-xl);
    font-weight: 700;
    color: #fff;
}

.vip-price-unit {
    font-size: var(--text-xs);
    color: rgba(255, 255, 255, 0.7);
}

.vip-card-body {
    padding: var(--space-4);
}

.vip-benefits {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.vip-benefit {
    background: var(--bg-tertiary);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    text-align: center;
}

.vip-benefit-value {
    font-family: var(--font-mono);
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.vip-benefit-label {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

/* ========================================
   FAQ Accordion
   ======================================== */
.faq-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
    overflow: hidden;
}

.faq-item.active {
    border-color: var(--brand-yellow);
}

.faq-question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.faq-question:hover {
    background: var(--bg-tertiary);
}

.faq-question h3 {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    flex: 1;
}

.faq-item.active .faq-question h3 {
    color: var(--text-primary);
}

.faq-toggle {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    transition: transform var(--transition-normal);
}

.faq-item.active .faq-toggle {
    transform: rotate(180deg);
    color: var(--brand-yellow);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-slow);
}

.faq-item.active .faq-answer {
    max-height: 500px;
}

.faq-content {
    padding: 0 var(--space-4) var(--space-4);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ========================================
   Empty State
   ======================================== */
.empty-state {
    text-align: center;
    padding: var(--space-10) var(--space-4);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.empty-title {
    font-size: var(--text-base);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.empty-desc {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    margin-bottom: var(--space-4);
}

/* ========================================
   Loading Skeleton
   ======================================== */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 0%,
        var(--bg-hover) 50%,
        var(--bg-tertiary) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 14px;
    margin-bottom: var(--space-2);
}

.skeleton-title {
    height: 20px;
    width: 60%;
    margin-bottom: var(--space-3);
}

.skeleton-circle {
    border-radius: 50%;
}

/* ========================================
   Utility Classes
   ======================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-yellow { color: var(--brand-yellow); }

.bg-primary { background: var(--bg-primary); }
.bg-secondary { background: var(--bg-secondary); }
.bg-tertiary { background: var(--bg-tertiary); }

.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }

.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.hidden { display: none; }
.block { display: block; }

@media (min-width: 768px) {
    .md\:grid-2 { grid-template-columns: repeat(2, 1fr); }
    .md\:grid-3 { grid-template-columns: repeat(3, 1fr); }
    .md\:hidden { display: none; }
    .md\:flex { display: flex; }
}

/* ========================================
   Page Header (通用页面头部)
   ======================================== */
.page-header {
    padding: calc(64px + var(--space-6)) var(--space-4) var(--space-6);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
}

.page-title {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.page-subtitle {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

/* ========================================
   Safe Area Padding
   ======================================== */
.safe-top {
    padding-top: var(--safe-top);
}

.safe-bottom {
    padding-bottom: var(--safe-bottom);
}

/* 内容区域上边距（导航栏高度） */
.content-top {
    padding-top: 64px;
}

/* ========================================
   H5 Responsive - 多屏幕尺寸自适应
   ======================================== */

/* ---- 超小屏幕 (320px - 375px) iPhone SE, 小屏手机 ---- */
@media (max-width: 375px) {
    :root {
        --text-xs: 11px;
        --text-sm: 13px;
        --text-base: 14px;
        --text-lg: 16px;
        --text-xl: 18px;
        --text-2xl: 20px;
        --text-3xl: 24px;
        --text-4xl: 28px;
        --space-4: 12px;
        --space-5: 16px;
        --space-6: 20px;
    }

    .container {
        padding: 0 var(--space-3);
    }

    .navbar {
        height: 56px;
        padding: 0 var(--space-3);
    }

    .navbar-brand {
        font-size: var(--text-base);
    }

    .navbar-brand img {
        height: 20px;
    }

    .btn-sm {
        height: 28px;
        padding: 0 var(--space-2);
        font-size: 11px;
    }

    .card-body {
        padding: var(--space-3);
    }

    .asset-card {
        padding: var(--space-3);
    }

    .asset-value {
        font-size: var(--text-2xl);
    }

    .product-apy-value {
        font-size: var(--text-2xl);
    }

    .action-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: var(--space-2);
        padding: var(--space-3);
    }

    .action-btn-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .action-btn-label {
        font-size: 10px;
    }

    .form-input {
        height: 44px;
        padding: 0 var(--space-3);
    }

    .modal-content {
        max-width: 100%;
        margin: 0 var(--space-2);
    }

    .vip-badge {
        width: 40px;
        height: 40px;
        font-size: var(--text-lg);
    }

    .vip-benefits {
        grid-template-columns: 1fr;
    }

    .page-title {
        font-size: var(--text-xl);
    }

    /* 移动端用户区域 */
    .nav-user-mobile {
        font-size: 12px !important;
    }
}

/* ---- 小屏幕 (376px - 414px) iPhone X/11/12/13 ---- */
@media (min-width: 376px) and (max-width: 414px) {
    :root {
        --text-xs: 11px;
        --text-sm: 13px;
        --text-base: 15px;
        --text-lg: 17px;
        --text-xl: 19px;
        --text-2xl: 22px;
        --text-3xl: 26px;
    }

    .container {
        padding: 0 var(--space-3);
    }

    .navbar {
        height: 58px;
    }

    .navbar-brand img {
        height: 22px;
    }

    .asset-value {
        font-size: var(--text-2xl);
    }

    .action-btn-icon {
        width: 40px;
        height: 40px;
    }
}

/* ---- 中等屏幕 (415px - 480px) 大屏手机 ---- */
@media (min-width: 415px) and (max-width: 480px) {
    :root {
        --text-3xl: 28px;
    }

    .container {
        padding: 0 var(--space-4);
    }

    .navbar {
        height: 60px;
    }
}

/* ---- 平板竖屏 (481px - 767px) ---- */
@media (min-width: 481px) and (max-width: 767px) {
    .container {
        padding: 0 var(--space-5);
    }

    .product-stats {
        grid-template-columns: repeat(4, 1fr);
    }

    .vip-benefits {
        grid-template-columns: repeat(4, 1fr);
    }

    .action-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* ---- 所有移动端通用 (< 768px) ---- */
@media (max-width: 767px) {
    /* 视口适配 */
    html {
        font-size: 16px;
        -webkit-text-size-adjust: 100%;
    }

    body {
        -webkit-overflow-scrolling: touch;
        overflow-x: hidden;
    }

    /* 导航栏移动端优化 */
    .navbar {
        padding-top: var(--safe-top);
        height: calc(60px + var(--safe-top));
    }

    .navbar-brand span {
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* 移动端导航右侧区域 - 确保靠右 */
    .navbar-actions {
        margin-left: auto;
    }

    /* 导航栏登录按钮 - 移动端小巧黄色填充 */
    .nav-login-btn {
        height: 28px !important;
        padding: 0 12px !important;
        font-size: 12px !important;
        font-weight: 500 !important;
        border-radius: 4px !important;
        background: var(--brand-yellow) !important;
        border: none !important;
        color: #000 !important;
    }

    /* 隐藏桌面端用户区域 */
    .nav-user-desktop {
        display: none !important;
    }

    /* iOS 模态框关闭按钮优化 */
    .modal-close {
        width: 44px;
        height: 44px;
        min-width: 48px;
        min-height: 48px;
        font-size: 28px;
        right: var(--space-3);
    }

    /* 移动端用户区域 - 由JS控制显示/隐藏 */
    /* 不要用!important覆盖JS设置的display */

    /* 内容区域适配导航栏高度 */
    .content-top {
        padding-top: calc(60px + var(--safe-top));
    }

    .page-header {
        padding: calc(60px + var(--safe-top) + var(--space-4)) var(--space-4) var(--space-4);
    }

    /* 卡片移动端优化 */
    .card {
        border-radius: var(--radius-md);
    }

    .card-header,
    .card-body,
    .card-footer {
        padding: var(--space-3);
    }

    /* 按钮移动端触摸优化 */
    .btn {
        min-height: 44px;
        touch-action: manipulation;
    }

    .btn-lg {
        min-height: 48px;
    }

    /* 输入框移动端优化 */
    .form-input {
        min-height: 48px;
        font-size: 16px; /* 防止iOS自动缩放 */
    }

    /* 列表项移动端优化 */
    .list-item {
        padding: var(--space-3);
        min-height: 60px;
    }

    /* 产品卡片移动端 */
    .product-card {
        padding: var(--space-3);
    }

    /* 资产卡片移动端 */
    .asset-card {
        padding: var(--space-4);
    }

    /* VIP卡片移动端 */
    .vip-card-header {
        padding: var(--space-3);
    }

    .vip-price {
        position: static;
        transform: none;
        margin-top: var(--space-2);
    }

    .vip-level {
        flex-direction: column;
        align-items: flex-start;
    }

    /* FAQ移动端 */
    .faq-question {
        padding: var(--space-3);
    }

    .faq-content {
        padding: 0 var(--space-3) var(--space-3);
    }

    /* 弹窗移动端全屏 */
    .modal-content {
        max-height: 85vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }

    .modal-header {
        padding: var(--space-3);
    }

    .modal-body {
        padding: var(--space-3);
    }

    .modal-footer {
        padding: var(--space-3);
        padding-bottom: calc(var(--space-3) + var(--safe-bottom));
    }

    /* Toast移动端 */
    .toast-container {
        left: var(--space-3);
        right: var(--space-3);
        transform: none;
    }

    .toast {
        width: 100%;
    }

    /* 网格布局移动端 */
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
        gap: var(--space-3);
    }

    /* 工具类移动端覆盖 */
    .md\:grid-2,
    .md\:grid-3 {
        grid-template-columns: 1fr;
    }

    /* 空状态移动端 */
    .empty-state {
        padding: var(--space-8) var(--space-4);
    }

    .empty-icon {
        font-size: 40px;
    }

    /* 底部导航栏适配 */
    .tab-bar {
        height: calc(56px + var(--safe-bottom));
    }

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

    .tab-icon svg {
        width: 20px;
        height: 20px;
    }
}

/* ---- 横屏模式优化 ---- */
@media (max-height: 500px) and (orientation: landscape) {
    .navbar {
        height: 48px;
    }

    .content-top {
        padding-top: 48px;
    }

    .tab-bar {
        height: 48px;
    }

    .modal-content {
        max-height: 95vh;
    }

    .page-wrapper {
        padding-bottom: 48px;
    }
}

/* ---- 高分辨率屏幕优化 ---- */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .card,
    .product-card,
    .asset-card,
    .vip-card,
    .faq-item {
        border-width: 0.5px;
    }
}

/* ---- 深色模式下的文字可读性 ---- */
@media (prefers-color-scheme: dark) {
    body {
        -webkit-font-smoothing: antialiased;
    }
}

/* ---- 减少动画（用户偏好） ---- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---- 打印样式 ---- */
@media print {
    .navbar,
    .tab-bar,
    .modal-overlay {
        display: none !important;
    }

    .page-wrapper {
        padding-bottom: 0;
    }

    body {
        background: #fff;
        color: #000;
    }
}
