/* 主题变量 */
:root {
    --bg-gradient-start: #f6f8fb;
    --bg-gradient-end: #e9eef6;
    --text-primary: #2c3e50;
    --text-secondary: #666e7a;
    --accent-1: #667eea;
    --accent-2: #764ba2;
    --success-1: #27ae60;
    --danger-1: #e74c3c;
    --warning-1: #f39c12;
    --border-soft: #e0e6ef;
    --panel-bg: rgba(255, 255, 255, 0.92);
}

/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Microsoft YaHei', 'Segoe UI', Arial, sans-serif;
}

body {
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    color: var(--text-primary);
    line-height: 1.6;
    height: 100vh;
    font-size: 14px;
}

/* 查询页面需要能够滚动 */
body.query-page {
    overflow: auto;
    height: auto;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px;
    height: calc(100vh - 30px);
    display: flex;
    flex-direction: column;
    background-color: var(--panel-bg);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 15px;
    padding: 12px 0;
    border-bottom: 2px solid var(--border-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

header h1 {
    color: var(--text-primary);
    font-size: 24px;
    flex: 1;
    font-weight: 600;
    letter-spacing: 1px;
}

.query-link {
    background: linear-gradient(135deg, var(--accent-1) 0%, var(--accent-2) 100%);
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.25s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.25);
}

.query-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(102, 126, 234, 0.35);
}

/* 主内容区域 */
main {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    flex: 1;
    overflow: hidden;
}

/* 设计面板样式（不影响预览区域） */
.design-panel {
    flex: 1;
    min-width: 300px;
    background-color: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.06);
    overflow-y: auto;
    height: calc(100% - 40px);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.design-panel h2 {
    color: var(--text-primary);
    margin-bottom: 12px;
    font-size: 20px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 8px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.form-group {
    margin-bottom: 12px;
}

/* 表单行样式 */
.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.half-width {
    flex: 1;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    color: #444;
    font-size: 13px;
}

/* 必填字段星号样式 */
.required-star {
    color: #e74c3c;
    font-weight: bold;
    margin-left: 2px;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.2s ease;
    background-color: #fafafa;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #a3aab4;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-1);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
    background-color: white;
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

/* 注意事项的特殊textarea样式 */
#precautions {
    font-family: inherit;
    line-height: 1.4;
}

/* 搜索容器样式 */
.waste-name-input-container,
.waste-category-input-container,
.waste-code-input-container {
    position: relative;
}

/* 搜索下拉列表样式 */
.waste-name-dropdown,
.waste-category-dropdown,
.waste-code-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e8ecf1;
    border-top: none;
    border-radius: 0 0 10px 10px;
    max-height: 260px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.waste-name-item,
.waste-category-item,
.waste-code-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.15s ease, color 0.15s ease;
    font-size: 14px;
}

.waste-name-item:hover,
.waste-category-item:hover,
.waste-code-item:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    color: var(--accent-1);
}

.waste-name-item:last-child,
.waste-category-item:last-child,
.waste-code-item:last-child {
    border-bottom: none;
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 10000;
    display: none;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-width: 600px;
    max-height: 80vh;
    width: 90%;
    overflow: hidden;
    position: relative;
}

.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--accent-1) 0%, var(--accent-2) 100%);
    color: white;
}

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

.close-modal {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: white;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.close-modal:hover {
    background-color: rgba(255, 255, 255, 0.18);
}

.precautions-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 16px 20px;
}

.precaution-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.precaution-item:hover {
    background-color: rgba(102, 126, 234, 0.05);
}

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

.precaution-item input[type="checkbox"] {
    margin-right: 10px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-soft);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background-color: #f8f9fa;
}

.modal-footer button {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.modal-footer button:first-child {
    background: linear-gradient(135deg, var(--accent-1) 0%, var(--accent-2) 100%);
    color: white;
}

.modal-footer button:last-child {
    background: #e0e0e0;
    color: #666;
}

/* 提示文字 */
.form-group small {
    display: block;
    margin-top: 4px;
    color: #7f8c8d;
    font-size: 11px;
    font-style: italic;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 4px 10px;
    border-radius: 4px;
    border-left: 3px solid var(--accent-1);
    letter-spacing: 0.2px;
}

/* 按钮组 */
.button-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.button-group button {
    flex: 1;
    min-width: 120px;
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--accent-1) 0%, var(--accent-2) 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.25);
}

.button-group button:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(102, 126, 234, 0.32);
}

