
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(145deg, #f0f4fa 0%, #e9eef4 100%);
    font-family: 'Inter', sans-serif;
    color: #1e293b;
    height: 100vh;
    overflow: hidden;
}

/* 整体布局: 左右结构 + 响应式 */
.app-container {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* ========= 左侧导航区 (现代磨砂玻璃质感+卡片风格) ========= */
.nav-sidebar {
    width: 280px;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(12px);
    border-right: 1px solid rgba(203, 213, 225, 0.5);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.25rem;
    z-index: 10;
}

.logo-area {
    margin-bottom: 2.5rem;
    padding-left: 0.5rem;
}

.logo-area h1 {
    font-size: 1.65rem;
    font-weight: 700;
    background: linear-gradient(135deg, #2563eb, #1e40af);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    letter-spacing: -0.3px;
}

.logo-area p {
    font-size: 0.75rem;
    color: #4b5563;
    margin-top: 0.3rem;
    font-weight: 500;
}

.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0.9rem 1rem;
    border-radius: 1.25rem;
    font-weight: 500;
    font-size: 1rem;
    color: #334155;
    transition: all 0.2s ease;
    cursor: pointer;
    background: transparent;
}

.nav-item i {
    width: 24px;
    font-size: 1.25rem;
    text-align: center;
}

.nav-item:hover {
    background: rgba(37, 99, 235, 0.1);
    color: #1e40af;
    transform: translateX(4px);
}

.nav-item.active {
    background: linear-gradient(115deg, rgba(37, 99, 235, 0.18), rgba(37, 99, 235, 0.05));
    color: #2563eb;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.02), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    border-left: 3px solid #2563eb;
    font-weight: 600;
}

/* 底部装饰 */
.nav-footer {
    margin-top: auto;
    font-size: 0.7rem;
    text-align: center;
    color: #6c757d;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(148, 163, 184, 0.3);
}

/* ========= 右侧内容区 (滚动卡片) ========= */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    scroll-behavior: smooth;
    display: inline-block;
    position: relative;
}

.loading-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 300px;
    font-size: 1.2rem;
    color: #64748b;
    gap: 12px;
}

.main-content:after {
    display: inline-block;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    scroll-behavior: smooth;
}

/* 卡片通用设计 */
.card {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column; /* 垂直排列子元素 */
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(2px);
    border-radius: 2rem;
    box-shadow: 0 20px 35px -12px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.6);
    padding: 1.75rem 2rem;
    transition: all 0.2s;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #eef2ff;
    padding-bottom: 0.75rem;
}

.card-header i {
    font-size: 1.7rem;
    color: #2563eb;
    background: #eef2ff;
    padding: 10px;
    border-radius: 16px;
}

.card-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #0f172a;
}

.tool-description {
    font-size: 0.85rem;
    color: #475569;
    margin-bottom: 1.5rem;
}

/* JSON 工具内部左右布局 */
.json-split-layout {
    flex-grow: 1; /* 关键：占据剩余所有空间 */
    /* 防止内容溢出 */
    overflow-y: auto;
    box-sizing: border-box; /* 包含内边距 */
}

.json-editor-section {
    display: flex;
    flex-direction: column;
    float: left;
    width: 50%;
    height: 100%;
    padding-right: 4px;
}

.json-preview-section {
    display: flex;
    flex-direction: column;
    float: left;
    width: 50%;
    height: 100%;
    padding-left: 4px;
}

.section-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.2px;
}

.section-label i {
    font-size: 0.9rem;
    color: #2563eb;
}

textarea, input {
    width: 100%;
    padding: 0.9rem 1rem;
    border-radius: 1.2rem;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
    transition: 0.2s;
    outline: none;
    color: #1e293b;
}

textarea:focus, input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

textarea {
    flex: 1;
    resize: vertical;
    min-height: 280px;
}

.btn-group {
    display: flex;
    gap: 12px;
    margin: 1rem 0 0.5rem;
    flex-wrap: wrap;
}

