/* 全局样式 - 蓝色可爱风格 */
:root {
    /* 主色调 - 蓝色系 */
    --primary-color: #64b5f6; /* 天空蓝 */
    --secondary-color: #90caf9; /* 浅蓝色 */
    --accent-color: #42a5f5; /* 亮蓝色 */
    --success-color: #81c784; /* 薄荷绿 */
    
    /* 背景和文本 */
    --background-color: #f0f8ff; /* 超浅蓝色背景 */
    --text-color: #455a64; /* 深蓝灰色文本 */
    --border-color: #bbdefb; /* 浅蓝色边框 */
    --editor-bg: #f8fdff; /* 编辑器背景 */
    
    /* JSON语法高亮 */
    --key-color: #7e57c2; /* 紫色键名 */
    --value-color: #26a69a; /* 绿松石值 */
    --string-color: #ef5350; /* 红色字符串 */
    --number-color: #29b6f6; /* 蓝色数字 */
    --boolean-color: #ffa726; /* 橙色布尔值 */
    --null-color: #90a4ae; /* 蓝灰色null */
    
    /* 字体 */
    --header-font: 'Comic Sans MS', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    background-image: url('data:image/svg+xml;utf8,<svg width="100" height="100" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><circle cx="20" cy="20" r="3" fill="%23bbdefb" opacity="0.5"/><circle cx="50" cy="50" r="2" fill="%2390caf9" opacity="0.5"/><circle cx="80" cy="80" r="4" fill="%23b3e5fc" opacity="0.5"/></svg>');
    background-size: 100px 100px;
}

.container {
    max-width: 1400px;
    min-height: 100vh;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(100, 181, 246, 0.2);
    border: 1px solid rgba(187, 222, 251, 0.5);
}

header {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 25px;
    box-shadow: 0 5px 15px rgba(100, 181, 246, 0.3);
    position: relative;
    overflow: hidden;
    background-image: linear-gradient(135deg, var(--primary-color), var(--accent-color));
}

header::before, header::after {
    content: '🌊';
    position: absolute;
    font-size: 24px;
    top: 50%;
    transform: translateY(-50%);
}

header::before {
    left: 20px;
}

header::after {
    right: 20px;
}

header h1 {
    font-family: var(--header-font);
    letter-spacing: 1px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    display: inline-block;
}

header h1::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: white;
    border-radius: 10px;
    transform: scaleX(0.7);
    transform-origin: center;
    transition: transform 0.3s ease;
}

header:hover h1::after {
    transform: scaleX(1);
}

/* 主容器布局 - 可爱风格 */
.main-content {
    display: flex;
    flex: 1;
    gap: 30px;
    margin-bottom: 20px;
    padding: 10px 5px;
    position: relative;
    width: 95%;
    margin-left: auto;
    margin-right: auto;
}

.main-content::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background-image: url('data:image/svg+xml;utf8,<svg width="40" height="40" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg"><path d="M20,0 L25,15 L40,20 L25,25 L20,40 L15,25 L0,20 L15,15 Z" fill="%2390caf9" opacity="0.7"/></svg>');
    pointer-events: none;
    z-index: 1;
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }
}

@media (min-width: 1400px) {
    .main-content {
        width: 95%;
        max-width: 1800px;
        margin: 0 auto;
        gap: 40px;
    }
    
    .editor-container, .visualizer-container {
        min-width: 45%;
    }
}

/* 编辑器样式 - 可爱风格 */
.editor-container, .visualizer-container {
    flex: 1;
    background: white;
    border-radius: 20px;
    box-shadow: 0 8px 20px rgba(100, 181, 246, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 2px solid var(--border-color);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    max-height: 600px;
}

.editor-container::before, .visualizer-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--secondary-color), var(--accent-color), var(--secondary-color));
    z-index: 2;
    border-radius: 20px 20px 0 0;
    opacity: 0.7;
}

.editor-container:hover, .visualizer-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(100, 181, 246, 0.15);
}

.editor-header, .visualizer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-image: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border-bottom: 3px dotted rgba(255, 255, 255, 0.3);
}

.editor-header h2, .visualizer-header h2 {
    font-family: var(--header-font);
    font-size: 1.3rem;
    position: relative;
    display: inline-block;
}

.editor-header h2::after, .visualizer-header h2::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: white;
    border-radius: 10px;
}

.editor-tools, .visualizer-tools {
    display: flex;
    gap: 10px;
    align-items: center;
}

button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 8px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    box-shadow: 0 3px 10px rgba(100, 181, 246, 0.2);
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: 0.5s;
}

button:hover {
    background-color: var(--accent-color);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(66, 165, 245, 0.3);
}

button:hover::before {
    left: 100%;
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(100, 181, 246, 0.2);
}

select {
    padding: 8px 12px;
    border-radius: 50px;
    border: 2px solid var(--border-color);
    background-color: white;
    color: var(--text-color);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(100, 181, 246, 0.1);
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="%2364b5f6" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 9l6 6 6-6"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 30px;
}

select:hover, select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 5px 15px rgba(100, 181, 246, 0.2);
    outline: none;
}

