:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    display: flex;
    min-height: 100vh;
}

/* 左侧导航栏 */
.sidebar {
    width: 250px;
    background: var(--dark-color);
    color: white;
    padding: 20px 0;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 100;
}

.sidebar-header {
    text-align: center;
    padding: 10px 0 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 20px;
}

.sidebar-header h2 {
    font-size: 1.5rem;
    color: var(--light-color);
}

.category-title {
    padding: 10px 20px;
    font-weight: bold;
    color: #7f8c8d;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

.tool-group {
    list-style: none;
}

.tool-group li {
    padding: 10px 20px 10px 35px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.tool-group li:hover {
    background: rgba(255,255,255,0.1);
}

.tool-group li.active {
    background: var(--primary-color);
    border-left: 4px solid var(--warning-color);
}

.tool-group li .icon {
    margin-right: 10px;
    font-size: 18px;
}

/* 主内容区 */
.main-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.tool-container {
    display: none;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 0 20px rgba(0,0,0,0.05);
    padding: 25px;
    margin-bottom: 20px;
}

.tool-container.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tool-header {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--light-color);
}

.tool-header h2 {
    color: var(--dark-color);
    font-size: 1.8rem;
}

.tool-header p {
    color: #7f8c8d;
    font-size: 0.95rem;
}

/* 工具功能区样式 */
.input-section, .output-section {
    margin-bottom: 20px;
}

.input-section textarea, .output-section textarea {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-family: monospace;
    font-size: 14px;
    resize: vertical;
    background-color: #f8f9fa;
    margin-bottom: 10px;
}

.dual-input {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
}

.dual-input textarea {
    flex: 1;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-success {
    background: var(--secondary-color);
    color: white;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.result-section {
    padding: 15px;
    background: #eaf7ff;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    min-height: 80px;
}

/* 时间工具特定样式 */
.time-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.time-control {
    flex: 1;
    min-width: 200px;
}

.time-control label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.time-control input,
.time-control select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
}

/* 文本对比结果样式 */
.diff-line {
    padding: 5px 10px;
    border-bottom: 1px solid #eee;
}

.diff-line.same {
    background-color: #f8fff8;
}

.diff-line.diff {
    background-color: #fff8f8;
}

.diff-line.diff .left {
    color: var(--danger-color);
    text-decoration: line-through;
}

.diff-line.diff .right {
    color: var(--secondary-color);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: sticky;
        top: 0;
    }
    
    .tool-group {
        display: flex;
        flex-wrap: wrap;
    }
    
    .tool-group li {
        padding: 10px 15px;
    }
    
    .category-title {
        width: 100%;
    }
    
    .dual-input {
        flex-direction: column;
        gap: 10px;
    }
    
    .time-control {
        min-width: 100%;
    }
}

/* ======================== */
/* 文本对比工具优化 */
/* ======================== */
#text-compare .dual-input {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

#text-compare .dual-input > div {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#text-compare textarea {
    width: 100%;
    min-height: 300px; /* 增加高度 */
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-family: monospace;
    font-size: 14px;
    resize: vertical;
    background-color: #f8f9fa;
    line-height: 1.5;
}

#text-compare label {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--dark-color);
}

/* ======================== */
/* JSON对比工具优化 */
/* ======================== */
#json-compare .dual-input {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

#json-compare .dual-input > div {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#json-compare textarea {
    width: 100%;
    min-height: 300px; /* 增加高度 */
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-family: monospace;
    font-size: 14px;
    resize: vertical;
    background-color: #f8f9fa;
    line-height: 1.5;
}

#json-compare label {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--dark-color);
}

/* ======================== */
/* 结果区域优化 */
/* ======================== */
#compare-result, #json-compare-result {
    min-height: 200px;
    max-height: 500px;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    font-family: monospace;
    white-space: pre-wrap;
    line-height: 1.5;
}

