/* ============================================
   H5 会员充值系统 - 全局样式
   适配手机端，同时兼容电脑端展示
   ============================================ */

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

:root {
    --primary-color: #4F6EF7;
    --primary-light: #EEF2FF;
    --success-color: #22C55E;
    --warning-color: #F59E0B;
    --danger-color: #EF4444;
    --text-primary: #1D2129;
    --text-secondary: #4E5969;
    --text-placeholder: #C9CDD4;
    --bg-color: #F7F8FA;
    --bg-white: #FFFFFF;
    --border-color: #E5E6EB;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --radius: 12px;
    --radius-lg: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* 整体容器 */
.h5-container {
    max-width: 480px;
    margin: 0 auto;
    background: var(--bg-color);
    min-height: 100vh;
    position: relative;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.08);
}

/* 顶部标题栏 */
.h5-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--primary-color);
    color: #fff;
    padding: 0 16px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: 600;
}

/* 主内容区 */
.h5-main {
    padding: 12px 12px 80px;
}

/* ==================== 底部导航 ==================== */
.bottom-nav-wrapper {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    max-width: 480px;
    width: 100%;
    z-index: 100;
}

.bottom-nav {
    display: flex;
    background: var(--bg-white);
    border-top: 1px solid var(--border-color);
    padding: 6px 0 env(safe-area-inset-bottom, 6px);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-placeholder);
    font-size: 10px;
    padding: 4px 0;
    transition: color 0.2s;
}

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

.bottom-nav-icon {
    font-size: 22px;
    line-height: 1.2;
}

.bottom-nav-label {
    margin-top: 2px;
}

/* ==================== Toast 提示 ==================== */
.h5-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s;
    pointer-events: none;
    max-width: 80%;
    text-align: center;
}

.h5-toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* ==================== Loading ==================== */
#h5-loading {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.h5-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== 卡片通用 ==================== */
.card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

/* ==================== 按钮 ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    gap: 6px;
}

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

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

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

.btn-block {
    width: 100%;
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

/* ==================== 表单 ==================== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    color: var(--text-primary);
    background: var(--bg-color);
    transition: border-color 0.2s;
    outline: none;
}

.form-input:focus {
    border-color: var(--primary-color);
    background: #fff;
}

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

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

/* ==================== 复制按钮 ==================== */
.copy-btn {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0.5;
    transition: opacity 0.2s;
}
.copy-btn:hover {
    opacity: 1;
}

/* ==================== 支付方式选择按钮 ==================== */
.pay-method-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-white);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    text-align: left;
}
.pay-method-btn:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
}
.pay-method-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.pay-method-icon {
    font-size: 28px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.pay-method-info {
    flex: 1;
    min-width: 0;
}
.pay-method-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}
.pay-method-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}
.pay-method-arrow {
    font-size: 20px;
    color: var(--text-placeholder);
    flex-shrink: 0;
}

/* ==================== 自定义下拉选择器 ==================== */
.custom-select {
    position: relative;
    width: 100%;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    color: var(--text-primary);
    background: var(--bg-color);
    cursor: pointer;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.custom-select:hover {
    border-color: var(--primary-color);
}
.custom-select-arrow {
    font-size: 10px;
    color: var(--text-secondary);
    pointer-events: none;
}
.custom-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 200;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    max-height: 240px;
    overflow-y: auto;
    margin-top: 4px;
}
.custom-select-item {
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s;
}
.custom-select-item:hover {
    background: var(--primary-light);
}
.custom-select-item.active {
    background: var(--primary-light);
    color: var(--primary-color);
    font-weight: 600;
}

.form-error {
    font-size: 12px;
    color: var(--danger-color);
    margin-top: 4px;
}

/* ==================== 状态标签 ==================== */
.status-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status-pending {
    background: #FEF3C7;
    color: #D97706;
}

.status-paid {
    background: #D1FAE5;
    color: #059669;
}

.status-cancelled {
    background: #FEE2E2;
    color: #DC2626;
}

.status-declined {
    background: #FEE2E2;
    color: #B91C1C;
}

.status-refunded {
    background: #E0E7FF;
    color: #4F46E5;
}

.status-payment-initiated {
    background: #fff3e0;
    color: #e65100;
}

