/**
 * index.html 历史记录集成样式
 * 创建时间：2025-11-30
 * 用途：为舌诊、面诊、问诊添加历史记录调用功能的样式
 */

/* ==========================================
   1. 历史记录按钮样式
   ========================================== */

.history-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.history-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.history-btn:active {
    transform: translateY(0);
}

/* 上传按钮区域调整 */
.upload-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ==========================================
   2. 历史记录弹窗样式
   ========================================== */

.history-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.history-dialog-overlay.hidden {
    display: none;
}

.history-dialog {
    background: white;
    border-radius: 16px;
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   3. 弹窗头部
   ========================================== */

.history-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid #f0f0f0;
}

.history-dialog-header h3 {
    color: #2c3e50;
    font-size: 22px;
    margin: 0;
}

.close-dialog-btn {
    background: none;
    border: none;
    font-size: 32px;
    color: #95a5a6;
    cursor: pointer;
    transition: color 0.3s ease;
    line-height: 1;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-dialog-btn:hover {
    color: #e74c3c;
}

/* ==========================================
   4. 弹窗主体
   ========================================== */

.history-dialog-body {
    padding: 20px 25px;
    overflow-y: auto;
    flex: 1;
}

/* 历史记录列表 */
.history-record-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* 单条历史记录 */
.history-record-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
    cursor: pointer;
}

.history-record-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.record-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.record-index {
    font-weight: bold;
    color: #667eea;
    font-size: 14px;
}

.record-date {
    font-size: 13px;
    color: #95a5a6;
}

.record-content {
    margin-bottom: 12px;
}

.record-field {
    display: flex;
    margin-bottom: 6px;
    font-size: 14px;
}

.record-label {
    color: #7f8c8d;
    font-weight: 500;
    min-width: 70px;
}

.record-value {
    color: #2c3e50;
    flex: 1;
}

.record-actions {
    display: flex;
    justify-content: flex-end;
}

.select-record-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.select-record-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* 空状态 */
.history-empty {
    text-align: center;
    padding: 60px 20px;
    color: #95a5a6;
}

.history-empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.history-empty-text {
    font-size: 16px;
    margin-bottom: 10px;
}

.history-empty-hint {
    font-size: 14px;
    color: #bdc3c7;
}

/* ==========================================
   5. 弹窗底部（分页）
   ========================================== */

.history-dialog-footer {
    padding: 15px 25px;
    border-top: 2px solid #f0f0f0;
}

.history-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.page-info {
    font-size: 14px;
    color: #7f8c8d;
}

.page-btn {
    background: #ecf0f1;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease;
}

.page-btn:hover:not(:disabled) {
    background: #bdc3c7;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-btn.active {
    background: #667eea;
    color: white;
}

/* ==========================================
   6. 加载状态
   ========================================== */

.history-loading {
    text-align: center;
    padding: 40px 20px;
}

.history-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.history-loading-text {
    color: #7f8c8d;
    font-size: 14px;
}

/* ==========================================
   7. 舌诊特定样式
   ========================================== */

.history-record-item.tongue-record {
    border-left-color: #e74c3c;
}

.history-record-item.tongue-record .record-index {
    color: #e74c3c;
}

/* ==========================================
   8. 面诊特定样式
   ========================================== */

.history-record-item.face-record {
    border-left-color: #3498db;
}

.history-record-item.face-record .record-index {
    color: #3498db;
}

/* ==========================================
   9. 问诊特定样式
   ========================================== */

.history-record-item.inquiry-record {
    border-left-color: #2ecc71;
}

.history-record-item.inquiry-record .record-index {
    color: #2ecc71;
}

/* ==========================================
   10. 响应式设计（移动端）
   ========================================== */

@media (max-width: 768px) {
    .history-dialog {
        width: 95%;
        max-height: 90vh;
    }

    .history-dialog-header {
        padding: 15px 20px;
    }

    .history-dialog-header h3 {
        font-size: 18px;
    }

    .history-dialog-body {
        padding: 15px 20px;
    }

    .history-record-item {
        padding: 15px;
    }

    .upload-buttons {
        flex-direction: column;
    }

    .history-btn,
    .upload-btn,
    .camera-btn {
        width: 100%;
    }

    .history-pagination {
        flex-direction: column;
        gap: 10px;
    }

    .page-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .history-dialog-header h3 {
        font-size: 16px;
    }

    .record-field {
        flex-direction: column;
        gap: 4px;
    }

    .record-label {
        min-width: auto;
    }
}

/* ==========================================
   11. 打印样式
   ========================================== */

@media print {
    .history-dialog-overlay {
        display: none;
    }

    .history-btn {
        display: none;
    }
}

/* ==========================================
   12. 辅助样式
   ========================================== */

.text-center {
    text-align: center;
}

.mt-10 {
    margin-top: 10px;
}

.mb-10 {
    margin-bottom: 10px;
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ==========================================
   结束
   ========================================== */
