body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f2f5;
    color: #333;
    -webkit-tap-highlight-color: transparent; /* 移除点击高亮 */
}

.container {
    max-width: 96%; /* 适应企业微信的页面宽度 */
    margin: 0 auto;
    padding: 15px;
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    box-sizing: border-box;
    margin-top: 15px;
    margin-bottom: 15px;
}

.header-title {
    background-color: #e0f0ff; /* 浅蓝色背景 */
    color: #333;
    padding: 15px 10px;
    margin: -15px -15px 20px -15px; /* 与container边缘对齐 */
    font-size: 1.2em;
    text-align: center;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    font-weight: bold;
}

.input-group {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap; /* 允许换行 */
}

.input-group label {
    flex-basis: 70px; /* 固定标签宽度 */
    margin-right: 10px;
    font-weight: bold;
    color: #555;
    white-space: nowrap; /* 防止标签文字换行 */
}

.tag-select {
    flex-grow: 1; /* 占据剩余空间 */
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 0.9em;
    margin-right: 10px;
    min-width: 120px; /* 最小宽度 */
    background-color: #f9f9f9;
    appearance: none; /* 移除默认下拉箭头 */
    -webkit-appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23666" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>');
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 20px;
}

.scan-button {
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: bold;
    white-space: nowrap; /* 防止按钮文字换行 */
    min-width: 90px;
}

.primary-button {
    background-color: #007bff; /* 蓝色 */
    color: #fff;
}

.primary-button:active {
    background-color: #0056b3;
}

.results-container {
    margin-top: 25px;
    min-height: 100px; /* 确保有一定高度 */
}

#comparisonTable {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background-color: #fff;
    font-size: 0.9em;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-radius: 5px;
    overflow: hidden; /* 确保圆角有效 */
}

#comparisonTable th,
#comparisonTable td {
    border: 1px solid #ddd;
    padding: 10px 8px;
    text-align: left;
    word-break: break-all; /* 强制长文本换行 */
}

#comparisonTable th {
    background-color: #e6ffe6; /* 绿色系 */
    color: #333;
    font-weight: bold;
}

#comparisonTable tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* 字段值不同的高亮 */
.diff {
    /* 字段值高亮 */
    /* color: red; */
    /* font-weight: bold; */
    background-color: #ffe0e0; /* 红色背景，不改变文字颜色，由对比结果列显示“不同” */
}

/* 对比结果列显示“不同”时的高亮 */
.diff-result {
    color: red;
    font-weight: bold;
}


#noResultText {
    text-align: center;
    color: #888;
    margin-top: 30px;
    font-style: italic;
}

.footer-buttons {
    text-align: center;
    margin-top: 30px;
}

.clear-button {
    padding: 10px 25px;
    background-color: #6c757d; /* 灰色 */
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
}

.clear-button:active {
    background-color: #5a6268;
}

/* 扫描器模态框样式 */
.scanner-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    visibility: hidden; /* 默认隐藏 */
    opacity: 0;
    transition: visibility 0s, opacity 0.3s ease-in-out;
}

.scanner-modal.active {
    visibility: visible;
    opacity: 1;
}

.scanner-content {
    position: relative;
    width: 90%;
    max-width: 400px;
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 15px; /* 底部留白给按钮 */
}

#video {
    width: 100%;
    max-height: 80vh; /* 限制视频高度 */
    display: block;
    object-fit: cover; /* 裁剪以填充容器 */
}

.scanner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-shadow: inset 0 0 0 9999px rgba(0, 0, 0, 0.5); /* 模拟扫描框效果 */
    pointer-events: none; /* 不阻止点击 */
    /* 扫描框的中心透明区域 */
    display: flex;
    justify-content: center;
    align-items: center;
}

.scanner-overlay::after {
    content: '';
    width: 70%;
    height: 30%;
    border: 2px solid #00ff00; /* 扫描框颜色 */
    box-sizing: border-box;
    pointer-events: none;
}

.scanner-message {
    color: #fff;
    margin-top: 10px;
    font-size: 1.1em;
    text-align: center;
}

.cancel-button {
    padding: 10px 20px;
    background-color: #dc3545; /* 红色取消按钮 */
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    margin-top: 15px;
    font-weight: bold;
}

.cancel-button:active {
    background-color: #c82333;
}

/* 移动端适配 */
@media (max-width: 600px) {
    .container {
        padding: 10px;
        margin-top: 10px;
        margin-bottom: 10px;
    }
    .header-title {
        margin: -10px -10px 15px -10px;
        font-size: 1.1em;
        padding: 12px 10px;
    }
    .input-group {
        flex-direction: column;
        align-items: stretch;
    }
    .input-group label {
        flex-basis: auto;
        margin-right: 0;
        margin-bottom: 5px;
    }
    .tag-select, .scan-button {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
    }
    .scan-button {
        min-width: unset;
    }
    .tag-select {
        min-width: unset;
    }
    #comparisonTable th,
    #comparisonTable td {
        padding: 8px 5px;
        font-size: 0.85em;
    }
    .clear-button {
        padding: 8px 20px;
        font-size: 0.9em;
    }
    .scanner-content {
        width: 95%;
    }
}
