﻿/* admin-mobile.css — 后台管理移动端适配（<768px 断点）
   全局 include，覆盖所有 admin 页面的 sidebar/topbar/main-content 布局 */

/* 汉堡菜单按钮（桌面端隐藏） */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1100;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 6px;
    background: #343a40;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.sidebar-toggle:active {
    background: #495057;
}

/* 遮罩层（移动端侧边栏打开时的背景） */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
}

@media (max-width: 767.98px) {
    /* 汉堡按钮显示 */
    .sidebar-toggle {
        display: flex;
    }

    /* 侧边栏默认隐藏，滑出式 */
    .sidebar {
        transform: translateX(-100%);
        z-index: 1050;
        width: 260px;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar.open ~ .sidebar-overlay {
        display: block;
    }

    /* 主内容区去掉左边距 */
    .main-content {
        margin-left: 0 !important;
    }

    /* 顶部栏调整 */
    .topbar {
        padding: 0 12px 0 56px;
        height: 50px;
    }
    .topbar .search-box {
        max-width: none;
        flex: 1;
    }

    /* 内容区减小内边距 */
    .content-area {
        padding: 12px;
    }

    /* 表格响应式：自动给没有 wrapper 的表格加横向滚动 */
    .content-area > .card > .card-body > table.table,
    .content-area > table.table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Bootstrap .table-responsive 容器内表格确保可滚动 */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* 卡片布局调整 */
    .card {
        margin-bottom: 12px;
    }
    .card-body {
        padding: 12px;
    }

    /* 表单全宽 */
    .form-control,
    .form-select {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* 模态框调整 */
    .modal-dialog {
        margin: 8px;
        max-width: calc(100% - 16px);
    }

    /* 统计卡片网格 - 两列 */
    .row .col-md-3,
    .row .col-lg-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    .row .col-md-4,
    .row .col-lg-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    .row .col-md-6,
    .row .col-lg-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* 待办卡片单列 */
    .todo-card {
        margin-bottom: 8px;
    }

    /* 分页居中缩小 */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
    .pagination .page-link {
        padding: 4px 10px;
        font-size: 13px;
    }

    /* 隐藏桌面端元素 */
    .d-none-mobile {
        display: none !important;
    }

    /* 顶部工具栏按钮缩小 */
    .btn {
        font-size: 13px;
    }
    .btn-sm {
        font-size: 12px;
    }

    /* 标题缩小 */
    h1, .h1 { font-size: 22px; }
    h2, .h2 { font-size: 18px; }
    h3, .h3 { font-size: 16px; }
    h4, .h4 { font-size: 15px; }
}

/* 平板适配（768px - 1024px） */
@media (min-width: 768px) and (max-width: 1023.98px) {
    .sidebar {
        width: 200px;
    }
    .main-content {
        margin-left: 200px !important;
    }
    .content-area {
        padding: 16px;
    }
}