button {
    background: #f1f5f9;
    border: none;
    padding: 0.6rem 1.3rem;
    border-radius: 2rem;
    font-weight: 500;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: #1e293b;
    font-family: 'Inter', sans-serif;
}

button.primary {
    background: #2563eb;
    color: white;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

button.primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

button:hover {
    background: #e2e8f0;
    transform: translateY(-1px);
}

.result-area {
    background: #0f172a;
    color: #e2e8f0;
    padding: 1rem 1.2rem;
    border-radius: 1.2rem;
    margin-top: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    flex: 1;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.error-message {
    color: #ef4444;
    background: #fee2e2;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    margin-top: 0.8rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.json-tree-node {
    margin-left: 1.2rem;
    list-style: none;
    position: relative;
}

.json-tree-root {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.json-tree-item {
    position: relative;
    line-height: 1.5;
    cursor: pointer;
    user-select: none;
}

.json-toggle {
    display: inline-block;
    width: 18px;
    text-align: center;
    cursor: pointer;
    color: #60a5fa;
    font-size: 0.7rem;
    margin-right: 4px;
    transition: transform 0.1s;
}

.json-key {
    color: #7dd3fc;
    font-weight: 500;
}

.json-string {
    color: #a7f3d0;
}

.json-number {
    color: #fcd34d;
}

.json-boolean {
    color: #f472b6;
}

.json-null {
    color: #94a3b8;
    font-style: italic;
}

.json-bracket {
    color: #cbd5e1;
}

.json-preview-placeholder {
    background: #0f172a;
    border-radius: 1.2rem;
    padding: 1rem;
    color: #94a3b8;
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
}

.error-placeholder {
    background: #fee2e2;
    color: #b91c1c;
}

.inline-group {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1.2rem;
}

.timestamp-input {
    flex: 2;
    min-width: 180px;
}

.date-input {
    flex: 3;
    min-width: 200px;
}

.result-badge {
    background: #eef2ff;
    border-radius: 1.2rem;
    padding: 0.5rem 1rem;
    font-weight: 500;
    word-break: break-all;
}

hr {
    margin: 1rem 0;
    border-color: #eef2ff;
}

/* 工具隐藏切换 */
.tool-panel {
    display: none;
}

.tool-panel.active-panel {
    display: block;
    width: 100%;
    height: 100%;
}

/* 图片处理，头部区域 */
.imagework-hero {
    background: #1e2a3e;
    background: linear-gradient(135deg, #1a2a3f 0%, #0f1a24 100%);
    padding: 2rem 2rem 1.8rem;
    color: white;
    text-align: center;
}

.imagework-hero h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.imagework-hero h1 span {
    background: #ffb347;
    background: linear-gradient(120deg, #ffb347, #ff8c1a);
    padding: 0.2rem 0.8rem;
    border-radius: 60px;
    font-size: 1rem;
    font-weight: 500;
    color: #1e2a3e;
}

.imagework-hero p {
    opacity: 0.8;
    font-size: 1rem;
    max-width: 550px;
    margin: 0.5rem auto 0;
}

.imagework-badge-local {
    background: #2c3e44;
    display: inline-block;
    margin-top: 12px;
    padding: 6px 14px;
    border-radius: 60px;
    font-size: 0.75rem;
    font-weight: 500;
    backdrop-filter: blur(4px);
}

/* 两列布局 */
.imagework-dashboard {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    /*padding: 32px 28px;*/
    background: #ffffffcc;
}

.imagework-panel {
    flex: 1;
    min-width: 280px;
    background: white;
    border-radius: 32px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
    padding: 24px 22px;
    transition: all 0.2s;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.imagework-panel-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
    border-left: 5px solid #ff8c1a;
    padding-left: 16px;
    color: #1f2d3d;
}

/* 上传区 */
.imagework-upload-area {
    border: 2px dashed #cbd5e1;
    border-radius: 28px;
    background: #fafcff;
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 24px;
}

.imagework-upload-area:hover {
    border-color: #ff8c1a;
    background: #fff7ed;
}

.imagework-upload-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.imagework-preview-box {
    background: #f8fafc;
    border-radius: 24px;
    padding: 20px;
    text-align: center;
    margin-top: 18px;
}

.imagework-preview-img {
    max-width: 100%;
    max-height: 220px;
    border-radius: 16px;
    object-fit: contain;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.1);
    background: #eef2f5;
}

.imagework-img-info {
    font-size: 0.8rem;
    color: #334155;
    margin-top: 12px;
    word-break: break-all;
}

/* 滑块与控件 */
.imagework-control-group {
    margin-bottom: 28px;
}

.imagework-slider-label {
    display: flex;
    justify-content: space-between;
    font-weight: 500;
    margin-bottom: 8px;
    color: #1e293b;
}

.imagework-format-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin: 20px 0 12px;
}

.imagework-format-btn {
    background: #f1f5f9;
    border: none;
    padding: 8px 16px;
    border-radius: 60px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.imagework-format-btn.active {
    background: #ff8c1a;
    color: white;
    box-shadow: 0 4px 8px rgba(255, 140, 26, 0.3);
}

.imagework-action-btn {
    background: #1e2a3e;
    color: white;
    border: none;
    width: 100%;
    padding: 14px 0;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.2s;
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.imagework-action-btn:hover {
    background: #1e2a3e;
    color: white;
}

.imagework-action-btn:active {
    transform: scale(0.97);
}

.imagework-action-btn.download {
    background: #2b5e3b;
}

.imagework-action-btn.download:hover {
    background: #1f4a2e;
}

.imagework-compression-stats {
    background: #eef2ff;
    border-radius: 20px;
    padding: 16px;
    margin-top: 20px;
    font-size: 0.85rem;
}

.imagework-stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    padding: 2px;
    -webkit-appearance: none;
    background: #e2e8f0;
    border-radius: 10px;
    outline: none;
}

input[type="range"]:focus {
    outline: none;
    border-color: #e2e8f0;
    box-shadow: 0 0 0 0 #e2e8f0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #ff8c1a;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    border: none;
}

.warning {
    color: #b45309;
    font-size: 0.75rem;
    margin-top: 10px;
    text-align: center;
}

footer {
    text-align: center;
    margin-top: 16px;
    padding: 18px;
    font-size: 0.75rem;
    color: #5b6e8c;
    border-top: 1px solid #e2edf2;
    background: #ffffffd9;
}

.nav-footer-icp {
    margin-top: 0.3rem;
    color: #4b5563;
}

.nav-footer-icp a {
    text-decoration: none;
    color: #4b5563;
}

.nav-footer-icp a:hover {
    text-decoration: none;
    color: #1e293b;
}

/* 响应式: 小屏幕时JSON内部左右布局改为上下 */
@media (max-width: 860px) {
    .json-split-layout {
        flex-direction: column;
    }

    .json-editor-section, .json-preview-section {
        width: 100%;
    }

    .result-area {
        min-height: 220px;
    }

    textarea {
        min-height: 220px;
    }
}

@media (max-width: 680px) {
    .app-container {
        flex-direction: column;
    }

    .nav-sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        padding: 0.8rem 1rem;
        backdrop-filter: blur(16px);
        border-right: none;
        border-bottom: 1px solid #ddd;
    }

    .logo-area {
        margin-bottom: 0;
        flex: 1;
    }

    .nav-menu {
        flex-direction: row;
        gap: 0.5rem;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .nav-item {
        padding: 0.5rem 0.9rem;
        font-size: 0.8rem;
    }

    .nav-footer {
        display: grid;
        flex-direction: column;
    }

    .main-content {
        padding: 1.2rem;
    }

    .card {
        padding: 1.2rem;
    }
}