/* PC端自适应样式
 * 不再对常规桌面端做整页 transform/zoom 缩放。
 * 1080P/2K 这类分辨率应优先使用真实响应式布局，避免出现底部留白、滚动区域错位和点击热区偏移。
 */

/* 全局视口缩放设置 */
html {
    /* 使用标准的缩放属性 */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* 主容器基础规则 - 只对带有.container的页面生效 */
body:has(.container) {
    min-width: 0;
    transform: none !important;
    zoom: 1 !important;
    width: auto !important;
    overflow-x: hidden;
}

/* 全局兜底：禁用各页面额外叠加的 scaled-container 缩放 */
.scaled-container {
    transform: none !important;
    width: 100% !important;
}

/* 常规桌面端不再缩放，只做布局收敛 */
@media screen and (max-width: 1600px) {
    .sidebar {
        min-width: 220px;
        width: 220px;
    }

    .main-content {
        padding: 16px !important;
    }

    .stats-grid {
        gap: 16px;
    }
}

@media screen and (max-width: 1366px) {
    .sidebar {
        min-width: 200px;
        width: 200px;
    }

    .main-content {
        padding: 14px !important;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 14px;
    }

    .filters, .toolbar {
        gap: 8px;
    }
}

/* 确保表格在缩放时保持可读性 */
.table {
    font-size: 14px;
    white-space: nowrap;
}

/* 确保按钮在缩放时保持可点击 */
.btn {
    min-height: 36px;
    padding: 8px 16px;
}

/* 确保表单元素在缩放时保持可用性 */
.form-control, .input {
    min-height: 36px;
    padding: 8px 12px;
}

/* 侧边栏保持固定宽度比例 */
.sidebar {
    min-width: 250px;
    flex-shrink: 0;
}

/* 主内容区域自适应 */
.main-content {
    flex: 1;
    min-width: 0; /* 允许内容收缩 */
    overflow-x: auto; /* 水平滚动条在需要时显示 */
}

/* 确保卡片网格在缩放时保持布局 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* 表格容器水平滚动优化 */
.table-container {
    overflow-x: auto;
    max-width: 100%;
}

.table-container .table {
    min-width: 800px; /* 确保表格有最小宽度 */
}

/* 模态框在缩放时的适配 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
}

.modal-content {
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
}

/* 工具栏和筛选器优化 */
.filters, .toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

/* 响应式网格系统 */
.grid {
    display: grid;
    gap: 20px;
}

.grid-1 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* 在小屏幕上自动调整网格列数 */
@media screen and (max-width: 1199px) {
    .grid-4 { grid-template-columns: repeat(3, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media screen and (max-width: 899px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* 文本缩放优化 */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
}

/* 确保重要内容在缩放时仍然可见 */
.important-content {
    font-size: 14px;
    min-width: max-content;
}

/* 平板横屏优化 */
@media screen and (orientation: landscape) and (max-width: 1366px) {
    .sidebar {
        width: 200px;
    }
    
    .nav-item {
        padding: 10px 15px;
        font-size: 14px;
    }
}

/* 折叠屏 / 超大屏只做轻度放大，不影响常规桌面 */
@media screen and (max-width: 2560px) and (min-width: 2000px) {
    body {
        zoom: 1.05;
    }
}

/* 超宽屏优化 */
@media screen and (min-width: 2561px) {
    body {
        zoom: 1.1;
        max-width: 2400px;
        margin: 0 auto;
    }
}

/* 打印样式优化 */
@media print {
    body {
        transform: none !important;
        zoom: 1 !important;
        min-width: auto !important;
    }
    
    .sidebar {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
}

/* 触摸设备优化 */
@media (pointer: coarse) {
    .btn {
        min-height: 44px;
        padding: 12px 20px;
    }
    
    .nav-item {
        padding: 15px 20px;
    }
}

/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}