/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4a90e2;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --info-color: #17a2b8;
    --danger-color: #dc3545;
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --text-color: #333333;
    --border-color: #dee2e6;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-hover);
    overflow: hidden;
}

/* 头部样式 */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.95;
    font-weight: 300;
}

/* 主内容区域 */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    padding: 30px;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* 输入和输出区域 */
.input-section,
.output-section {
    display: flex;
    flex-direction: column;
}

.input-section h2,
.output-section h2 {
    font-size: 1.5em;
    margin-bottom: 15px;
    color: var(--primary-color);
    font-weight: 600;
}

/* 文本输入框 */
#pbInput {
    width: 100%;
    padding: 15px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    resize: vertical;
    transition: border-color 0.3s, box-shadow 0.3s;
    background: #fafafa;
}

#pbInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* JSON 输出区域 */
.json-output {
    flex: 1;
    background: #fafafa;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    overflow: auto;
    max-height: 500px;
    min-height: 300px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
}

.json-output pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.json-output .placeholder {
    color: #999;
    text-align: center;
    margin-top: 100px;
    font-size: 1.1em;
}

.json-output.error {
    background: #fff5f5;
}

.error-message {
    color: var(--danger-color);
    padding: 15px;
    background: white;
    border-radius: 6px;
    border-left: 4px solid var(--danger-color);
    font-size: 1em;
}

/* 按钮组 */
.button-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

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

.btn-primary:hover {
    background: #357abd;
}

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

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

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

.btn-success:hover {
    background: #218838;
}

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

.btn-info:hover {
    background: #138496;
}

/* 通知提示 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-success {
    border-left: 4px solid var(--success-color);
    color: var(--success-color);
}

.notification-error {
    border-left: 4px solid var(--danger-color);
    color: var(--danger-color);
}

/* 页脚 */
footer {
    background: var(--bg-color);
    padding: 20px;
    text-align: center;
    color: var(--secondary-color);
    font-size: 0.9em;
    border-top: 1px solid var(--border-color);
}

/* 滚动条样式 */
.json-output::-webkit-scrollbar,
#pbInput::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.json-output::-webkit-scrollbar-track,
#pbInput::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.json-output::-webkit-scrollbar-thumb,
#pbInput::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.json-output::-webkit-scrollbar-thumb:hover,
#pbInput::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.8em;
    }

    .subtitle {
        font-size: 1em;
    }

    .main-content {
        padding: 20px;
        gap: 20px;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}
