/* ========== 移动端全局样式 ========== */
@media (max-width: 768px) {
    body {
        font-size: 0.95rem;
    }
    h1 { font-size: 1.6rem; }
    h2 { font-size: 1.4rem; }
    h3 { font-size: 1.2rem; }

    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    /* 导航栏紧凑 */
    .navbar-brand {
        font-size: 1.1rem;
    }
    .nav-link {
        padding: 0.5rem 0.8rem;
        font-size: 0.9rem;
    }

    /* 卡片间距 */
    .card {
        margin-bottom: 1rem;
    }
    .card-body {
        padding: 1rem;
    }

    /* 按钮全宽 */
    .btn-lg {
        font-size: 1rem;
        padding: 0.65rem 1.5rem;
    }

    /* 表单元素 */
    .form-control-lg {
        font-size: 1rem;
        padding: 0.5rem 1rem;
    }

    /* 模态框全屏 */
    .modal-dialog {
        margin: 0.5rem;
        max-width: none;
    }

    /* 表格自适应滚动（后台页面常用） */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }

    /* 隐藏桌面端大背景 */
    .bg-gradient-primary {
        padding: 2rem 1rem !important;
    }

    /* 暗黑模式调整 */
    [data-bs-theme="dark"] .card {
        background-color: #1e1e2f;
    }
}

/* ========== 触摸优化 ========== */
@media (hover: none) and (pointer: coarse) {
    .btn, .nav-link, .list-group-item, .dropdown-item {
        padding: 0.75rem 1rem;
        min-height: 44px; /* iOS 推荐最小触摸区域 */
    }

    .navbar-toggler {
        padding: 0.75rem;
    }

    /* 增大表单输入框 */
    input, select, textarea {
        font-size: 16px !important; /* 防止 iOS 缩放 */
    }
}

/* ========== 底部固定导航（移动端可选） ========== */
.mobile-bottom-nav {
    display: none;
}
@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        border-top: 1px solid #dee2e6;
        z-index: 1030;
        justify-content: space-around;
        padding: 0.4rem 0;
        padding-bottom: env(safe-area-inset-bottom);
    }
    .mobile-bottom-nav a {
        text-align: center;
        font-size: 0.75rem;
        color: #6c757d;
        text-decoration: none;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .mobile-bottom-nav a.active {
        color: #0d6efd;
    }
    .mobile-bottom-nav i {
        font-size: 1.2rem;
    }

    /* 防止内容被底部导航遮挡 */
    body.has-bottom-nav {
        padding-bottom: 70px;
    }
}

/* 暗黑模式底部导航 */
[data-bs-theme="dark"] .mobile-bottom-nav {
    background: #1a1a2e;
    border-color: #333;
}
[data-bs-theme="dark"] .mobile-bottom-nav a {
    color: #adb5bd;
}

/* ===== 全局 UI 优化 ===== */
:root {
    --bs-border-radius: 0.75rem;
    --bs-card-border-radius: 1rem;
}
.card {
    border: none;
    transition: box-shadow 0.2s ease;
}
.card:hover {
    box-shadow: 0 0.5rem 1.5rem rgba(0,0,0,0.08);
}
.btn {
    border-radius: 0.5rem;
    font-weight: 500;
}
.btn-primary {
    background: linear-gradient(135deg, #0d6efd, #0b5ed7);
    border: none;
}
.btn-primary:hover {
    background: linear-gradient(135deg, #0b5ed7, #0a58ca);
    transform: translateY(-1px);
    box-shadow: 0 0.5rem 1rem rgba(13,110,253,0.3);
}
.navbar {
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.badge {
    font-weight: 500;
    letter-spacing: 0.3px;
}
.form-control:focus {
    box-shadow: 0 0 0 0.2rem rgba(13,110,253,0.15);
    border-color: #86b7fe;
}

/* 表格优化 */
.table {
    border-radius: 0.5rem;
    overflow: hidden;
}
.table thead th {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

/* 模态框优化 */
.modal-content {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 1rem 3rem rgba(0,0,0,0.2);
}

/* 回到顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #0d6efd;
    color: #fff;
    border: none;
    display: none;
    z-index: 999;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(13,110,253,0.4);
    transition: all 0.2s;
}
.back-to-top:hover {
    background: #0b5ed7;
    transform: translateY(-2px);
}

/* Toast 提示优化 */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
}
@media (max-width: 768px) {
    .swipe-area { touch-action: pan-y; }
}
