/**
 * 移动端样式修复 - 期货一键查网站
 */

/* 移动端表格优化 */
@media (max-width: 768px) {
    /* 页面基础布局 */
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    /* 表格响应式改进 */
    .table-responsive {
        border: 1px solid #dee2e6;
        border-radius: 0.375rem;
        margin-bottom: 1rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        margin-bottom: 0;
        font-size: 0.7rem;
        min-width: 100%;
    }
    
    .table th, .table td {
        padding: 0.25rem 0.15rem;
        font-size: 0.65rem;
        white-space: nowrap;
        min-width: 50px;
        max-width: none;
        vertical-align: middle;
    }
    
    .table th {
        position: sticky;
        top: 0;
        background-color: #e0f4f9 !important;
        z-index: 20;
        font-weight: 600;
        color: #333;
    }
    
    /* 交易所标题样式 */
    .exchange-title {
        font-size: 1rem;
        margin-bottom: 10px;
        text-align: center;
    }
    
    .exchange-section {
        margin-bottom: 20px;
        padding-bottom: 15px;
    }
    
    /* 期货手续费表格特殊处理 */
    .futures-fees-table,
    .data-table {
        font-size: 0.65rem;
    }
    
    .futures-fees-table th:first-child,
    .futures-fees-table td:first-child,
    .data-table th:first-child,
    .data-table td:first-child {
        min-width: 70px;
        position: sticky;
        left: 0;
        background-color: #fff;
        z-index: 10;
        border-right: 2px solid #dee2e6;
        font-weight: 500;
    }
    
    .futures-fees-table th:first-child,
    .data-table th:first-child {
        background-color: #e0f4f9 !important;
        z-index: 21;
        font-weight: 600;
    }
    
    /* 期权表格优化 */
    .options-table {
        font-size: 0.6rem;
    }
    
    .options-table th,
    .options-table td {
        padding: 0.2rem 0.1rem;
        font-size: 0.6rem;
        min-width: 45px;
    }
    
    /* 按钮组优化 */
    .btn-group-mobile,
    .btn-toolbar {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
        margin-bottom: 15px;
        justify-content: center;
    }
    
    .btn-group-mobile .btn,
    .btn-toolbar .btn {
        flex: 1;
        min-width: calc(50% - 2.5px);
        font-size: 0.75rem;
        padding: 0.375rem 0.5rem;
        white-space: nowrap;
    }
    
    /* 品种选择按钮优化 */
    .product-item {
        margin: 2px;
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
        min-width: auto;
        flex: none;
    }
    
    /* 搜索框优化 */
    .search-container,
    .form-group {
        margin-bottom: 15px;
    }
    
    .search-container .form-control,
    .form-control {
        font-size: 16px; /* 防止iOS自动缩放 */
        padding: 0.5rem 0.75rem;
    }
    
    /* 卡片容器优化 */
    .card {
        margin-bottom: 15px;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .card-header {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        font-weight: 600;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    /* 导航栏优化 */
    .navbar-nav .nav-link {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    /* 轮播图优化 */
    .hero-swiper {
        height: auto;
        min-height: 450px;
    }
    
    .swiper-slide {
        padding: 15px 10px;
    }
    
    .slide-title {
        font-size: 24px !important;
        margin-bottom: 15px;
        line-height: 1.2;
    }
    
    .slide-text {
        font-size: 15px !important;
        margin-bottom: 20px;
        line-height: 1.4;
    }
    
    .slide-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
    
    /* 图片优化 */
    .hero-image img {
        height: 200px !important;
        width: 100%;
        object-fit: cover;
    }
    
    /* 特色卡片优化 */
    .feature-card {
        margin-bottom: 20px;
        padding: 1.5rem 1rem;
    }
    
    /* 页脚优化 */
    .footer-nav {
        flex-direction: column;
    }
    
    .footer-column {
        margin-bottom: 20px;
        text-align: center;
    }
    
    .footer-load-time {
        flex-direction: column;
        gap: 5px;
    }
    
    .load-time-separator {
        display: none;
    }
}

/* 超小屏幕优化 (iPhone SE等) */
@media (max-width: 375px) {
    .container {
        padding-left: 8px;
        padding-right: 8px;
    }
    
    .table th, .table td {
        padding: 0.15rem 0.08rem;
        font-size: 0.6rem;
        min-width: 40px;
    }
    
    .btn-group-mobile .btn,
    .btn-toolbar .btn {
        font-size: 0.7rem;
        padding: 0.25rem 0.375rem;
        min-width: calc(50% - 2.5px);
    }
    
    .slide-title {
        font-size: 20px !important;
    }
    
    .slide-text {
        font-size: 13px !important;
    }
    
    .product-item {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }
}

/* 平板设备优化 */
@media (min-width: 769px) and (max-width: 991px) {
    .table th, .table td {
        padding: 0.3rem 0.4rem;
        font-size: 0.8rem;
    }
    
    .hero-swiper {
        height: 480px;
    }
    
    .slide-title {
        font-size: 32px;
    }
    
    .slide-text {
        font-size: 17px;
    }
}

/* 横向模式优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .hero-swiper {
        height: 350px;
        min-height: 350px;
    }
    
    .slide-title {
        font-size: 22px !important;
        margin-bottom: 10px;
    }
    
    .slide-text {
        font-size: 14px !important;
        margin-bottom: 15px;
    }
    
    .swiper-slide {
        padding: 10px;
    }
}

/* 触摸设备滚动优化 */
@media (hover: none) and (pointer: coarse) {
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* 增大触摸目标 */
    .btn, .nav-link, .page-link, .product-item {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        touch-action: manipulation;
    }
    
    /* 表格行高增加以便触摸 */
    .table td, .table th {
        min-height: 36px;
    }
    
    /* 滚动条样式 */
    .table-responsive::-webkit-scrollbar {
        height: 8px;
    }
    
    .table-responsive::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 4px;
    }
    
    .table-responsive::-webkit-scrollbar-thumb {
        background: #c1c1c1;
        border-radius: 4px;
    }
    
    .table-responsive::-webkit-scrollbar-thumb:hover {
        background: #a8a8a8;
    }
}

/* 修复iOS Safari的100vh问题 */
@supports (-webkit-touch-callout: none) {
    .hero-swiper {
        height: calc(100vh - 200px);
        max-height: 600px;
        min-height: 400px;
    }
}

/* 高分辨率屏幕优化 */
@media (min-resolution: 192dpi) {
    .table th, .table td {
        border-width: 0.5px;
    }
}

/* 深色模式兼容性 */
@media (prefers-color-scheme: dark) {
    .table th {
        background-color: #2d3748 !important;
        color: #fff;
    }
    
    .table-striped tbody tr:nth-of-type(odd) {
        background-color: rgba(255, 255, 255, 0.05);
    }
    
    .futures-fees-table th:first-child,
    .data-table th:first-child {
        background-color: #2d3748 !important;
    }
    
    .futures-fees-table td:first-child,
    .data-table td:first-child {
        background-color: #1a202c;
    }
}