/* SanWebCorner JSON Formatter */

.swc-json-tool {
    --swc-bg: #ffffff;
    --swc-bg-soft: #f7f8fa;
    --swc-border: #dfe3e8;
    --swc-text: #171717;
    --swc-muted: #667085;
    --swc-primary: #111111;
    --swc-primary-hover: #2d2d2d;
    --swc-radius: 12px;

    width: 100%;
    max-width: 1400px;
    margin: 30px auto;
    padding: 0;
    color: var(--swc-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    box-sizing: border-box;
}

.swc-json-tool *,
.swc-json-tool *::before,
.swc-json-tool *::after {
    box-sizing: border-box;
}

.swc-tool-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.swc-tool-title {
    margin: 0 0 8px;
    font-size: clamp(28px, 3vw, 38px);
    line-height: 1.15;
    font-weight: 700;
    color: var(--swc-text);
}

.swc-tool-description {
    max-width: 720px;
    margin: 0;
    font-size: 16px;
    line-height: 1.7;
    color: var(--swc-muted);
}

.swc-privacy-badge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 13px;
    background: #eef8f1;
    border: 1px solid #cce8d4;
    border-radius: 999px;
    color: #166534;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}

.swc-json-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
}

.swc-editor-panel {
    min-width: 0;
    overflow: hidden;
    background: var(--swc-bg);
    border: 1px solid var(--swc-border);
    border-radius: var(--swc-radius);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.swc-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    min-height: 48px;
    padding: 11px 15px;
    background: var(--swc-bg-soft);
    border-bottom: 1px solid var(--swc-border);
}

.swc-editor-title {
    color: var(--swc-text);
    font-size: 14px;
    font-weight: 700;
}

.swc-editor-stats {
    color: var(--swc-muted);
    font-size: 12px;
    line-height: 1.4;
    text-align: right;
}

.swc-json-input,
.swc-json-output {
    display: block;
    width: 100%;
    min-height: 450px;
    margin: 0;
    padding: 18px;
    overflow: auto;
    background: #ffffff;
    color: #1b1b1b;
    border: 0;
    border-radius: 0;
    outline: none;
    resize: vertical;
    box-shadow: none;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Monaco, monospace;
    font-size: 14px;
    line-height: 1.65;
    tab-size: 2;
    white-space: pre;
}

.swc-json-output {
    background: #fbfbfc;
}

.swc-json-input::placeholder,
.swc-json-output::placeholder {
    color: #9aa1aa;
}

.swc-json-input:focus {
    box-shadow: inset 0 0 0 2px rgba(17, 17, 17, 0.12);
}

.swc-json-status {
    display: none;
    margin-top: 15px;
    padding: 12px 15px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
}

.swc-json-status:not(:empty) {
    display: block;
}

.swc-json-status.is-success {
    background: #edf8f1;
    border: 1px solid #cfe9d7;
    color: #166534;
}

.swc-json-status.is-error {
    background: #fff1f1;
    border: 1px solid #f4cccc;
    color: #a71919;
}

.swc-json-status.is-info {
    background: #eef5ff;
    border: 1px solid #d5e4f8;
    color: #245b91;
}

.swc-tool-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.swc-button {
    appearance: none;
    min-height: 42px;
    padding: 10px 17px;
    background: #ffffff;
    color: #111111;
    border: 1px solid #cfd4da;
    border-radius: 7px;
    box-shadow: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.swc-button:hover {
    background: #f6f6f6;
    border-color: #999999;
    transform: translateY(-1px);
}

.swc-button:active {
    transform: translateY(0);
}

.swc-button:focus-visible {
    outline: 3px solid rgba(17, 17, 17, 0.2);
    outline-offset: 2px;
}

.swc-button-primary {
    background: var(--swc-primary);
    color: #ffffff;
    border-color: var(--swc-primary);
}

.swc-button-primary:hover {
    background: var(--swc-primary-hover);
    color: #ffffff;
    border-color: var(--swc-primary-hover);
}

.swc-button-secondary {
    background: #ffffff;
}

.swc-tool-help {
    margin-top: 17px;
    color: var(--swc-muted);
    font-size: 13px;
    line-height: 1.6;
}

.swc-tool-help > span {
    color: var(--swc-text);
    font-weight: 700;
}

.swc-tool-help kbd {
    display: inline-block;
    min-width: 24px;
    padding: 2px 6px;
    background: #f5f5f5;
    color: #333333;
    border: 1px solid #d5d5d5;
    border-bottom-width: 2px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
}

@media (max-width: 900px) {
    .swc-tool-header {
        flex-direction: column;
    }

    .swc-privacy-badge {
        align-self: flex-start;
    }
}

@media (max-width: 768px) {
    .swc-json-tool {
        margin: 20px auto;
    }

    .swc-json-workspace {
        grid-template-columns: 1fr;
    }

    .swc-json-input,
    .swc-json-output {
        min-height: 320px;
    }

    .swc-button {
        flex: 1 1 calc(50% - 10px);
    }
}

@media (max-width: 480px) {
    .swc-tool-title {
        font-size: 27px;
    }

    .swc-editor-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .swc-editor-stats {
        text-align: left;
    }

    .swc-button {
        flex-basis: 100%;
        width: 100%;
    }

    .swc-json-input,
    .swc-json-output {
        min-height: 280px;
        font-size: 13px;
    }
}
