/* 全局响应式基础样式 */

/* 确保所有容器在移动端正确适应 */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* 图片响应式 */
img {
    max-width: 100%;
    height: auto;
}

/* 输入框在移动端防止缩放 */
input, textarea, select {
    font-size: 16px !important;
}

/* 平板及以下设备 (768px) */
@media (max-width: 768px) {
    .payment-buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px !important;
    }
    
    .payment-btn, .btn-wechat, .btn-alipay {
        padding: 6px 0 !important;
        font-size: 12px !important;
        height: 32px !important;
        line-height: 1.2 !important;
    }
    
    .payment-icon {
        width: 14px !important;
        height: 14px !important;
        margin-right: 2px !important;
    }
    
    /* 调整顶部导航栏中"首页"和"个人中心"文字样式 */
    .nav-menu-item, .profile-link {
        font-weight: 700 !important;
        font-size: 18px !important;
    }
    
    .profile-link i {
        font-size: 18px !important;
    }
    
    /* 通用容器响应式 */
    .container,
    .agent-upload-container,
    .wallet-container,
    .message-page,
    .withdrawals-page .page-header,
    .withdrawals-page .tabs,
    .withdrawals-page .tab-content {
        max-width: 100% !important;
        width: 100% !important;
    }
}

/* 手机设备 (480px) */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    /* 顶部用户栏 */
    .top-user-bar {
        width: calc(100% - 16px) !important;
        margin: 8px auto !important;
        padding: 10px !important;
    }
    
    /* 底部导航 */
    .bottom-nav {
        width: calc(100% - 16px) !important;
        bottom: 8px !important;
    }
    
    /* 滚动广告条 */
    .ad-scroll {
        width: calc(100% - 16px) !important;
    }
    
    /* 页面容器 */
    .function-page {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
    
    /* 表格响应式 */
    .balance-table {
        border-spacing: 4px 0 !important;
    }
    
    .balance-cell {
        padding: 6px 4px !important;
    }
    
    .balance-cell .balance-label {
        font-size: 9px !important;
    }
    
    .balance-cell .balance-amount {
        font-size: 12px !important;
    }
    
    /* 按钮响应式 */
    .btn-action {
        min-width: 60px !important;
        padding: 6px 8px !important;
        font-size: 11px !important;
    }
    
    /* 表单响应式 */
    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 10px !important;
    }
    
    /* 模态框响应式 */
    .modal-content {
        width: 95% !important;
        max-height: 85vh !important;
    }
}

/* 小屏手机 (360px) */
@media (max-width: 360px) {
    body {
        font-size: 13px;
    }
    
    .top-user-bar {
        width: calc(100% - 12px) !important;
        margin: 6px auto !important;
        padding: 8px !important;
    }
    
    .bottom-nav {
        width: calc(100% - 12px) !important;
        bottom: 6px !important;
        height: 52px !important;
    }
    
    .bottom-item span {
        font-size: 10px !important;
    }
    
    .bottom-item i {
        font-size: 18px !important;
    }
    
    /* 钱包页面卡片 */
    .balance-cell {
        padding: 4px 2px !important;
    }
    
    .balance-cell .balance-label {
        font-size: 8px !important;
    }
    
    .balance-cell .balance-amount {
        font-size: 11px !important;
    }
    
    /* 按钮更小 */
    .btn-action {
        min-width: 55px !important;
        padding: 5px 6px !important;
        font-size: 10px !important;
        height: 32px !important;
    }
    
    /* 页面标题 */
    h1, h2, h3 {
        font-size: 16px !important;
    }
    
    /* 推广页面统计表格 */
    .promotion-stats-table td {
        padding: 8px 2px !important;
    }
    
    .promotion-stats-table .label {
        font-size: 9px !important;
    }
    
    .promotion-stats-table .value {
        font-size: 12px !important;
    }
}

/* 超小屏手机 (320px) */
@media (max-width: 320px) {
    body {
        font-size: 12px;
    }
    
    .top-user-bar {
        padding: 6px !important;
    }
    
    .user-info-badge,
    .logout-badge {
        padding: 6px 10px !important;
        font-size: 12px !important;
    }
    
    .user-avatar-img {
        width: 24px !important;
        height: 24px !important;
    }
    
    .bottom-nav {
        height: 48px !important;
    }
    
    .bottom-item i {
        font-size: 16px !important;
    }
    
    .bottom-item span {
        font-size: 9px !important;
    }
    
    /* 隐藏部分文字只保留图标 */
    .btn-action span,
    .btn-action i + span:not(:only-child) {
        display: none;
    }
    
    .btn-action i {
        margin-right: 0 !important;
    }
}

/* 横屏模式 */
@media (max-height: 500px) and (orientation: landscape) {
    .bottom-nav {
        height: 48px !important;
    }
    
    .main-content {
        padding-bottom: 56px !important;
    }
    
    .modal-content {
        max-height: 90vh !important;
    }
}

/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* 确保边框在高分屏上清晰 */
    .balance-cell,
    .message-empty,
    .page-header,
    .tabs,
    .records-list,
    .qrcode-card,
    .apply-card {
        border-width: 0.5px;
    }
}

/* 安全区域适配 (iPhone X 及以上) */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .bottom-nav {
        padding-bottom: env(safe-area-inset-bottom) !important;
    }
    
    .main-content {
        padding-bottom: calc(72px + env(safe-area-inset-bottom)) !important;
    }
}

/* 防止文字溢出 */
.urgent-item-title,
.message-title,
.preview-item-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 长文本换行 */
.urgent-item-meta,
.record-time,
.form-hint {
    word-break: break-all;
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    /* 增加可点击区域 */
    .btn-action,
    .mode-card,
    .bottom-item,
    .tab {
        min-height: 44px;
    }
    
    /* 移除悬停效果 */
    .btn-action:hover,
    .mode-card:hover {
        transform: none !important;
    }
}
