/* ===== 布局重置 ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-size: 14px;
}

@media (min-width: 768px) {
    html { font-size: 16px; }
}

/* ===== 顶部导航栏 ===== */
.topbar {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #2c3e50;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1030;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.topbar-brand {
    font-size: 1.15rem;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
}
.topbar-brand:hover { color: #ecf0f1; }
.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.topbar-right .btn {
    font-size: 0.875rem;
}
.topbar-right .user-name {
    opacity: 0.85;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 移动端菜单按钮 */
.sidebar-toggle {
    display: none !important;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px 8px;
}
.menu-hint {
    display: none;
    color: rgba(255,255,255,0.5);
    font-size: 0.8rem;
    white-space: nowrap;
}
@media (max-width: 767.98px) {
    .menu-hint { display: inline; }
}

/* ===== 侧边栏 ===== */
.sidebar {
    position: fixed !important;
    top: 56px !important;
    left: 0 !important;
    bottom: 0;
    width: 220px;
    background: #34495e;
    overflow-y: auto;
    z-index: 1020;
    transition: transform 0.25s;
    margin: 0 !important;
    padding: 0 !important;
}
.sidebar-menu {
    list-style: none !important;
    padding: 8px 0 !important;
    margin: 0 !important;
}
.sidebar-menu li { margin: 0 !important; }
.sidebar-menu a {
    display: flex !important;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: #bdc3c7 !important;
    text-decoration: none !important;
    font-size: 0.925rem;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}
.sidebar-menu a:hover {
    background: rgba(255,255,255,0.06);
    color: #fff !important;
    border-left-color: #69a8f0;
}
.sidebar-menu a.active {
    background: rgba(105,168,240,0.15);
    color: #69a8f0 !important;
    border-left-color: #69a8f0;
    font-weight: 500;
}
.sidebar-menu .nav-section {
    padding: 16px 20px 6px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #7f8c8d !important;
}

/* ===== 主内容区域 ===== */
.main-content {
    margin-left: 220px;
    margin-top: 56px;
    padding: 24px;
    min-height: calc(100vh - 56px);
    background: #f5f7fa;
}

/* ===== 无侧边栏模式（登录页等） ===== */
.no-sidebar .main-content {
    margin-left: 0 !important;
}
.no-sidebar .sidebar {
    display: none !important;
}

/* ===== 移动端适配 ===== */
@media (max-width: 767.98px) {
    .sidebar-toggle { display: block !important; }

    .sidebar {
        transform: translateX(-100%);
        width: 260px;
    }
    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
        padding: 12px;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 1015;
        display: none;
    }
    .sidebar-overlay.show {
        display: block;
    }

    /* 表格横向滚动 */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table-wrap table { min-width: 700px; font-size: 0.8rem; }

    /* 弹窗全屏 */
    .modal-dialog { margin: 0; max-width: 100%; height: 100%; }
    .modal-content { border-radius: 0; height: 100%; overflow-y: auto; }

    /* 大触控目标 */
    input, select, textarea, button { font-size: 16px !important; }
    .btn { padding: 10px 16px; min-height: 44px; }

    /* 搜索栏换行 */
    .search-bar { flex-wrap: wrap; gap: 8px; }
    .search-bar input, .search-bar select { width: 100%; }

    /* 卡片全宽 */
    .card { margin-left: 0; margin-right: 0; }
    .container { padding-left: 8px; padding-right: 8px; }

    /* 分页精简 */
    .pagination a, .pagination span { padding: 4px 7px; font-size: 0.75rem; }

    /* 工具栏换行 */
    .toolbar { flex-direction: column; align-items: flex-start; }

    /* 顶部栏紧凑 */
    .topbar { padding: 0 12px; }
    .topbar-brand { font-size: 1rem; }
    .topbar-right .user-name { max-width: 80px; }

    /* 面包屑 */
    .breadcrumb-bar { font-size: 0.8rem; padding: 6px 12px; }
}
