:root {
    --primary-color: #4361ee;
    --secondary-color: #3a0ca3;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #212529;
    --border-color: #dee2e6;
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --sidebar-width: 250px;
    --header-height: 60px;
    --transition: all 0.3s ease;
    --success: #4caf50;
    --warning: #ff9800;
    --red: #e53935;
    --green: #43a047;
    --blue: #1e88e5;
}

[data-theme="dark"] {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-color: #e9e9e9;
    --border-color: #333333;
    --red: #f44336;
    --green: #66bb6a;
    --blue: #42a5f5;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    transition: var(--transition);
}

/* 侧边栏样式 */
.sidebar {
    width: var(--sidebar-width);
    background: var(--card-bg);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    padding: 20px 0;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    box-shadow: var(--shadow);
    z-index: 100;
    transition: var(--transition);
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.sidebar-header h2 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.nav {
    list-style: none;
    padding: 0;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    text-decoration: none;
    color: var(--text-color);
    border-left: 4px solid transparent;
    transition: var(--transition);
}

.nav-link:hover {
    background: rgba(67, 97, 238, 0.1);
    border-left-color: var(--primary-color);
}

.nav-link.active {
    background: rgba(67, 97, 238, 0.15);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
}

.nav-link i {
    margin-right: 12px;
    font-size: 1.2rem;
}

/* 主内容区域 */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 30px;
    min-height: 100vh;
}

.tool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.tool-header h1 {
    font-size: 1.8rem;
    color: var(--text-color);
}

.theme-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card-bg);
    border-radius: 50px;
    padding: 6px;
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.switch-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
}

.switch-btn.active {
    background: var(--primary-color);
    color: white;
}

/* 工具容器 */
.tool-container {
    display: none;
    padding: 25px;
    border-radius: 12px;
    background: var(--card-bg);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    transition: var(--transition);
}

.tool-container.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

.tool-title {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 工具样式 - 通用部分 */
.input-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

textarea, input, select {
    width: 100%;
    padding: 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 1rem;
    transition: var(--transition);
}

textarea {
    min-height: 150px;
    resize: vertical;
}

textarea:focus, input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.25);
}

button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

button:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

.btn-group {
    display: flex;
    gap: 12px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.result-container {
    margin-top: 20px;
    padding: 20px;
    border-radius: 8px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    min-height: 100px;
    max-height: 500px;
    overflow: auto;
}

.btn-copy {
    background: rgba(67, 97, 238, 0.1);
    color: var(--primary-color);
    border: 1px solid rgba(67, 97, 238, 0.3);
}

.btn-copy:hover {
    background: rgba(67, 97, 238, 0.2);
    color: var(--secondary-color);
}

.timestamp-result {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--primary-color);
    margin-top: 15px;
}

/* 实时时间戳 */
.current-timestamp {
    background: rgba(67, 97, 238, 0.1);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 25px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.timestamp-box {
    background: rgba(67, 97, 238, 0.15);
    padding: 15px;
    border-radius: 8px;
}

.timestamp-label {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: var(--secondary-color);
    font-weight: 500;
}

.timestamp-value {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--primary-color);
    word-break: break-all;
    cursor: pointer;
}

.input-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.input-row > div {
    flex: 1;
}

.tool-row {
    display: flex;
    gap: 12px;
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    background: var(--success);
    color: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    transform: translateX(150%);
    transition: transform 0.3s ease;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.tip {
    background: rgba(255, 152, 0, 0.1);
    padding: 12px 15px;
    border-radius: 8px;
    margin: 15px 0;
    font-size: 0.9rem;
    color: var(--warning);
    border-left: 3px solid var(--warning);
}

.input-info {
    font-size: 0.85rem;
    color: #666;
    margin-top: 5px;
    margin-left: 5px;
}

/* JSON格式化错误样式 */
.error {
    color: var(--red);
    font-weight: bold;
}

pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: Consolas, Monaco, 'Andale Mono', monospace;
    line-height: 1.5;
}

/* 文本对比区域 */
.diff-container {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.diff-col {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.diff-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.diff-textarea {
    flex: 1;
    min-height: 300px;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 15px;
    line-height: 1.6;
    resize: vertical;
    font-family: monospace;
}

.diff-result-container {
    min-height: 300px;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    overflow: auto;
    display: none;
}

/* 文本对比高亮 */
.text-deleted {
    background-color: rgba(239, 83, 80, 0.2);
    text-decoration: line-through;
    padding: 2px 4px;
    margin: 2px 0;
}

.text-added {
    background-color: rgba(76, 175, 80, 0.2);
    padding: 2px 4px;
    margin: 2px 0;
}

.diff-row {
    font-family: monospace;
    white-space: pre-wrap;
    padding: 2px 5px;
    margin: 2px 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        height: auto;
    }

    .main-content {
        margin-left: 0;
    }
    
    .input-row, .diff-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .current-timestamp {
        grid-template-columns: 1fr;
    }
}

/* 动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* 图片预览容器 */
#image-preview-container {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    min-height: 150px;
    background-color: var(--bg-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* 图片预览图 */
#image-preview {
    max-width: 100%;
    max-height: 300px;
    display: none;
    margin-bottom: 10px;
}

/* 文件输入样式 */
.file-input {
    padding: 10px;
    background: var(--bg-color);
}

/* 结果文本区域 */
.result-textarea {
    min-height: 100px;
    background: var(--bg-color);
    font-family: monospace;
    padding: 12px;
}