/* 零件管理系统样式 - 统一字体规范 */
/* 最后更新：2026-03-18 */

/* ===== 全局字体规范 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    width: 100vw;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 100%;
    margin: 0;
    width: 100%;
    padding: 0 20px;
}

/* ===== 标题样式统一 ===== */
h1 {
    color: white;
    text-align: center;
    margin-bottom: 30px;
    font-size: 32px;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    letter-spacing: 0.5px;
}

h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

h3 {
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.card {
    background: white;
    border-radius: 10px;
    padding: 28px;
    margin-bottom: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

/* 表单样式优化 - 宽松模式 */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 600;
    font-size: 14px;
}

.required {
    color: #e74c3c;
    font-weight: 600;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e8ecef;
    border-radius: 6px;
    font-size: 14px;
    color: #2c3e50;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input[readonly] {
    background-color: #f8f9fa;
    cursor: not-allowed;
    color: #6c757d;
    border-color: #e8ecef;
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: #95a5a6;
    font-size: 12px;
    line-height: 1.5;
}

.form-group input[list] {
    position: relative;
}

.form-group input[required]:invalid {
    border-color: #e74c3c;
}

.form-group input[required]:valid {
    border-color: #27ae60;
}

/* 搜索和筛选栏 */
.search-filter-bar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    align-items: center;
}

.search-box input {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e8ecef;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-box {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-box label {
    font-weight: 600;
    color: #2c3e50;
    white-space: nowrap;
}

.filter-box select {
    padding: 8px 12px;
    border: 2px solid #e8ecef;
    border-radius: 6px;
    font-size: 14px;
    min-width: 180px;
    background: white;
    cursor: pointer;
}

.filter-box select:focus {
    outline: none;
    border-color: #667eea;
}

@media (max-width: 768px) {
    .search-filter-bar {
        grid-template-columns: 1fr;
    }
    
    .filter-box {
        justify-content: flex-start;
    }
}

/* 顶部用户信息栏 */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    color: white;
}

.btn-logout {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.3);
}

/* 左右分栏布局 - 全屏宽屏优化 */
.main-content {
    display: grid;
    grid-template-columns: 400px minmax(0, 1fr);
    gap: 25px;
    margin-bottom: 30px;
    align-items: start;
    width: 100%;
}

.main-content .card {
    margin-bottom: 0;
}

/* 左侧上传表单固定宽度，可滚动 */
.main-content > .card:first-child {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.main-content > .card:first-child::-webkit-scrollbar {
    width: 6px;
}

.main-content > .card:first-child::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.main-content > .card:first-child::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

/* 按钮样式 */
.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 0.3px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-danger {
    background: #e74c3c;
    color: white;
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 4px;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-download {
    background: #27ae60;
    color: white;
    padding: 6px 12px;
    font-size: 13px;
    text-decoration: none;
    display: inline-block;
    border-radius: 4px;
    transition: background 0.3s;
}

.btn-download:hover {
    background: #229954;
}

.btn-export {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 0.3px;
}

.btn-export:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(17, 153, 142, 0.4);
}

/* ===== 表格样式统一 ===== */
.table-container {
    overflow-x: auto;
    overflow-y: auto;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.table-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

th {
    padding: 14px 16px;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    border-right: 1px solid rgba(255,255,255,0.15);
    letter-spacing: 0.3px;
}

th:last-child {
    border-right: none;
}

td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #e8ecef;
    font-size: 14px;
    color: #555;
}

/* 表格内容字体统一 */
td strong {
    color: #2c3e50;
    font-weight: 600;
}

/* 等宽字体统一（用于图号、零件代号等） */
td code,
td .mono,
td[style*="Courier New"],
th[style*="Courier New"] {
    font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Mono", "Courier New", monospace;
    font-size: 13px;
    color: #6c757d;
}

/* 列宽优化 - 全屏宽屏模式 */
th:nth-child(1), td:nth-child(1) { /* 项目号 */
    min-width: 100px;
    max-width: 130px;
}
th:nth-child(2), td:nth-child(2) { /* 零件名称 */
    min-width: 200px;
    max-width: 240px;
    white-space: normal;
    word-break: break-all;
}
th:nth-child(3), td:nth-child(3) { /* 零件图号 */
    min-width: 200px;
    max-width: 240px;
}
th:nth-child(4), td:nth-child(4) { /* 零件代号 */
    min-width: 180px;
    max-width: 220px;
}
th:nth-child(5), td:nth-child(5) { /* 版本 */
    min-width: 100px;
    max-width: 120px;
    text-align: center;
}
th:nth-child(6), td:nth-child(6) { /* 物料编码 */
    min-width: 180px;
    max-width: 220px;
}
th:nth-child(7), td:nth-child(7) { /* 材料 */
    min-width: 100px;
    max-width: 140px;
}
th:nth-child(8), td:nth-child(8) { /* 用量 */
    min-width: 50px;
    max-width: 70px;
    text-align: center;
}
th:nth-child(9), td:nth-child(9) { /* 图纸文件 */
    min-width: 90px;
    max-width: 120px;
    text-align: center;
}
th:nth-child(10), td:nth-child(10) { /* 操作 */
    min-width: 140px;
    max-width: 180px;
    text-align: center;
}

tbody tr:hover {
    background: #f8f9fa;
}

.loading, .no-data {
    text-align: center;
    padding: 40px 20px;
    color: #888;
}

.file-actions {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}

/* 版本号标签 */
.version-tag {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

/* 版本下拉列表 */
.version-select {
    padding: 6px 10px;
    border: 1px solid #e8ecef;
    border-radius: 4px;
    font-size: 13px;
    width: 100%;
    background: white;
    cursor: pointer;
    color: #2c3e50;
}

.version-select:hover {
    border-color: #667eea;
}

/* 文件类型缩略图标 */
.file-type-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s;
    vertical-align: middle;
    border: 1px solid #e8ecef;
}

.file-type-icon:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.file-type-icon.pdf { background: #ffebee; color: #e53935; }
.file-type-icon.dwg, .file-type-icon.dxf { background: #e3f2fd; color: #1e88e5; }
.file-type-icon.step, .file-type-icon.stp { background: #e8f5e9; color: #43a047; }
.file-type-icon.igs, .file-type-icon.iges { background: #fff3e0; color: #fb8c00; }
.file-type-icon.prt, .file-type-icon.sldprt { background: #f3e5f5; color: #8e24aa; }
.file-type-icon.default { background: #f5f5f5; color: #757575; }

/* 图号规范提示框 */
.drawing-number-info {
    background: #f0f7ff;
    border: 1px solid #b3d9ff;
    border-radius: 4px;
    padding: 12px;
    margin-top: 6px;
    font-size: 12px;
    color: #004085;
    line-height: 1.6;
}

.drawing-number-info code {
    background: #e6f3ff;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    color: #0056b3;
    font-weight: 600;
}

.drawing-number-info strong {
    color: #004085;
    display: block;
    margin-bottom: 6px;
}

/* 版本列表 */
.version-list {
    max-height: 150px;
    overflow-y: auto;
    font-size: 12px;
    background: #f9f9f9;
    border-radius: 4px;
    padding: 8px;
}

.version-item {
    padding: 6px 8px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.version-item:last-child {
    border-bottom: none;
}

.version-item a {
    color: #27ae60;
    text-decoration: none;
    font-weight: 500;
}

.version-item a:hover {
    text-decoration: underline;
}

/* 消息提示 */
.message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 5px;
    display: none;
    font-size: 14px;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

/* 预览弹窗 */
.preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

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

.preview-content {
    background: white;
    padding: 0;
    border-radius: 8px;
    max-width: 95%;
    max-height: 95%;
    position: relative;
    overflow: auto;
    box-shadow: 0 10px 50px rgba(0,0,0,0.5);
}

.preview-close {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #f44336;
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 28px;
    z-index: 10001;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    transition: all 0.3s;
}

.preview-close:hover {
    background: #d32f2f;
    transform: scale(1.1);
}

.preview-content iframe {
    width: 90vw;
    height: 90vh;
    border: none;
}

.preview-content img {
    max-width: 95vw;
    max-height: 90vh;
    object-fit: contain;
}

.preview-info {
    text-align: center;
    padding: 60px 40px;
    color: #666;
    background: white;
    border-radius: 8px;
}

.preview-info h3 {
    font-size: 24px;
    margin-bottom: 20px;
    color: #333;
}

.preview-info p {
    font-size: 16px;
    margin: 10px 0;
}

.preview-controls {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    z-index: 10001;
}

.preview-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid rgba(255,255,255,0.5);
    padding: 12px 24px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 16px;
    backdrop-filter: blur(10px);
    transition: all 0.3s;
}

.preview-btn:hover {
    background: rgba(255,255,255,0.3);
    border-color: white;
}

.preview-title {
    position: fixed;
    top: 20px;
    left: 20px;
    color: white;
    font-size: 18px;
    background: rgba(0,0,0,0.6);
    padding: 10px 20px;
    border-radius: 30px;
    backdrop-filter: blur(10px);
    z-index: 10001;
}

/* 导出 BOM 按钮 */
.btn-export {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-export:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(17, 153, 142, 0.4);
}

/* ===== BOM 管理页面样式 ===== */
.bom-save-bar {
    padding: 18px 25px;
    background: #f8f9fa;
    border-top: 1px solid #e8ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* BOM 编辑弹窗 */
.bom-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 10000;
}

.bom-modal.active {
    display: block;
}

.bom-modal-content {
    background: white;
    margin: 20px auto;
    max-width: 1400px;
    width: 95%;
    height: calc(100vh - 40px);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.bom-modal-header {
    padding: 18px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.bom-modal-header h2 {
    margin: 0;
    font-size: 1.4em;
    font-weight: 600;
    color: white;
    border: none;
}

.bom-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
}

.bom-modal-body {
    flex: 1;
    padding: 20px;
    overflow: auto;
    background: #f8f9fa;
}

.bom-tree-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.bom-node {
    background: white;
    border-radius: 8px;
    padding: 10px 60px 10px 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    position: relative;
    min-height: 40px;
    transition: all 0.3s;
}

.bom-node:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.12);
    transform: translateY(-1px);
}

.bom-node.level-0 {
    border-left: 4px solid #f5576c;
    background: #fff5f5;
}

.bom-node.level-1 {
    border-left: 4px solid #667eea;
    margin-left: 40px;
}

.bom-node.level-2 {
    border-left: 4px solid #28a745;
    margin-left: 80px;
}

.bom-node.level-3 {
    border-left: 4px solid #ffc107;
    margin-left: 120px;
}

.bom-node.level-4 {
    border-left: 4px solid #ff9800;
    margin-left: 160px;
}

.bom-node.level-5 {
    border-left: 4px solid #9c27b0;
    margin-left: 200px;
}

.bom-node-content {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: nowrap;
}

.bom-node-drawing {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 14px;
    color: #2c3e50;
    min-width: 130px;
}

.bom-node-name {
    color: #2c3e50;
    font-size: 13px;
    font-weight: 500;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bom-node-quantity {
    background: #fff3cd;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
    color: #856404;
    font-weight: 500;
    white-space: nowrap;
}

.bom-node-info {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #666;
    flex: 1;
    align-items: center;
}

.bom-node-info span {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.bom-node-code {
    font-family: 'Courier New', monospace;
    color: #667eea;
    background: #f0f7ff;
    padding: 2px 6px;
    border-radius: 3px;
}

.bom-node-version {
    background: #e8f5e9;
    padding: 2px 6px;
    border-radius: 3px;
    color: #2e7d32;
    font-weight: 500;
}

.bom-node-material {
    color: #7f8c8d;
    font-style: italic;
}

.bom-add-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.bom-add-btn:hover {
    transform: translateY(-50%) scale(1.15);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.5);
}

.bom-add-btn.delete-btn {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    right: 42px;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.bom-add-btn.delete-btn:hover {
    transform: translateY(-50%) scale(1.15);
    box-shadow: 0 4px 20px rgba(220, 53, 69, 0.5);
}

.bom-add-btn.disabled {
    background: #e0e0e0;
    cursor: not-allowed;
    pointer-events: none;
}

/* BOM 搜索弹窗 */
.bom-search-container {
    margin-top: 10px;
}

.bom-search-input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e8ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

.bom-search-input:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.2);
}

.bom-search-results {
    margin-top: 15px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px;
}

.bom-search-results::-webkit-scrollbar {
    width: 6px;
}

.bom-search-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.bom-search-results::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

.bom-search-item {
    padding: 12px 15px;
    background: white;
    border: 1px solid #e8ecef;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 15px;
}

.bom-search-item:hover {
    border-color: #667eea;
    background: #f0f7ff;
    transform: translateX(5px);
}

.bom-search-drawing {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #2c3e50;
    min-width: 140px;
    font-size: 14px;
}

.bom-search-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 13px;
    color: #555;
}

.bom-search-name {
    color: #2c3e50;
    font-weight: 500;
}

.bom-search-code {
    font-family: 'Courier New', monospace;
    color: #667eea;
}

.bom-search-version {
    background: #f0f7ff;
    padding: 2px 8px;
    border-radius: 4px;
    color: #667eea;
    font-size: 12px;
}

/* BOM 用量输入弹窗 */
.bom-quantity-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 10001;
}

.bom-quantity-modal.active {
    display: block;
}

.bom-quantity-content {
    background: white;
    margin: 200px auto;
    max-width: 420px;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.bom-quantity-content h3 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 1.3em;
    font-weight: 600;
}

.bom-quantity-content p {
    color: #666;
    margin-bottom: 20px;
    font-size: 13px;
    line-height: 1.5;
}

.bom-quantity-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e8ecef;
    border-radius: 8px;
    font-size: 18px;
    margin-bottom: 20px;
    transition: all 0.3s;
}

.bom-quantity-input:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.2);
}

.bom-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* BOM 预览样式 */
.preview-tree {
    margin-top: 20px;
}

.preview-node {
    background: white;
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.preview-node.level-0 {
    border-left: 4px solid #f5576c;
    background: #fff5f5;
}

.preview-node.level-1 {
    border-left: 4px solid #667eea;
    margin-left: 30px;
}

.preview-node.level-2 {
    border-left: 4px solid #28a745;
    margin-left: 60px;
}

.preview-node.level-3 {
    border-left: 4px solid #ffc107;
    margin-left: 90px;
}

.preview-drawing {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #2c3e50;
    min-width: 130px;
}

.preview-name {
    color: #2c3e50;
    font-size: 13px;
    font-weight: 500;
}

.preview-qty {
    background: #fff3cd;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    color: #856404;
    font-weight: 500;
}

.preview-code {
    font-family: 'Courier New', monospace;
    color: #667eea;
    background: #f0f7ff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
}

.preview-version {
    background: #e8f5e9;
    padding: 2px 6px;
    border-radius: 3px;
    color: #2e7d32;
    font-size: 11px;
    font-weight: 500;
}

.preview-material {
    color: #7f8c8d;
    font-size: 11px;
    font-style: italic;
}

/* ===== 权限管理样式 ===== */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-draft {
    background: #fff3cd;
    color: #856404;
}

.status-published {
    background: #d4edda;
    color: #155724;
}

/* ===== 上传图纸弹窗样式 ===== */
.upload-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
}

.upload-modal.active {
    display: block;
}

.upload-modal .preview-content {
    background: white;
    margin: 50px auto;
    padding: 30px;
    max-width: 600px;
    border-radius: 8px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

/* ===== 预览弹窗样式 ===== */
#previewModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
}

#previewModal.active {
    display: block;
}

#previewModal .preview-content {
    background: white;
    margin: 20px auto;
    padding: 0;
    max-width: 95vw;
    width: 90%;
    border-radius: 8px;
    max-height: calc(100vh - 40px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#previewModal .preview-body {
    flex: 1;
    overflow: auto;
    padding: 20px;
}

.preview-modal .preview-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: white;
}

.preview-modal .preview-title {
    color: white;
    text-align: center;
    padding: 15px;
    font-size: 18px;
}

/* ===== 表单样式 ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e8ecef;
    border-radius: 6px;
    font-size: 14px;
}

.form-group input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 2px dashed #e8ecef;
    border-radius: 6px;
    cursor: pointer;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 12px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

/* ===== 消息提示样式 ===== */
.message {
    padding: 12px 20px;
    border-radius: 8px;
    margin: 15px 0;
    text-align: center;
    font-weight: 500;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ===== 按钮样式 ===== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(240, 147, 251, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

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

.btn-warning:hover {
    background: #ffb300;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
}

/* ===== 表格样式 ===== */
.table-container {
    overflow-x: auto;
}

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

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e8ecef;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

tr:hover {
    background: #f8f9fa;
}

/* ===== 卡片样式 ===== */
.card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.export-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e8ecef;
}

.export-bar h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.5em;
    border: none;
}