/* ======================== */
/* 响应式设计优化 */
/* ======================== */
@media (max-width: 768px) {
    /* 在移动设备上垂直堆叠输入框 */
    .dual-input {
        flex-direction: column;
        gap: 15px;
    }
    
    /* 调整输入框高度 */
    #text-compare textarea, 
    #json-compare textarea {
        min-height: 200px;
    }
    
    /* 结果区域优化 */
    #compare-result, #json-compare-result {
        min-height: 150px;
        max-height: 300px;
    }
}

/* ======================== */
/* 差异高亮样式 */
/* ======================== */
.diff-container {
    font-family: monospace;
    font-size: 14px;
    line-height: 1.6;
}

.diff-line {
    padding: 3px 10px;
    border-bottom: 1px solid #eee;
    display: flex;
}

.diff-line.same {
    background-color: #f8fff8;
}

.diff-line.diff {
    background-color: #fff8f8;
}

.diff-line .line-number {
    width: 40px;
    color: #777;
    text-align: right;
    padding-right: 10px;
    user-select: none;
}

.diff-line .left {
    flex: 1;
    padding-right: 10px;
    border-right: 1px solid #eee;
}

.diff-line .right {
    flex: 1;
    padding-left: 10px;
}

.diff-line.diff .left {
    color: var(--danger-color);
    text-decoration: line-through;
}

.diff-line.diff .right {
    color: var(--secondary-color);
}

.diff-header {
    background-color: #eef;
    padding: 5px 10px;
    font-weight: bold;
    border-bottom: 1px solid #ddd;
}

/* ======================== */
/* 时间差计算器样式 */
/* ======================== */
.time-controls {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.time-group {
    flex: 1;
    min-width: 300px;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    padding: 15px;
    border: 1px solid #e0e0e0;
}

.time-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.time-group-title {
    font-weight: 600;
    color: var(--dark-color);
}

.time-control {
    margin-bottom: 15px;
}

.time-control label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.time-control input,
.time-control select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 16px;
}

.result-section {
    padding: 20px;
    background: #eaf7ff;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.result-header {
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--dark-color);
}

.timestamp-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.timestamp-box {
    flex: 1;
    min-width: 200px;
    background: white;
    border-radius: var(--border-radius);
    padding: 15px;
    border: 1px solid #ddd;
}

.timestamp-label {
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 5px;
}

.timestamp-value {
    font-size: 18px;
    font-weight: 600;
    font-family: monospace;
    word-break: break-all;
}

.difference-result {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-top: 20px;
    text-align: center;
    border: 1px solid #ddd;
}

.difference-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
    margin: 10px 0;
}

.difference-details {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.difference-item {
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: var(--border-radius);
    min-width: 80px;
}

.difference-number {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark-color);
}

.difference-label {
    font-size: 14px;
    color: #7f8c8d;
}

@media (max-width: 768px) {
    .time-group {
        min-width: 100%;
    }
    
    .timestamp-box {
        min-width: 100%;
    }
}



/* ======================== */
/* 时间戳转换工具样式 */
/* ======================== */
.time-group {
    flex: 1;
    min-width: 300px;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    padding: 15px;
    border: 1px solid #e0e0e0;
    margin-bottom: 20px;
}

.time-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.time-group-title {
    font-weight: 600;
    color: var(--dark-color);
}

.time-control {
    margin-bottom: 15px;
}

.time-control label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.time-control input,
.time-control select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 16px;
}

.result-box {
    margin-top: 15px;
    padding: 10px;
    background: white;
    border-radius: var(--border-radius);
    border-left: 3px solid var(--primary-color);
}

.result-label {
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 5px;
}

.result-value {
    font-size: 16px;
    font-weight: 600;
    font-family: monospace;
}

.difference-result {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-top: 20px;
    border: 1px solid #ddd;
}

.result-header {
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--dark-color);
    text-align: center;
}

.difference-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    margin: 10px 0;
    text-align: center;
}

.difference-details {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.difference-item {
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: var(--border-radius);
    min-width: 80px;
    text-align: center;
}

.difference-number {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark-color);
}

.difference-label {
    font-size: 14px;
    color: #7f8c8d;
}

@media (max-width: 768px) {
    .time-group {
        min-width: 100%;
    }
    
    .difference-item {
        min-width: 70px;
    }
}