/* ==================== 首页 Hero ==================== */
.hero-section {
    background: linear-gradient(135deg, #4F6EF7 0%, #7C3AED 100%);
    border-radius: var(--radius-lg);
    padding: 28px 20px;
    color: #fff;
    margin-bottom: 16px;
    text-align: center;
}

.hero-section h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.hero-section p {
    font-size: 14px;
    opacity: 0.85;
    margin-bottom: 20px;
}

.hero-section .btn {
    background: #fff;
    color: var(--primary-color);
    padding: 12px 32px;
    font-size: 16px;
}

/* ==================== 套餐卡片 ==================== */
.plan-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.plan-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 16px 12px;
    text-align: center;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.plan-card.selected {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.plan-card.popular::before {
    content: 'Popular';
    position: absolute;
    top: 0;
    right: 0;
    background: var(--primary-color);
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 0 10px 0 8px;
}

.plan-card .plan-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.plan-card .plan-price {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.plan-card .plan-price small {
    font-size: 13px;
    font-weight: 400;
}

.plan-card .plan-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

.plan-card .plan-duration {
    font-size: 12px;
    color: var(--text-placeholder);
    margin-top: 6px;
}

/* ==================== 会员信息卡片 ==================== */
.vip-card {
    background: linear-gradient(135deg, #4F6EF7 0%, #7C3AED 100%);
    border-radius: var(--radius-lg);
    padding: 20px;
    color: #fff;
    margin-bottom: 16px;
}

.vip-card .vip-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.vip-card .vip-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.vip-card .vip-name {
    font-size: 17px;
    font-weight: 600;
}

.vip-card .vip-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.25);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    margin-top: 4px;
}

.vip-card .vip-stats {
    display: flex;
    gap: 24px;
}

.vip-card .vip-stat-item {
    text-align: center;
}

.vip-card .vip-stat-value {
    font-size: 20px;
    font-weight: 700;
}

.vip-card .vip-stat-label {
    font-size: 12px;
    opacity: 0.8;
}

/* ==================== 订单列表 ==================== */
.order-item {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
}

.order-item .order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.order-item .order-sn {
    font-size: 12px;
    color: var(--text-placeholder);
}

.order-item .order-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-item .order-plan {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.order-item .order-amount {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
}

.order-item .order-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.order-item .order-time {
    font-size: 12px;
    color: var(--text-placeholder);
}

/* ==================== 空状态 ==================== */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-placeholder);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-state .empty-text {
    font-size: 14px;
}

/* ==================== 链接按钮 ==================== */
.link-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
}

.link-btn:active {
    opacity: 0.7;
}

/* ==================== 分割线 ==================== */
.divider {
    height: 1px;
    background: var(--border-color);
    margin: 16px 0;
}

/* ==================== 详情页 ==================== */
.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row .detail-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.detail-row .detail-value {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}

/* 详情页多行容器（用于包裹多个 detail-row） */
.detail-rows {
    /* 允许子元素 .detail-row 正常渲染 */
}

/* ==================== 弹窗 ==================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-box {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    max-width: 340px;
    width: 100%;
}

.modal-box .modal-title {
    font-size: 17px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 16px;
}

/* ==================== 设置项列表 ==================== */
.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 14px 0;
    background: none;
    border: none;
    font-size: 15px;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
}

/* ==================== 登录/注册页 - 预留Chrome密码管理器空间 ==================== */
.auth-page .h5-container {
    overflow-y: auto;
}
.auth-page .h5-main {
    padding-bottom: 120px;
    overflow-y: auto;
}

/* ==================== 充值金额选择按钮 ==================== */
.amount-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 8px;
    border-radius: var(--radius);
    border: 2px solid var(--border-color);
    background: var(--bg-white);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}
.amount-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}
.amount-btn.active {
    border-color: var(--primary-color);
    background: var(--primary-light);
    color: var(--primary-color);
}

/* ==================== 安全区域适配 ==================== */
@media (min-width: 481px) {
    body {
        background: #E8EAED;
    }
    .h5-container {
        margin-top: 20px;
        margin-bottom: 20px;
        border-radius: 20px;
        overflow: hidden;
        box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
    }
}
