/* 全局样式重置和变量定义 */
:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #6b7280;
    --secondary-hover: #4b5563;
    --background-light: #f9fafb;
    --background-dark: #1a1a1a;
    --text-light: #1f2937;
    --text-dark: #f3f4f6;
    --border-light: #e5e7eb;
    --border-dark: #374151;
    --error-color: #ef4444;
    --success-color: #10b981;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    background-color: var(--background-light);
    color: var(--text-light);
    transition: var(--transition);
}

/* 暗色主题 */
body.dark-theme {
    --background-light: var(--background-dark);
    --text-light: var(--text-dark);
    --border-light: var(--border-dark);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 30px;
    animation: fadeInDown 0.6s ease-out;
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--secondary-color);
    font-weight: 400;
}

/* 工具栏样式 */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

body.dark-theme .toolbar {
    background-color: #262626;
}

.tool-group {
    display: flex;
    gap: 10px;
}

/* 按钮样式 */
.btn {
    padding: 10px 18px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: var(--secondary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* 编辑器容器样式 */
.editor-container {
    margin-bottom: 20px;
}

#json-input {
    width: 100%;
    height: 500px;
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    padding: 20px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    background-color: white;
    color: var(--text-light);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

/* 错误消息样式 */
.error-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    margin-top: 20px;
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error-color);
    border-radius: var(--border-radius);
    color: var(--error-color);
    transition: var(--transition);
}

body.dark-theme .error-message {
    background-color: rgba(239, 68, 68, 0.2);
}

.error-message.hidden {
    display: none;
}

/* 页脚样式 */
.footer {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    color: var(--secondary-color);
    font-size: 14px;
}

/* 单框模式样式优化 */
body.dark-theme #json-input {
    background-color: #262626;
    color: var(--text-dark);
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .editor-container {
        grid-template-columns: 1fr;
    }
    
    #json-input,
    .output-container {
        height: 300px;
    }
    
    .toolbar {
        flex-direction: column;
        gap: 15px;
    }
    
    .tool-group {
        width: 100%;
        justify-content: center;
    }
    
    .title {
        font-size: 2rem;
    }
}

/* 复制成功提示 */
.copy-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--success-color);
    color: white;
    padding: 12px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition);
    z-index: 1000;
}

.copy-toast.show {
    opacity: 1;
    transform: translateY(0);
}