.search-filter-bar {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.search-box {
    flex: 1;
}

.filter-box {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-box select {
    padding: 10px 15px;
    border: 2px solid #e8ecef;
    border-radius: 6px;
    font-size: 14px;
}

/* ===== 信息框样式 ===== */
.info-box {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.info-box h3 {
    color: #1976d2;
    margin-bottom: 10px;
    border: none;
}

.info-box ul {
    margin-left: 20px;
    color: #555;
    line-height: 1.8;
}

/* ===== 头部栏样式 ===== */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    color: white;
}

.btn-home {
    background: rgba(255,255,255,0.2);
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
}

.btn-logout {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
}

/* ===== 后台管理样式 ===== */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 240px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 30px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.admin-logo {
    padding: 0 20px 30px;
    color: white;
    font-size: 20px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    margin-bottom: 20px;
}

.admin-menu {
    list-style: none;
    padding: 0 10px;
}

.admin-menu li {
    margin-bottom: 5px;
}

.admin-menu a {
    display: block;
    padding: 12px 20px;
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s;
}

.admin-menu a:hover,
.admin-menu a.active {
    background: rgba(255,255,255,0.2);
    color: white;
}

.admin-content {
    margin-left: 240px;
    flex: 1;
    padding: 30px;
    background: #f5f6fa;
}

.page-header {
    background: white;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.page-header h1 {
    color: #2c3e50;
    margin: 0 0 10px 0;
    font-size: 24px;
    text-align: left;
    text-shadow: none;
}

/* ===== 统计卡片样式 ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border-left: 4px solid #667eea;
}

.stat-card .icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.stat-card .label {
    color: #7f8c8d;
    font-size: 13px;
    margin-bottom: 8px;
}

.stat-card .value {
    color: #2c3e50;
    font-size: 28px;
    font-weight: 700;
}

.stat-card.warning {
    border-left-color: #f39c12;
}

.stat-card.danger {
    border-left-color: #e74c3c;
}

.stat-card.success {
    border-left-color: #27ae60;
}

/* ===== 数据卡片样式 ===== */
.data-card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f1f2f6;
}

.selected-info {
    color: #667eea;
    font-weight: 600;
}

/* ===== 徽章样式 ===== */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-info {
    background: #e3f2fd;
    color: #1976d2;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-admin {
    background: #f8d7da;
    color: #721c24;
}

.badge-user {
    background: #d4edda;
    color: #155724;
}

/* ===== 操作按钮样式 ===== */
.action-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

/* ===== 新建零件页面样式 ===== */
.drawing-type-option {
    padding: 15px 20px;
    border: 2px solid #e8ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.drawing-type-option:hover {
    border-color: #667eea;
    background: #f0f7ff;
}

.drawing-type-option.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* ===== 响应式设计 ===== */

/* 大屏幕优化（1920px+） */
@media screen and (min-width: 1920px) {
    .container {
        max-width: 1800px;
        margin: 0 auto;
    }
    
    .bom-modal-content {
        max-width: 1600px;
    }
}

/* 中等屏幕（1367px - 1920px） */
@media screen and (min-width: 1367px) and (max-width: 1919px) {
    .container {
        max-width: 1400px;
    }
}

/* 小屏幕平板（1025px - 1366px） */
@media screen and (max-width: 1366px) {
    .container {
        padding: 10px;
    }
    
    .bom-modal-content {
        width: 98%;
        height: calc(100vh - 20px);
    }
    
    .bom-node {
        padding: 10px 50px 10px 12px;
    }
    
    .bom-node.level-1 { margin-left: 30px; }
    .bom-node.level-2 { margin-left: 60px; }
    .bom-node.level-3 { margin-left: 90px; }
    .bom-node.level-4 { margin-left: 120px; }
    .bom-node.level-5 { margin-left: 150px; }
}

/* 平板（769px - 1024px） */
@media screen and (max-width: 1024px) {
    body {
        padding: 10px;
        font-size: 13px;
    }
    
    .container {
        padding: 5px;
    }
    
    /* 表格优化 */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        font-size: 13px;
        min-width: 100%;
    }
    
    th, td {
        padding: 8px 4px;
        font-size: 13px;
        white-space: nowrap;
    }
    
    /* 按钮优化 */
    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .btn-small {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    /* 后台管理优化 */
    .admin-sidebar {
        width: 180px;
    }
    
    .admin-content {
        margin-left: 180px;
        padding: 15px;
    }
    
    /* 卡片优化 */
    .card {
        padding: 15px;
    }
    
    /* 统计卡片优化 */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* BOM 节点优化 */
    .bom-node {
        padding: 8px 45px 8px 10px;
        font-size: 12px;
    }
    
    .bom-node-drawing {
        font-size: 13px;
        min-width: 110px;
    }
    
    .bom-node-name {
        font-size: 12px;
        max-width: 150px;
    }
    
    .bom-add-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
        right: 5px;
    }
    
    .bom-add-btn.delete-btn {
        right: 38px;
    }
    
    /* 弹窗优化 */
    .bom-modal-content {
        margin: 10px auto;
        width: 95%;
        height: calc(100vh - 20px);
    }
    
    .bom-modal-header {
        padding: 15px 20px;
    }
    
    .bom-modal-header h2 {
        font-size: 1.2em;
    }
    
    /* 搜索弹窗优化 */
    .bom-search-item {
        padding: 10px 12px;
        font-size: 12px;
    }
    
    .bom-search-drawing {
        min-width: 120px;
        font-size: 13px;
    }
}

/* 手机横屏和大屏手机（481px - 768px） */
@media screen and (max-width: 768px) {
    body {
        padding: 5px;
        font-size: 12px;
    }
    
    /* 隐藏侧边栏，改为顶部导航 */
    .admin-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        z-index: 9999;
        transition: left 0.3s;
    }
    
    .admin-sidebar.active {
        left: 0;
    }
    
    .admin-content {
        margin-left: 0;
        padding: 10px;
        padding-top: 60px;
    }
    
    /* 添加汉堡菜单按钮 */
    .menu-toggle {
        display: block;
        position: fixed;
        top: 10px;
        left: 10px;
        z-index: 10000;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        border: none;
        padding: 10px 15px;
        border-radius: 6px;
        cursor: pointer;
    }
    
    /* 表格优化 */
    table {
        font-size: 11px;
    }
    
    th, td {
        padding: 6px 3px;
        font-size: 11px;
    }
    
    /* 卡片优化 */
    .card {
        padding: 10px;
        margin-bottom: 15px;
    }
    
    .export-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .export-bar h2 {
        font-size: 1.3em;
    }
    
    /* 搜索筛选栏优化 */
    .search-filter-bar {
        flex-direction: column;
        gap: 10px;
    }
    
    .search-box {
        width: 100%;
    }
    
    .filter-box {
        width: 100%;
        flex-wrap: wrap;
    }
    
    /* 统计卡片优化 */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-card .value {
        font-size: 24px;
    }
    
    /* 按钮优化 */
    .btn {
        width: 100%;
        margin-bottom: 5px;
        text-align: center;
    }
    
    .btn-small {
        padding: 5px 10px;
        font-size: 11px;
    }
    
    /* BOM 节点优化 */
    .bom-node {
        padding: 8px 40px 8px 8px;
        margin-bottom: 8px;
    }
    
    .bom-node.level-1 { margin-left: 20px; }
    .bom-node.level-2 { margin-left: 40px; }
    .bom-node.level-3 { margin-left: 60px; }
    .bom-node.level-4 { margin-left: 80px; }
    .bom-node.level-5 { margin-left: 100px; }
    
    .bom-node-content {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .bom-node-drawing {
        font-size: 12px;
        min-width: 100px;
        width: 100%;
    }
    
    .bom-node-name {
        font-size: 11px;
        width: 100%;
    }
    
    .bom-node-info {
        width: 100%;
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .bom-add-btn {
        width: 26px;
        height: 26px;
        font-size: 13px;
        right: 3px;
        top: 8px;
        transform: none;
    }
    
    .bom-add-btn:hover {
        transform: scale(1.1);
    }
    
    .bom-add-btn.delete-btn {
        right: 32px;
    }
    
    /* 弹窗优化 */
    .bom-modal-content {
        margin: 5px auto;
        width: 98%;
        height: calc(100vh - 10px);
        border-radius: 8px;
    }
    
    .bom-modal-header {
        padding: 12px 15px;
    }
    
    .bom-modal-header h2 {
        font-size: 1em;
    }
    
    .bom-modal-close {
        width: 30px;
        height: 30px;
        font-size: 24px;
    }
    
    .bom-modal-body {
        padding: 10px;
    }
    
    /* 搜索弹窗优化 */
    .bom-search-input {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .bom-search-item {
        padding: 8px 10px;
        font-size: 11px;
    }
    
    .bom-search-drawing {
        min-width: 100px;
        font-size: 12px;
    }
    
    .bom-search-info {
        flex-direction: column;
        gap: 5px;
    }
    
    /* 用量输入弹窗优化 */
    .bom-quantity-content {
        margin: 100px auto;
        max-width: 90%;
        padding: 20px;
    }
    
    .bom-quantity-input {
        font-size: 16px;
        padding: 12px;
    }
    
    /* 表单优化 */
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group input,
    .form-group select {
        font-size: 14px;
        padding: 10px;
    }
    
    /* 头部栏优化 */
    .header-bar {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }
    
    .user-info {
        width: 100%;
        justify-content: space-between;
    }
}

/* 小屏手机（320px - 480px） */
@media screen and (max-width: 480px) {
    body {
        font-size: 11px;
        padding: 3px;
    }
    
    /* 表格优化 */
    table {
        font-size: 10px;
    }
    
    th, td {
        padding: 4px 2px;
        font-size: 10px;
    }
    
    /* 隐藏不重要的列 */
    .col-material-code,
    .col-material {
        display: none;
    }
    
    /* BOM 节点优化 */
    .bom-node {
        padding: 6px 35px 6px 6px;
    }
    
    .bom-node-drawing {
        font-size: 11px;
        min-width: 90px;
    }
    
    .bom-node-name {
        font-size: 10px;
    }
    
    .bom-node-quantity {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .bom-node-info {
        font-size: 9px;
    }
    
    .bom-add-btn {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }
    
    /* 按钮优化 */
    .btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    /* 弹窗优化 */
    .bom-modal-header h2 {
        font-size: 0.9em;
    }
    
    /* 统计卡片优化 */
    .stat-card .value {
        font-size: 20px;
    }
    
    .stat-card .label {
        font-size: 11px;
    }
}

/* 打印样式 */
@media print {
    .admin-sidebar,
    .header-bar,
    .btn,
    .bom-add-btn,
    .search-filter-bar,
    .export-bar {
        display: none !important;
    }
    
    .admin-content {
        margin-left: 0;
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    table {
        font-size: 10px;
    }
    
    th, td {
        padding: 4px;
        border: 1px solid #ddd;
    }
}
/* ===== 移动端菜单切换样式 ===== */
.menu-toggle {
    display: none;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 10000;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: all 0.3s;
}

.menu-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.menu-toggle:active {
    transform: scale(0.95);
}

@media screen and (max-width: 768px) {
    .menu-toggle {
        display: block;
    }
    
    .admin-sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        z-index: 9999;
        transition: left 0.3s ease;
        width: 280px;
        box-shadow: 2px 0 10px rgba(0,0,0,0.3);
    }
    
    .admin-sidebar.active {
        left: 0;
    }
    
    .admin-content {
        margin-left: 0;
        padding: 10px;
        padding-top: 60px;
    }
    
    /* 添加遮罩层 */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 9998;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
}
