/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Microsoft YaHei', 'Heiti SC', sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* 顶部导航 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 30px;
    border-bottom: 1px solid #e0e0e0;
}

.header h1 {
    font-size: 24px;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
}

.health-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.indicator.pending {
    background-color: #f39c12;
}

.indicator.success {
    background-color: #27ae60;
}

.indicator.error {
    background-color: #e74c3c;
}

/* 核心内容区 */
.content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

@media (max-width: 1024px) {
    .content {
        grid-template-columns: 1fr;
    }
}

section {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 20px;
    margin-bottom: 30px;
}

section h2 {
    font-size: 18px;
    color: #2c3e50;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

/* 上传识别区 */
.upload-container {
    margin-bottom: 20px;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 200px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #fafafa;
}

.upload-label:hover {
    border-color: #3498db;
    background-color: #f8f9fa;
}

.upload-label i {
    font-size: 48px;
    color: #95a5a6;
    margin-bottom: 15px;
}

.upload-label p {
    color: #7f8c8d;
    text-align: center;
}

.upload-label .tip {
    font-size: 14px;
    margin-top: 5px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.recognize-btn {
    background-color: #3498db;
    color: #fff;
    width: 100%;
}

.recognize-btn:hover {
    background-color: #2980b9;
}

.recognize-btn.disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

/* 结果区 */
.result-card {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.result-item {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.result-item:last-child {
    margin-bottom: 0;
}

.result-item label {
    width: 100px;
    font-weight: bold;
    color: #2c3e50;
}

.result-item span {
    font-size: 16px;
    color: #333;
}

.preview-container {
    margin-top: 30px;
}

.preview-container h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: #2c3e50;
}

.image-preview {
    width: 100%;
    height: 200px;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#preview-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* 历史记录区 */
.records-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

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

.pagination-btn {
    background-color: #fff;
    color: #3498db;
    border: 1px solid #3498db;
    padding: 8px 15px;
}

.pagination-btn:hover {
    background-color: #f8f9fa;
}

.pagination-btn.disabled {
    color: #bdc3c7;
    border-color: #bdc3c7;
    cursor: not-allowed;
}

.records-table-container {
    overflow-x: auto;
}

.records-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.records-table th,
.records-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
}

.records-table th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #2c3e50;
}

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

.records-table .img-cell {
    width: 80px;
}

.records-table .img-cell img {
    width: 60px;
    height: 40px;
    object-fit: contain;
    border-radius: 4px;
}

.empty-records {
    text-align: center;
    color: #7f8c8d;
    padding: 30px 0;
}

/* 统计区 */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.stat-card {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.stat-card h3 {
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 10px;
}

.stat-card p {
    font-size: 24px;
    font-weight: bold;
    color: #2c3e50;
}

/* 底部 */
.footer {
    text-align: center;
    padding: 20px 0;
    margin-top: 50px;
    color: #7f8c8d;
    font-size: 14px;
    border-top: 1px solid #e0e0e0;
}

/* 加载弹窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: #fff;
    border-radius: 8px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ========== 新增：识别详情弹窗样式 ========== */
/* 详情弹窗基础样式 */
#detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#detail-modal.hidden {
    display: none;
}

.modal-dialog {
    background-color: #fff;
    width: 90%;
    max-width: 1000px;
    max-height: 80vh;
    overflow-y: auto;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: flex-end;
}

.close-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    color: #7f8c8d;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: #e74c3c;
}

.modal-body {
    padding: 20px;
}

/* 详情内容样式 */
.detail-container h3 {
    font-size: 18px;
    color: #2c3e50;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.detail-section {
    margin-bottom: 25px;
}

.detail-section h4 {
    font-size: 16px;
    color: #2c3e50;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-section h4::before {
    content: "";
    width: 4px;
    height: 16px;
    background-color: #3498db;
    display: inline-block;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
}

.detail-table th,
.detail-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
}

.detail-table th {
    width: 120px;
    font-weight: bold;
    color: #7f8c8d;
    text-align: right;
    padding-right: 15px;
}

.detail-table td {
    color: #2c3e50;
}

.json-viewer {
    background-color: #f8f9fa;
    border-radius: 4px;
    padding: 15px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-x: auto;
    color: #2c3e50;
}

/* 查看详情按钮样式 */
.detail-btn {
    padding: 6px 12px;
    background-color: #3498db;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.detail-btn:hover {
    background-color: #2980b9;
}

/* 历史记录表格列适配 */
.records-table th:nth-child(8),
.records-table td:nth-child(8) {
    text-align: center;
    width: 100px;
}

/* 响应式适配 */
@media (max-width: 768px) {
    .modal-dialog {
        width: 95%;
        max-height: 90vh;
    }
    
    .detail-table th {
        width: 100px;
        font-size: 13px;
    }
    
    .detail-table td {
        font-size: 13px;
    }
    
    .json-viewer {
        font-size: 12px;
        padding: 10px;
    }
}
