﻿/* 移动端适配样式 */

/* 超小屏幕 (手机, < 576px) */
@media (max-width: 575.98px) {
    /* 隐藏桌面导航，显示汉堡菜单 */
    .desktop-nav {
        display: none !important;
    }

    .mobile-nav-toggle {
        display: block !important;
    }

    /* 表格水平滚动 */
    .table-responsive-mobile {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* 卡片全宽 */
    .card-grid {
        grid-template-columns: 1fr !important;
    }

    /* 统计卡片堆叠 */
    .stats-grid {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    /* 按钮全宽 */
    .btn-mobile-block {
        display: block;
        width: 100%;
        margin-bottom: 8px;
    }

    /* 字体大小调整 */
    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    /* 表单元素全宽 */
    .form-control, .form-select {
        font-size: 16px; /* 防止 iOS 缩放 */
    }

    /* 模态框全屏 */
    .modal-dialog {
        margin: 0;
        max-width: 100%;
    }

    .modal-content {
        border-radius: 0;
        min-height: 100vh;
    }

    /* 底部导航栏 */
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        display: flex;
        justify-content: space-around;
        padding: 8px 0;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 1000;
    }

    .mobile-bottom-nav-item {
        text-align: center;
        font-size: 12px;
        color: #6c757d;
    }

        .mobile-bottom-nav-item.active {
            color: #667eea;
        }

        .mobile-bottom-nav-item i {
            font-size: 20px;
            display: block;
            margin-bottom: 4px;
        }

    /* 主内容区域底部留空 */
    .main-content {
        padding-bottom: 70px;
    }
}

/* 小屏幕 (平板竖屏, ≥576px) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .mobile-bottom-nav {
        display: none;
    }

    .desktop-nav {
        display: block !important;
    }
}

/* 中等屏幕 (平板横屏, ≥768px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .desktop-nav {
        display: block !important;
    }

    .mobile-bottom-nav {
        display: none;
    }
}

/* 大屏幕 (桌面, ≥992px) */
@media (min-width: 992px) {
    .desktop-nav {
        display: block !important;
    }

    .mobile-bottom-nav {
        display: none;
    }
}

/* 触摸优化 */
@media (hover: none) and (pointer: coarse) {
    /* 增大可点击区域 */
    .btn,
    .nav-link,
    .dropdown-item,
    .list-group-item,
    a {
        min-height: 44px;
        padding: 12px 16px;
    }

        /* 移除 hover 效果 */
        .btn:hover {
            transform: none;
        }

    /* 改善滚动体验 */
    body {
        -webkit-overflow-scrolling: touch;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #121212;
        color: #e0e0e0;
    }

    .card, .modal-content, .dropdown-menu {
        background-color: #1e1e1e;
        border-color: #333;
    }

    .bg-light, .table-light {
        background-color: #2d2d2d !important;
    }

    .text-muted {
        color: #9e9e9e !important;
    }

    .border {
        border-color: #333 !important;
    }
}

/* 加载骨架屏 */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* 触摸反馈 */
.tap-highlight {
    -webkit-tap-highlight-color: rgba(102, 126, 234, 0.3);
}

/* 下拉刷新 */
.pull-to-refresh {
    position: fixed;
    top: -50px;
    left: 0;
    right: 0;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: top 0.3s;
    z-index: 1000;
}

    .pull-to-refresh.active {
        top: 0;
    }

    .pull-to-refresh .spinner {
        width: 30px;
        height: 30px;
        border: 3px solid #f3f3f3;
        border-top: 3px solid #667eea;
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }
