/* style.css */
/* 基础样式重置 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
    overflow: hidden;
}

/* 应用容器 */
.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 顶部工具栏 */
.top-toolbar {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 100;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.app-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    opacity: 0.9;
}

.file-size, .file-status {
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    font-size: 0.8rem;
}

/* 认证表单样式 */
.auth-form {
    margin: 0;
}

.auth-section {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: nowrap; /* 强制不换行 */
    min-width: 0; /* 允许flex items收缩 */
}

.token-input {
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 14px;
    min-width: 250px;
    max-width: 300px;
    width: 250px; /* 固定宽度 */
    transition: all 0.3s ease;
    font-family: 'Monaco', 'Menlo', monospace;
    flex-shrink: 0; /* 防止输入框被压缩 */
}

.token-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.token-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

/* 主内容区域 */
.main-container {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* 左侧面板 */
.left-panel {
    width: 280px;
    background: white;
    border-right: 1px solid #e1e5e9;
    overflow-y: auto;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
}

.panel-header {
    padding: 15px;
    border-bottom: 1px solid #e1e5e9;
    background: #f8f9fa;
}

.panel-header h3 {
    font-size: 1.1rem;
    color: #495057;
    margin: 0;
}

.tool-section {
    padding: 15px;
    border-bottom: 1px solid #f1f3f4;
}

.tool-section h4 {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 12px;
    font-weight: 500;
}

.tool-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.view-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 4px 0;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    accent-color: #667eea;
}

.theme-selector, .font-size-control {
    margin-bottom: 12px;
}

.theme-selector label, .font-size-control label {
    display: block;
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 4px;
}

.select-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: white;
    font-size: 0.9rem;
}

.font-size-control {
    display: flex;
    flex-direction: column;
}

.slider {
    width: 100%;
    margin: 5px 0;
    accent-color: #667eea;
}

/* 主编辑区 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e5e9;
}

.editor-tabs {
    display: flex;
    gap: 2px;
}

.tab-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: #6c757d;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 4px 4px 0 0;
    transition: all 0.2s ease;
}

.tab-btn.active {
    background: white;
    color: #495057;
    border-bottom: 2px solid #667eea;
}

.tab-btn:hover:not(.active) {
    background: #e9ecef;
    color: #495057;
}

.editor-controls {
    display: flex;
    gap: 8px;
}

.editor-content {
    flex: 1;
    position: relative;
}

.tab-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
}

.tab-content.active {
    display: block;
}

.editor-container, .tree-container, .preview-container {
    height: 100%;
    width: 100%;
}

#json-tree {
    padding: 15px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 14px;
    overflow: auto;
    background: #fafafa;
}

.tree-item {
    margin: 2px 0;
    padding: 2px 0;
}

.tree-key {
    color: #0451a5;
    font-weight: 500;
}

.tree-value {
    color: #0F1419;
}

.tree-string {
    color: #032f62;
}

.tree-number {
    color: #0F1419;
}

.tree-boolean {
    color: #0000FF;
}

.tree-null {
    color: #0000FF;
}

.tree-bracket {
    color: #000000;
    font-weight: bold;
}

#json-preview-content {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 14px;
    padding: 15px;
    margin: 0;
    white-space: pre-wrap;
    overflow: auto;
    height: 100%;
    background: #fafafa;
}

/* 按钮样式 - 修复版本 */
.btn {
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
    min-height: 36px;
    white-space: nowrap; /* 防止按钮文字换行 */
    flex-shrink: 0; /* 防止按钮被压缩 */
}

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

.btn-primary {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* 修复后的悬停效果 - 移除transform，只改变颜色和阴影 */
.btn-primary:hover:not(:disabled) {
    background: #5a67d8;
    border-color: #5a67d8;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.btn-success {
    background: #48bb78;
    color: white;
    border-color: #48bb78;
}

.btn-success:hover:not(:disabled) {
    background: #38a169;
    border-color: #38a169;
    box-shadow: 0 2px 4px rgba(72, 187, 120, 0.3);
}

.btn-secondary {
    background: #718096;
    color: white;
    border-color: #718096;
}

.btn-secondary:hover:not(:disabled) {
    background: #4a5568;
    border-color: #4a5568;
}

.btn-outline {
    background: transparent;
    color: #667eea;
    border-color: #667eea;
}

.btn-outline:hover:not(:disabled) {
    background: #667eea;
    color: white;
}

.btn-icon {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* 状态栏 */
.status-bar {
    height: 28px;
    background: #f8f9fa;
    border-top: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    font-size: 0.8rem;
    color: #6c757d;
}

.status-left, .status-center, .status-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.validation-status {
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: 500;
}

.validation-status.valid {
    background: #d4edda;
    color: #155724;
}

.validation-status.invalid {
    background: #f8d7da;
    color: #721c24;
}

.validation-status.warning {
    background: #fff3cd;
    color: #856404;
}

/* 消息提示 */
.message-toast {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    max-width: 350px;
    word-wrap: break-word;
}

.message-toast.show {
    transform: translateX(0);
}

.message-toast.success {
    background: #48bb78;
}

.message-toast.error {
    background: #f56565;
}

.message-toast.warning {
    background: #ed8936;
}

.message-toast.info {
    background: #667eea;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
}

.modal-content h3 {
    margin-bottom: 15px;
    color: #495057;
}

.modal-content p {
    margin-bottom: 20px;
    color: #6c757d;
    line-height: 1.5;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .left-panel {
        width: 250px;
    }
    
    .auth-section {
        flex-wrap: wrap; /* 小屏幕时允许换行 */
        justify-content: center;
    }
    
    .token-input {
        min-width: 200px;
        max-width: 250px;
        width: 200px;
    }
    
    .btn {
        min-width: 100px;
    }
}

@media (max-width: 768px) {
    .top-toolbar {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .toolbar-left, .toolbar-right {
        width: 100%;
        justify-content: center;
    }
    
    .main-container {
        flex-direction: column;
    }
    
    .left-panel {
        width: 100%;
        height: 200px;
        border-right: none;
        border-bottom: 1px solid #e1e5e9;
    }
    
    .auth-section {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }
    
    .token-input {
        min-width: auto;
        max-width: none;
        width: 100%;
    }
    
    .btn {
        min-width: auto;
        width: 100%;
    }
    
    .file-info {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* 加载动画 */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* 全屏模式 */
.fullscreen-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: white;
}

.fullscreen-mode .left-panel {
    display: none;
}

.fullscreen-mode .main-content {
    height: 100vh;
}
