/* ============================================
   移动端响应式优化样式系统 - 统一字体系统
   ============================================ */

/* 基础重置与优化 */
* {
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
}

html {
    font-size: 16px; /* 基础字体大小 */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    letter-spacing: -0.01em;
    color: #1a1a1a;
    touch-action: manipulation;
}

/* ============================================
   统一字体系统 - 移动端优化
   ============================================ */

/* 标题字体系统 */
.text-display {
    font-size: clamp(24px, 6vw, 32px);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.text-heading-1 {
    font-size: clamp(20px, 5vw, 28px);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.015em;
}

.text-heading-2 {
    font-size: clamp(18px, 4.5vw, 24px);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.text-heading-3 {
    font-size: clamp(16px, 4vw, 20px);
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -0.005em;
}

.text-heading-4 {
    font-size: clamp(15px, 3.5vw, 18px);
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0;
}

/* 正文字体系统 */
.text-body-large {
    font-size: clamp(16px, 4vw, 18px);
    font-weight: 400;
    line-height: 1.6;
    letter-spacing: 0;
}

.text-body {
    font-size: clamp(14px, 3.5vw, 16px);
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: 0;
}

.text-body-small {
    font-size: clamp(13px, 3vw, 14px);
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: 0.01em;
}

.text-caption {
    font-size: clamp(12px, 2.5vw, 13px);
    font-weight: 400;
    line-height: 1.4;
    letter-spacing: 0.02em;
}

/* 标签和按钮字体 */
.text-label-large {
    font-size: clamp(14px, 3.5vw, 16px);
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0;
}

.text-label {
    font-size: clamp(13px, 3vw, 14px);
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0.01em;
}

.text-label-small {
    font-size: clamp(12px, 2.5vw, 13px);
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0.02em;
}

/* 按钮字体 */
.btn-text {
    font-size: clamp(14px, 3.5vw, 16px);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.01em;
}

.btn-text-small {
    font-size: clamp(13px, 3vw, 14px);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.01em;
}

/* 字重系统 */
.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }

/* 响应式断点字体调整 */
@media (max-width: 320px) {
    html { font-size: 14px; }
    .text-body { font-size: 14px; }
    .text-label { font-size: 13px; }
}

@media (min-width: 321px) and (max-width: 375px) {
    html { font-size: 15px; }
    .text-body { font-size: 15px; }
    .text-label { font-size: 14px; }
}

@media (min-width: 376px) and (max-width: 414px) {
    html { font-size: 16px; }
    .text-body { font-size: 16px; }
    .text-label { font-size: 15px; }
}

@media (min-width: 415px) and (max-width: 767px) {
    html { font-size: 16px; }
    .text-body { font-size: 16px; }
    .text-label { font-size: 15px; }
}

@media (min-width: 768px) {
    html { font-size: 16px; }
    .text-body { font-size: 16px; }
    .text-label { font-size: 14px; }
}

/* 流式布局容器 */
.container-fluid {
    width: 100%;
    max-width: 100%;
    padding-left: 4vw;
    padding-right: 4vw;
}

/* 弹性布局 - 手机端垂直排列 */
.flex-mobile-column {
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .flex-mobile-column {
        flex-direction: row;
    }
}

/* 触控友好按钮 */
.btn-touch {
    min-width: 44px;
    min-height: 44px;
    padding: 12px 20px;
    font-size: 16px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    transition: transform 0.2s, opacity 0.2s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-touch:active {
    transform: scale(0.95);
    opacity: 0.9;
}

.btn-touch-primary {
    background: linear-gradient(135deg, #2560FF 0%, #1E4FE6 100%);
    color: white;
}

.btn-touch-secondary {
    background: #f0f0f0;
    color: #333;
}

/* 触控友好链接 */
a.touch-link {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    touch-action: manipulation;
}

/* 汉堡菜单 */
.hamburger-menu {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    background: transparent;
    border: none;
    transition: background-color 0.2s;
    touch-action: manipulation;
}

.hamburger-menu:active {
    background-color: rgba(0, 0, 0, 0.1);
}

.hamburger-menu span {
    width: 24px;
    height: 3px;
    background-color: #333;
    border-radius: 2px;
    transition: all 0.3s;
}

/* 侧边栏抽屉 */
.sidebar-drawer {
    position: fixed;
    top: 0;
    left: -100%;
    width: min(280px, 80vw);
    height: 100vh;
    background: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transition: left 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sidebar-drawer.open {
    left: 0;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 999;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* 底部导航栏 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.bottom-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    min-height: 44px;
    min-width: 44px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 12px;
    cursor: pointer;
    touch-action: manipulation;
    transition: color 0.2s, transform 0.2s;
    border-radius: 8px;
}

.bottom-nav-btn:active {
    transform: scale(0.95);
    background-color: rgba(0, 0, 0, 0.05);
}

.bottom-nav-btn.active {
    color: #2560FF;
}

.bottom-nav-btn i {
    font-size: 20px;
    margin-bottom: 4px;
}

/* 表单优化 */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 16px;
    font-weight: 500;
    color: #333;
}

.form-input {
    width: 100%;
    min-height: 44px;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background: white;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus {
    outline: none;
    border-color: #2560FF;
}

.form-input[type="tel"] {
    inputmode: tel;
}

.form-input[type="email"] {
    inputmode: email;
}

/* 表格优化 - 垂直滚动 */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: block;
}

.table-responsive table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
}

/* 卡片式表格（移动端） */
.table-card {
    display: none;
}

@media (max-width: 767px) {
    .table-responsive {
        display: none;
    }
    
    .table-card {
        display: block;
    }
    
    .table-card-item {
        background: white;
        border-radius: 12px;
        padding: 16px;
        margin-bottom: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }
}

/* 图片自适应 */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* 弹窗优化 - 全屏或底部弹出 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    border-radius: 20px 20px 0 0;
    padding: 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateY(100%);
    transition: transform 0.3s;
}

.modal.show .modal-content {
    transform: translateY(0);
}

@media (min-width: 768px) {
    .modal {
        align-items: center;
    }
    
    .modal-content {
        max-width: 500px;
        border-radius: 20px;
        max-height: 80vh;
    }
}

/* 内容区域间距 */
.content-wrapper {
    padding: 16px;
    padding-bottom: 100px; /* 为底部导航留出空间 */
}

/* 卡片样式 */
.card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* 间距系统 */
.spacing-xs { margin-bottom: 8px; }
.spacing-sm { margin-bottom: 12px; }
.spacing-md { margin-bottom: 16px; }
.spacing-lg { margin-bottom: 24px; }
.spacing-xl { margin-bottom: 32px; }

/* 响应式断点 */
@media (max-width: 320px) {
    html { font-size: 14px; }
    .container-fluid { padding-left: 12px; padding-right: 12px; }
}

@media (min-width: 321px) and (max-width: 375px) {
    html { font-size: 15px; }
}

@media (min-width: 376px) and (max-width: 414px) {
    html { font-size: 16px; }
}

@media (min-width: 415px) and (max-width: 767px) {
    html { font-size: 16px; }
}

@media (min-width: 768px) {
    html { font-size: 16px; }
    .container-fluid { padding-left: 24px; padding-right: 24px; }
    .content-wrapper { padding: 24px; padding-bottom: 24px; }
}

/* 隐藏非核心元素（移动端） */
@media (max-width: 767px) {
    .hide-mobile {
        display: none !important;
    }
    
    .show-mobile {
        display: block !important;
    }
}

@media (min-width: 768px) {
    .hide-desktop {
        display: none !important;
    }
    
    .show-desktop {
        display: block !important;
    }
}

/* 滚动优化 */
.scroll-smooth {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* 加载优化 - 懒加载占位 */
.lazy-load {
    opacity: 0;
    transition: opacity 0.3s;
}

.lazy-load.loaded {
    opacity: 1;
}

/* 性能优化 */
.will-change-transform {
    will-change: transform;
}

/* 触摸反馈 */
.touch-feedback:active {
    transform: scale(0.98);
    opacity: 0.8;
}
