/* PC端自适应样式 - 取代移动端适配，支持平板和折叠屏自动缩放 */

/* 全局视口缩放设置 */
html {
    /* 使用标准的缩放属性 */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* 主容器自适应缩放 - 只对带有.container的页面生效 */
body:has(.container) {
    /* 设置固定的最小宽度,确保PC端布局 */
    min-width: 1200px;
    /* 在小屏幕上自动缩放 */
    transform-origin: top left;
}

/* 响应式缩放策略 - 基于viewport宽度自动缩放整个页面 - 只对带有.container的页面生效 */
@media screen and (max-width: 1920px) and (min-width: 1600px) {
    body:has(.container) {
        zoom: 0.95;
        transform: scale(0.95);
        width: calc(100% / 0.95);
    }
}

@media screen and (max-width: 1599px) and (min-width: 1400px) {
    body:has(.container) {
        zoom: 0.9;
        transform: scale(0.9);
        width: calc(100% / 0.9);
    }
}

@media screen and (max-width: 1399px) and (min-width: 1200px) {
    body:has(.container) {
        zoom: 0.85;
        transform: scale(0.85);
        width: calc(100% / 0.85);
    }
}

/* 小屏设备上不再整体缩放，由各页面自己的响应式样式处理 */
@media screen and (max-width: 1199px) {
    body:has(.container) {
        min-width: auto;
        zoom: 1;
        transform: none;
        width: auto;
    }
}

/* 确保表格在缩放时保持可读性 */
.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;
    }
}