/* 华阳炉具 移动端自适应+小程序兼容 全局CSS */
/* 版本：1.0 适配：手机端优先+微信小程序web-view */

/* 1. 全局重置与基础适配 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* 取消手机端点击高亮 */
    -webkit-text-size-adjust: 100%; /* 禁止微信字体缩放 */
}

html, body {
    width: 100%;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f5f5;
    overflow-x: hidden;
    /* 适配iPhone安全区域 */
    padding-top: constant(safe-area-inset-top);
    padding-top: env(safe-area-inset-top);
    padding-bottom: constant(safe-area-inset-bottom);
    padding-bottom: env(safe-area-inset-bottom);
}

/* 2. 小程序兼容：禁止横向滚动 */
.page-container {
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* 3. 手机端导航栏优化 */
/* 顶部导航栏 */
.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background-color: #2c3e50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 999;
    /* 适配安全区域 */
    padding-top: constant(safe-area-inset-top);
    padding-top: env(safe-area-inset-top);
    height: calc(56px + constant(safe-area-inset-top));
    height: calc(56px + env(safe-area-inset-top));
}

.mobile-header .logo {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-header .menu-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 24px;
    border: none;
    background: none;
    cursor: pointer;
}

/* 抽屉式侧边导航 */
.sidebar-drawer {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background-color: #2c3e50;
    z-index: 1000;
    transition: left 0.3s ease;
    overflow-y: auto;
    padding: 20px 0;
}

.sidebar-drawer.active {
    left: 0;
}

.sidebar-drawer .drawer-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid #34495e;
}

.sidebar-drawer .drawer-header h4 {
    color: #fff;
    font-size: 20px;
    font-weight: 600;
}

.sidebar-drawer .nav-list {
    list-style: none;
    padding: 10px 0;
}

.sidebar-drawer .nav-list li {
    margin-bottom: 5px;
}

.sidebar-drawer .nav-list li a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #fff;
    text-decoration: none;
    font-size: 16px;
    border-radius: 5px;
    transition: background-color 0.2s ease;
}

.sidebar-drawer .nav-list li a:hover,
.sidebar-drawer .nav-list li a.active {
    background-color: #34495e;
}

.sidebar-drawer .nav-list li a i {
    margin-right: 12px;
    font-size: 18px;
}

/* 遮罩层 */
.drawer-mask {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.drawer-mask.active {
    display: block;
}

/* 底部固定导航栏（手机端核心操作） */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-around;
    border-top: 1px solid #e0e0e0;
    z-index: 998;
    /* 适配安全区域 */
    padding-bottom: constant(safe-area-inset-bottom);
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(56px + constant(safe-area-inset-bottom));
    height: calc(56px + env(safe-area-inset-bottom));
}

.mobile-bottom-nav .nav-item {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #666;
    text-decoration: none;
    font-size: 12px;
}

.mobile-bottom-nav .nav-item.active {
    color: #0d6efd;
}

.mobile-bottom-nav .nav-item i {
    font-size: 20px;
    margin-bottom: 4px;
}

/* 4. 主内容区域适配 */
.main-content {
    margin: 0;
    padding: 72px 16px 80px; /* 顶部导航+底部导航预留空间 */
    width: 100%;
}

/* 5. 卡片式布局（手机端核心） */
.card {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 16px;
    overflow: hidden;
}

.card .card-header {
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
    background-color: #fafafa;
}

.card .card-header h5 {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.card .card-body {
    padding: 16px;
}

/* 6. 表单元素手机端优化 */
.form-control, .form-select {
    height: 48px;
    font-size: 16px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    padding: 0 16px;
    width: 100%;
    margin-bottom: 16px;
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.1);
}

.form-label {
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
    display: block;
    font-weight: 500;
}

.btn {
    height: 48px;
    font-size: 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: #0d6efd;
    color: #fff;
}

.btn-primary:active {
    background-color: #0b5ed7;
    transform: scale(0.98);
}

.btn-success {
    background-color: #198754;
    color: #fff;
}

.btn-warning {
    background-color: #ffc107;
    color: #212529;
}

/* 7. 表格手机端适配 */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* 手机端顺滑滚动 */
    border-radius: 8px;
    background-color: #fff;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table thead tr {
    background-color: #2c3e50;
    color: #fff;
}

.table th, .table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
    white-space: nowrap;
}

.table th {
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table tbody tr:hover {
    background-color: #f9f9f9;
}

/* 冻结首列适配 */
.table th:first-child,
.table td:first-child {
    position: sticky;
    left: 0;
    background-color: inherit;
    z-index: 11;
}

.table thead th:first-child {
    z-index: 12;
}

/* 8. 统计卡片手机端适配 */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background-color: #fff;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.stat-card p {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.stat-card h3 {
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
}

/* 9. 弹窗小程序兼容 */
.modal-mask {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-mask.active {
    display: flex;
}

.modal-box {
    background-color: #fff;
    border-radius: 10px;
    width: 100%;
    max-width: 400px;
    overflow: hidden;
}

.modal-box .modal-header {
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.modal-box .modal-header h5 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.modal-box .modal-body {
    padding: 20px 16px;
}

.modal-box .modal-footer {
    padding: 12px 16px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 12px;
}

.modal-box .modal-footer .btn {
    flex: 1;
}

/* 10. 工具类 */
.text-center {
    text-align: center;
}

.text-muted {
    color: #666;
}

.mb-16 {
    margin-bottom: 16px;
}

.mt-16 {
    margin-top: 16px;
}

/* 11. 小程序兼容：禁止长按复制 */
.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 12. 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0d6efd;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}