/* JSON格式化工具 - 历史记录样式 */

/* 历史记录弹出框 */
.json-history-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000 !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
}

.json-history-modal .modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.json-history-modal .modal-content {
    position: relative;
    width: 90%;
    max-width: 1000px;
    height: 80%;
    max-height: 700px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 弹出框头部 */
.json-history-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.json-history-modal .modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

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

.json-history-modal .modal-close:hover {
    background-color: #e9ecef;
    color: #495057;
}

/* 弹出框主体 */
.json-history-modal .modal-body {
    flex: 1;
    padding: 0;
    overflow: hidden;
}

.history-container {
    display: flex;
    height: 100%;
}

/* 历史记录列表区域 */
.history-list {
    width: 40%;
    border-right: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
}

.history-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.history-list-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
}

.history-items {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

/* 历史记录项 */
.history-item {
    padding: 12px 20px;
    border-bottom: 1px solid #f1f3f4;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.history-item:hover {
    background-color: #f8f9fa;
}

.history-item.selected {
    background-color: #e3f2fd;
    border-left: 3px solid #2196f3;
}

.history-item.selected::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #2196f3;
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.history-time {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
}

.history-size {
    font-size: 11px;
    color: #9e9e9e;
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 10px;
}

.history-item-preview {
    font-size: 13px;
    color: #495057;
    line-height: 1.4;
    margin-bottom: 4px;
    word-break: break-all;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-type {
    font-size: 11px;
    color: #7c4dff;
    background: #f3e5f5;
    padding: 2px 6px;
    border-radius: 10px;
    display: inline-block;
}

/* 无历史记录提示 */
.no-history {
    padding: 40px 20px;
    text-align: center;
    color: #9e9e9e;
    font-size: 14px;
}

/* 右侧预览区域 */
.history-preview {
    width: 60%;
    display: flex;
    flex-direction: column;
}

.history-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.history-preview-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
}

.preview-info {
    font-size: 12px;
    color: #6c757d;
}

.history-preview-content {
    flex: 1;
    padding: 20px;
    overflow: hidden;
}

#json-history-preview {
    width: 100%;
    height: 100%;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 16px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    line-height: 1.5;
    color: #2c3e50;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
    margin: 0;
    resize: none;
}

.preview-detail {
    font-size: 12px;
    color: #6c757d;
    margin-top: 8px;
}

.preview-detail span {
    margin-right: 8px;
}

/* 弹出框底部 */
.json-history-modal .modal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 16px 24px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    gap: 12px;
}

/* 按钮样式 */
.json-history-modal .btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.json-history-modal .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.json-history-modal .btn-primary {
    background: #2196f3;
    color: white;
}

.json-history-modal .btn-primary:hover:not(:disabled) {
    background: #1976d2;
}

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

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

.json-history-modal .btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* 滚动条样式 */
.history-items::-webkit-scrollbar,
#json-history-preview::-webkit-scrollbar {
    width: 6px;
}

.history-items::-webkit-scrollbar-track,
#json-history-preview::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.history-items::-webkit-scrollbar-thumb,
#json-history-preview::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.history-items::-webkit-scrollbar-thumb:hover,
#json-history-preview::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .json-history-modal .modal-content {
        width: 95%;
        height: 90%;
        margin: 20px;
    }
    
    .history-container {
        flex-direction: column;
    }
    
    .history-list {
        width: 100%;
        height: 40%;
        border-right: none;
        border-bottom: 1px solid #e9ecef;
    }
    
    .history-preview {
        width: 100%;
        height: 60%;
    }
    
    .json-history-modal .modal-header {
        padding: 16px 20px;
    }
    
    .json-history-modal .modal-header h3 {
        font-size: 16px;
    }
    
    .json-history-modal .modal-footer {
        padding: 12px 20px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.json-history-modal .modal-content {
    animation: fadeIn 0.3s ease-out;
}

/* 选中状态的视觉反馈 */
.history-item.selected .history-time {
    color: #2196f3;
    font-weight: 600;
}

.history-item.selected .history-type {
    background: #2196f3;
    color: white;
}

/* 清空历史按钮特殊样式 */
#json-clear-history {
    background: #f44336;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
}

#json-clear-history:hover {
    background: #d32f2f;
}

/* 历史记录项的悬停提示 */
.history-item[title] {
    position: relative;
}

/* 加载状态 */
.history-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    color: #6c757d;
    font-size: 14px;
}

.history-loading::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e9ecef;
    border-left-color: #2196f3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 错误定位功能样式 */
.location-accurate {
    color: #4caf50 !important;
    font-weight: 600;
}

.location-approximate {
    color: #ff9800 !important;
    font-weight: 600;
}

.error-help {
    margin: 12px 0;
    padding: 12px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    border-left: 4px solid #f39c12;
}

.error-help .help-title {
    font-weight: 600;
    color: #d68910;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

.error-help .help-content {
    color: #856404;
    font-size: 0.9em;
    line-height: 1.4;
}

.error-help ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
}

.error-help li {
    margin: 4px 0;
}

/* 常见错误列表样式 */
.common-errors-list {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
}

.errors-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    background: #fff3cd;
    border-bottom: 1px solid #ffeaa7;
    font-weight: 600;
    color: #d68910;
}

.errors-icon {
    font-size: 18px;
}

.errors-title {
    font-size: 16px;
}

.error-item {
    padding: 12px 20px;
    border-bottom: 1px solid #f1f3f4;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.error-item:hover {
    background-color: #f8f9fa;
    border-left: 3px solid #ff9800;
}

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

.error-item .error-location {
    font-weight: bold;
    color: #dc3545;
    margin-bottom: 4px;
}

.error-item .error-description {
    margin: 6px 0;
    color: #495057;
    font-size: 0.95em;
}

.error-item .error-context {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    background: #f8f9fa;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 0.875rem;
    border: 1px solid #e9ecef;
    word-break: break-all;
    color: #2c3e50;
}

.errors-note {
    margin: 16px 20px;
    padding: 12px;
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #1565c0;
    text-align: center;
}

/* 错误按钮样式改进 */
.error-actions .btn {
    margin-right: 8px;
    padding: 6px 12px;
    font-size: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.error-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.error-actions .btn:first-child {
    background: #2196f3;
    color: white;
}

.error-actions .btn:first-child:hover {
    background: #1976d2;
}

.error-actions .btn:last-child {
    background: #ff9800;
    color: white;
}

.error-actions .btn:last-child:hover {
    background: #f57c00;
}

/* 上下文高亮样式 */
.error-preview .context-before {
    color: #6c757d;
}

.error-preview .context-error {
    background: #ffebee;
    color: #c62828;
    padding: 2px 4px;
    border-radius: 2px;
    font-weight: bold;
    border: 1px solid #ef9a9a;
}

.error-preview .context-after {
    color: #6c757d;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .error-help {
        margin: 8px 0;
        padding: 8px;
    }
    
    .error-help .help-content {
        font-size: 0.85em;
    }
    
    .errors-header {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .error-item {
        padding: 10px 16px;
    }
    
    .error-actions .btn {
        padding: 4px 8px;
        font-size: 11px;
        margin-right: 4px;
    }
    
    .errors-note {
        margin: 12px 16px;
        padding: 8px;
    }
}