.button-group button:nth-child(2) {
    background: linear-gradient(135deg, var(--success-1) 0%, #1f9d55 100%);
    box-shadow: 0 4px 14px rgba(46, 204, 113, 0.25);
}

/* 自定义滚动条（仅内容区域与下拉） */
.design-panel::-webkit-scrollbar,
.preview-panel::-webkit-scrollbar,
.waste-name-dropdown::-webkit-scrollbar,
.waste-category-dropdown::-webkit-scrollbar,
.waste-code-dropdown::-webkit-scrollbar {
    width: 10px;
}

.design-panel::-webkit-scrollbar-track,
.preview-panel::-webkit-scrollbar-track,
.waste-name-dropdown::-webkit-scrollbar-track,
.waste-category-dropdown::-webkit-scrollbar-track,
.waste-code-dropdown::-webkit-scrollbar-track {
    background: #f1f3f6;
    border-radius: 8px;
}

.design-panel::-webkit-scrollbar-thumb,
.preview-panel::-webkit-scrollbar-thumb,
.waste-name-dropdown::-webkit-scrollbar-thumb,
.waste-category-dropdown::-webkit-scrollbar-thumb,
.waste-code-dropdown::-webkit-scrollbar-thumb {
    background: #c6cfdb;
    border-radius: 8px;
    border: 2px solid #f1f3f6;
}

/* 预览面板样式 - 保持不变（以下原有样式不动） */
/* 预览部分原有样式保持，确保排版与尺寸完全不受影响 */

/* 预览面板样式 */
.preview-panel {
    flex: 1;
    min-width: 300px;
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    height: calc(100% - 40px);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.preview-panel h2 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 20px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 8px;
}

.label-preview {
    width: 500px;
    height: 500px;
    background-color: #df792e;
    border: 3px solid black;
    display: flex;
    flex-direction: column;
    font-size: 14px;
    color: black;
}

/* 第一行：危险废物标题 */
.row-1 {
    height: 52px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 2px solid black;
}

.title-main {
    font-size: 24px;
    font-weight: bold;
    color: black;
}

/* 第二至六行合并容器 */
.rows-2-6-container {
    height: calc(32px + 32px + 32px + 68px + 68px);
    width: 100%;
    display: flex;
    border-bottom: 2px solid black;
}

/* 第九至十二行合并容器 */
.rows-9-12-container {
    height: calc(32px + 32px + 32px + 32px);
    width: 100%;
    display: flex;
}

/* 左侧区域组 */
.left-section {
    width: 358px;
    display: flex;
    flex-direction: column;
}

/* 第二行：废物名称 */
.row-2 {
    height: 32px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid black;
}

/* 第三行：废物类别 */
.row-3 {
    height: 32px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid black;
}

/* 第四行：废物代码和废物形态 */
.row-4 {
    height: 32px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid black;
}

/* 第五行：主要成分 */
.row-5 {
    height: 68px;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 8px 0 0 0;
    border-bottom: 1px solid black;
}

/* 第六行：有害成分 */
.row-6 {
    height: 68px;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 8px 0 0 0;
}

/* 第七行：注意事项 */
.row-7 {
    height: 68px;
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 8px 0 0 0;
    border-bottom: 1px solid black;
}

/* 第八行：数字识别码 */
.row-8 {
    height: 32px;
    width: 100%;
    display: flex;
    align-items: center;
    border-bottom: 1px solid black;
}

/* 第九行：产生/收集单位 */
.row-9 {
    height: 32px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid black;
}

/* 第十行：联系人和联系方式 */
.row-10 {
    height: 32px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid black;
}

/* 第十一行：产生日期和废物重量 */
.row-11 {
    height: 32px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid black;
}

/* 第十二行：备注 */
.row-12 {
    height: 32px;
    display: flex;
    align-items: center;
}

/* 左侧内容区域 */
.left-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    padding-left: 10px;
    border-right: 1px solid black;
}

/* 第五、六、七行的左侧内容区域特殊对齐 */
.row-5 .left-content,
.row-6 .left-content {
    align-items: flex-start;
    justify-content: flex-start;
}

/* 全宽度内容区域 */
.full-width-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 8px 0 0 10px;
}

/* 第七行注意事项特殊对齐 - 提高优先级 */
.label-preview .row-7 .full-width-content {
    align-items: flex-start !important;
    justify-content: flex-start !important;
    padding-top: 8px !important;
}

/* 第八行数字识别码居中对齐 */
.label-preview .row-8 .full-width-content {
    align-items: center !important;
    justify-content: flex-start !important;
}

/* 左侧分列内容区域 */
.left-content-split {
    width: 100%;
    height: 100%;
    display: flex;
    border-right: 1px solid black;
}

.col-1, .col-2 {
    width: 50%;
    height: 100%;
    display: flex;
    align-items: center;
    padding-left: 10px;
}

.col-2 {
    border-left: 1px solid black;
}

/* 右侧合并矩形区域组 */
.right-rectangle-group {
    flex: 1;
    height: 100%;
    border-left: 1px solid black;
    background-color: #df792e;
}

/* 有图片的右侧区域特殊样式 */
.right-rectangle-group.rows-2-6 {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #df792e;
    overflow: hidden;
}

/* 右侧图片样式 */
.right-rectangle-group img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

/* 字段标签和值样式 */
.field-label {
    font-weight: bold;
    margin-right: 8px;
    white-space: nowrap;
    color: black;
}

.field-value {
    flex: 1;
    overflow: hidden;
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
    color: black;
    line-height: 1.4;
}

/* 对于第五、六、七行的字段值，允许更多换行空间并确保左上对齐 */
.row-5 .field-value,
.row-6 .field-value,
.row-7 .field-value {
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
    overflow-y: auto;
    align-self: flex-start;
    text-align: left;
}

/* 响应式设计 */
@media (max-width: 768px) {
    main {
        flex-direction: column;
    }
    
    .design-panel,
    .preview-panel {
        min-width: 100%;
    }
    
    .button-group {
        flex-direction: column;
    }
}

/* 打印样式 */
@media print {
    body * {
        visibility: hidden;
    }
    
    .label-preview, .label-preview * {
        visibility: visible;
    }
    
    .label-preview {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
}