/* 六椰手工小屋 - 移动端专项优化 */

/* 响应式字体调整 */
@media (max-width: 768px) {
    html {
        font-size: 16px;
    }
    
    body {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
        font-size: 16px;
        line-height: 1.6;
        color: #333;
    }
}

/* 底部导航栏优化 */
@media (max-width: 768px) {
    .bottom-nav {
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
        padding: 15px 10px 25px;
        border-radius: 25px 25px 0 0;
        max-width: 100%;
    }
    
    .nav-item {
        flex: 1;
        min-width: 70px;
        max-width: 100px;
        padding: 8px 12px;
    }
    
    .nav-item i {
        font-size: 24px;
        margin-bottom: 4px;
    }
    
    .nav-item span {
        font-size: 12px;
        font-weight: 600;
    }
}

/* 触控目标优化 */
@media (max-width: 768px) {
    /* 确保所有可点击元素的尺寸至少为44x44px */
    button, a, input[type="button"], input[type="submit"], input[type="reset"], select {
        min-height: 44px;
        min-width: 44px;
        padding: 10px 16px;
    }
    
    /* 优化按钮样式 */
    .btn {
        min-height: 48px;
        font-size: 16px;
        font-weight: 600;
        border-radius: 12px;
        padding: 12px 24px;
    }
    
    /* 优化输入框 */
    input, textarea, select {
        min-height: 48px;
        font-size: 16px;
        padding: 12px 16px;
        border-radius: 12px;
        border: 2px solid #e1e5e9;
    }
    
    input:focus, textarea:focus, select:focus {
        border-color: #667eea;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
        outline: none;
    }
}

/* 布局优化 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
        padding-bottom: 120px; /* 为底部导航栏留出空间 */
    }
    
    /* 首页特定优化 */
    header {
        padding: 15px;
        margin-bottom: 15px;
        display: flex;
        flex-direction: column;
        gap: 15px;
        align-items: center;
        text-align: center;
    }
    
    .logo {
        margin-bottom: 10px;
    }
    
    .logo h1 {
        font-size: 20px;
    }
    
    .logo-icon {
        font-size: 28px;
    }
    
    .user-info {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .user-details {
        text-align: center;
    }
    
    .projects-grid {
        margin-top: 15px;
        margin-bottom: 20px;
        gap: 15px;
        grid-template-columns: 1fr;
    }
    
    .project-card {
        padding: 20px;
    }
    
    .project-icon {
        font-size: 40px;
        margin-bottom: 12px;
    }
    
    .project-name {
        font-size: 16px;
    }
    
    .project-description {
        font-size: 13px;
        margin-bottom: 15px;
    }
    
    .project-action {
        padding: 12px;
        font-size: 15px;
    }
    
    /* 紧凑布局 */
    .content {
        padding: 16px;
        margin-bottom: 12px;
    }
    
    /* 卡片间距 */
    .projects-grid {
        gap: 12px;
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    /* 卡片优化 */
    .project-card {
        padding: 16px;
        border-radius: 16px;
    }
    
    /* 头像优化 */
    .user-avatar {
        width: 60px;
        height: 60px;
    }
    
    /* 用户信息布局 */
    .user-info-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        text-align: center;
    }
    
    /* 用户详情布局 */
    .user-details {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    /* 用户详情项 */
    .user-detail-item {
        padding: 12px;
        border-radius: 12px;
    }
    
    /* 会员中心内容网格 */
    .content-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* 卡片内边距调整 */
    .section-card {
        padding: 15px;
    }
    
    /* 表格优化 */
    .table-container {
        margin-bottom: 15px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        border-radius: 8px;
        border: 1px solid #f0f0f0;
    }
    
    .table-container::-webkit-scrollbar {
        display: none;
    }
    
    table {
        font-size: 11px;
        min-width: 100%;
    }
    
    th, td {
        padding: 10px 8px;
        font-size: 11px;
        white-space: nowrap;
        text-align: left;
    }
    
    th {
        background-color: #f8f9fa;
        font-weight: 600;
        color: #666;
        font-size: 10px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    /* 小屏幕下隐藏次要列 */
    @media (max-width: 480px) {
        /* 项目历史表格 - 隐藏套餐列 */
        table:nth-of-type(2) th:nth-child(2),
        table:nth-of-type(2) td:nth-child(2) {
            display: none;
        }
        
        /* 订单历史表格 - 隐藏支付方式列 */
        table:nth-of-type(3) th:nth-child(4),
        table:nth-of-type(3) td:nth-child(4) {
            display: none;
        }
        
        /* 调整字体大小 */
        table {
            font-size: 10px;
        }
        
        th, td {
            padding: 8px 6px;
            font-size: 10px;
        }
    }
    
    /* 调整状态标签样式 */
    .status-badge {
        padding: 3px 8px;
        font-size: 10px;
        border-radius: 10px;
    }
    
    /* 调整头像大小 */
    .user-avatar {
        width: 100px;
        height: 100px;
        font-size: 36px;
        margin: 0 auto;
    }
    
    /* 调整用户信息网格 */
    .user-info-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    /* 优化用户信息区域 */
    .user-info-section {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    /* 调整用户详情布局 */
    .user-details {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    /* 调整标题样式 */
    .section-title {
        font-size: 16px;
        margin-bottom: 15px;
        padding-bottom: 8px;
        border-bottom: 1px solid #f0f0f0;
    }
    
    /* 调整表头标题 */
    .header-title {
        font-size: 18px;
        font-weight: 700;
        text-align: center;
        margin-bottom: 15px;
    }
    
    /* 调整返回按钮 */
    .back-btn {
        font-size: 20px;
        padding: 8px;
        border-radius: 50%;
        background-color: #f8f9fa;
    }
    
    /* 优化空状态显示 */
    .empty-state {
        padding: 30px 15px;
        text-align: center;
    }
    
    .empty-state-icon {
        font-size: 36px;
        margin-bottom: 10px;
    }
}

/* 滚动优化 */
@media (max-width: 768px) {
    html {
        scroll-behavior: smooth;
        scrollbar-width: thin;
        scrollbar-color: #c1c1c1 #f1f1f1;
    }
    
    /* 隐藏横向滚动条 */
    body {
        overflow-x: hidden;
    }
    
    /* 优化滚动容器 */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .table-container::-webkit-scrollbar {
        display: none;
    }
}

/* 模态框优化 */
@media (max-width: 768px) {
    .modal {
        padding: 0;
        background: rgba(0, 0, 0, 0.6);
    }
    
    .modal-content {
        margin: 20px auto;
        margin-top: 50px;
        width: 95%;
        max-width: 400px;
        max-height: calc(100vh - 40px);
        overflow-y: auto;
        border-radius: 20px;
        padding: 20px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    }
    
    /* 模态框表单优化 */
    .modal .form-group {
        margin-bottom: 16px;
    }
    
    .modal .form-label {
        font-size: 14px;
        font-weight: 600;
        margin-bottom: 8px;
    }
    
    .modal .form-input {
        min-height: 48px;
        font-size: 16px;
    }
    
    /* 模态框按钮组 */
    .modal-footer {
        flex-direction: column;
        gap: 12px;
    }
    
    .modal-footer .btn {
        width: 100%;
        min-height: 48px;
    }
}

/* 图片优化 */
@media (max-width: 768px) {
    img {
        max-width: 100%;
        height: auto;
        border-radius: 12px;
    }
    
    /* 优化logo显示 */
    .logo img {
        width: 48px;
        height: 48px;
    }
    
    /* 优化图标大小 */
    .project-icon {
        font-size: 40px;
    }
}

/* 文本优化 */
@media (max-width: 768px) {
    /* 标题优化 */
    h1, .page-title {
        font-size: 24px;
        font-weight: 700;
        margin-bottom: 20px;
        line-height: 1.3;
    }
    
    h2 {
        font-size: 20px;
        font-weight: 600;
        margin-bottom: 16px;
    }
    
    /* 段落优化 */
    p {
        margin-bottom: 16px;
        line-height: 1.6;
    }
    
    /* 防止文本溢出 */
    .text-ellipsis {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    /* 优化链接样式 */
    a {
        color: #667eea;
        text-decoration: none;
        font-weight: 500;
    }
    
    a:hover, a:active {
        text-decoration: underline;
    }
}

/* 表单优化 */
@media (max-width: 768px) {
    /* 优化表单布局 */
    .form-group {
        margin-bottom: 20px;
    }
    
    /* 优化标签 */
    label {
        display: block;
        font-size: 14px;
        font-weight: 600;
        margin-bottom: 8px;
        color: #333;
    }
    
    /* 优化输入框 */
    input[type="text"], input[type="password"], input[type="email"], input[type="tel"], input[type="number"], textarea {
        width: 100%;
        padding: 12px 16px;
        font-size: 16px;
        border: 2px solid #e1e5e9;
        border-radius: 12px;
        background-color: #fff;
        transition: all 0.2s ease;
    }
    
    /* 优化输入框焦点 */
    input:focus, textarea:focus {
        border-color: #667eea;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
        outline: none;
    }
    
    /* 优化选择框 */
    select {
        width: 100%;
        padding: 12px 16px;
        font-size: 16px;
        border: 2px solid #e1e5e9;
        border-radius: 12px;
        background-color: #fff;
        cursor: pointer;
    }
}

/* 动画优化 */
@media (max-width: 768px) {
    /* 减少动画效果，提升性能 */
    .project-card, .btn, .nav-item {
        transition: all 0.2s ease;
    }
    
    /* 优化悬停效果 */
    .project-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 30px rgba(255, 105, 180, 0.2);
    }
    
    /* 优化点击反馈 */
    .btn:active, .nav-item:active, .project-action:active {
        transform: scale(0.97);
        transition: transform 0.1s ease;
    }
}

/* 优化的间距类 */
@media (max-width: 768px) {
    .mt-sm-1 { margin-top: 8px; }
    .mt-sm-2 { margin-top: 16px; }
    .mt-sm-3 { margin-top: 24px; }
    .mb-sm-1 { margin-bottom: 8px; }
    .mb-sm-2 { margin-bottom: 16px; }
    .mb-sm-3 { margin-bottom: 24px; }
    .p-sm-1 { padding: 8px; }
    .p-sm-2 { padding: 16px; }
    .p-sm-3 { padding: 24px; }
}

/* 特殊元素优化 */
@media (max-width: 768px) {
    /* 优化状态标签 */
    .status-badge {
        padding: 6px 12px;
        font-size: 12px;
        font-weight: 700;
        border-radius: 16px;
    }
    
    /* 优化表格 */
    table {
        font-size: 14px;
    }
    
    th, td {
        padding: 12px 8px;
        font-weight: 600;
    }
    
    /* 优化统计卡片 */
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 12px;
    }
    
    .stat-card {
        padding: 16px;
        border-radius: 16px;
    }
    
    .stat-value {
        font-size: 28px;
        font-weight: 700;
    }
    
    .stat-label {
        font-size: 12px;
        font-weight: 600;
        margin-top: 4px;
    }
}

/* 横屏模式优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .container {
        padding-bottom: 100px;
    }
    
    .bottom-nav {
        padding: 10px 15px 15px;
    }
    
    .nav-item i {
        font-size: 22px;
    }
    
    .nav-item span {
        font-size: 11px;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    input, textarea, select, .btn, .nav-item {
        border: 2px solid currentColor;
    }
    
    .nav-item.active {
        background-color: #667eea;
        color: white;
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}