#code-input {
    flex: 1;
    padding: 20px 25px;
    border: none;
    resize: none;
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--editor-bg);
    border-radius: 0 0 20px 20px;
    transition: all 0.3s ease;
    background-image: url('data:image/svg+xml;utf8,<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M0,0 L20,0 L20,20 L0,20 Z" fill="none" stroke="%2390caf9" stroke-width="1" stroke-dasharray="2" opacity="0.3"/></svg>');
    border-top: 1px dashed rgba(144, 202, 249, 0.3);
    width: 100%;
    box-sizing: border-box;
}

#code-input:focus {
    outline: none;
    box-shadow: inset 0 0 10px rgba(100, 181, 246, 0.1);
    background-image: url('data:image/svg+xml;utf8,<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M0,0 L20,0 L20,20 L0,20 Z" fill="none" stroke="%2364b5f6" stroke-width="1" stroke-dasharray="2" opacity="0.4"/></svg>');
}

#error-container {
    padding: 10px 15px;
    color: var(--error-color);
    font-size: 14px;
    background-color: #fde2e2;
    display: none;
}

.tree-view {
    flex: 1;
    padding: 20px 25px;
    overflow-y: auto;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    border-radius: 0 0 18px 18px;
    background-color: var(--editor-bg);
    border-top: 1px dashed rgba(144, 202, 249, 0.3);
    width: 100%;
    box-sizing: border-box;
    min-height: 300px;
    max-height: 100%;
}

.tree-node {
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.tree-node-content {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 50px;
    transition: all 0.3s ease;
    position: relative;
    margin: 2px 0;
}

.tree-node-content:hover {
    background-color: rgba(144, 202, 249, 0.2);
    transform: translateX(3px);
}

.tree-node-key {
    font-weight: bold;
    margin-right: 5px;
    color: var(--key-color);
    position: relative;
}

.tree-node-key::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--key-color);
    transition: width 0.3s ease;
}

.tree-node-content:hover .tree-node-key::after {
    width: 100%;
}

.tree-node-colon {
    margin-right: 5px;
}

.tree-node-value {
    color: var(--value-color);
    transition: color 0.3s ease;
}

.tree-node-content:hover .tree-node-value {
    color: var(--accent-color);
}

.tree-node-children {
    margin-left: 20px;
    border-left: 2px dashed var(--border-color);
    padding-left: 15px;
    position: relative;
}

.tree-node-children::before {
    content: '';
    position: absolute;
    left: -5px;
    top: -5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--secondary-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.2); opacity: 0.9; }
    100% { transform: scale(1); opacity: 0.7; }
}

/* 拖拽样式 - 可爱风格 */
.dragging {
    opacity: 0.6;
    cursor: grabbing;
}

.drag-over {
    border: 3px dashed var(--accent-color);
    background-color: rgba(144, 202, 249, 0.1);
    animation: drag-pulse 1.5s infinite;
}

@keyframes drag-pulse {
    0% { box-shadow: 0 0 0 0 rgba(66, 165, 245, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(66, 165, 245, 0); }
    100% { box-shadow: 0 0 0 0 rgba(66, 165, 245, 0); }
}

.drag-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 25px 30px;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(100, 181, 246, 0.2);
    text-align: center;
    pointer-events: none;
    font-size: 16px;
    color: var(--accent-color);
    border: 2px dashed var(--accent-color);
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translate(-50%, -50%); }
    40% { transform: translate(-50%, -60%); }
    60% { transform: translate(-50%, -55%); }
}

.drag-message::before {
    content: '📋';
    font-size: 24px;
    display: block;
    margin-bottom: 10px;
}

.error-message {
    color: #e57373;
    margin-top: 10px;
    padding: 12px 15px;
    background-color: #ffebee;
    border-radius: 50px;
    font-size: 14px;
    box-shadow: 0 3px 10px rgba(229, 115, 115, 0.1);
    position: relative;
    animation: shake 0.5s ease-in-out;
    border-left: 4px solid #e57373;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.error-message::before {
    content: '❗';
    margin-right: 8px;
}

/* 导出功能已改为直接下载文件，不再需要模态窗口样式 */

.tree-view {
    flex: 1;
    padding: 20px 25px;
    overflow-y: auto;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    border-radius: 0 0 18px 18px;
    background-color: var(--editor-bg);
    border-top: 1px dashed rgba(144, 202, 249, 0.3);
    width: 100%;
    box-sizing: border-box;
    min-height: 300px;
    max-height: 100%;
}

/* 页脚样式 - 可爱风格 */
footer {
    text-align: center;
    margin-top: 30px;
    padding: 15px;
    font-size: 14px;
    color: var(--text-color);
    position: relative;
    border-top: 2px dotted var(--border-color);
}

footer::before, footer::after {
    content: '💙';
    position: absolute;
    top: -12px;
    background: var(--background-color);
    padding: 0 10px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

footer::before {
    left: 30%;
}

footer::after {
    right: 30%;
}

footer a {
    color: var(--accent-color);
    text-decoration: none;
    position: relative;
    transition: all 0.3s ease;
}

footer a::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: var(--accent-color);
    transform: scaleX(0);
    transform-origin: bottom right;
    transition: transform 0.3s ease;
}

footer a:hover {
    color: var(--primary-color);
}

footer a:hover::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}