/* static/css/json_formatter.css
   JSON整形ツール専用の独自CSS(他ツールのCSSは読み込まない・共有しない)。
   見た目の方向性は static/css/cost_calc.css(cost_calc)の値を参考に、
   このファイル内に直接書き起こしている。 */

/* パンくず(bombの static/css/tool.css の .breadcrumbs と同じ値。
   tool.css自体は .container(白カード・幅70%)を含み本ページのレイアウトと
   衝突するため丸ごとは読み込まず、パンくず部分だけ値を合わせている) */
.breadcrumbs {
    margin: 1rem 0 1.25rem;
    font-size: .875rem;
    text-align: left;
}
.breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    gap: .375rem;
    list-style: none;
    padding: 0;
    margin: 0;
}
.breadcrumbs li {
    display: flex;
    align-items: center;
}
.breadcrumbs li:not(:last-child)::after {
    content: ">";
    margin-left: .375rem;
    color: #666;
}
.breadcrumbs a {
    color: #0066cc;
    text-decoration: none;
}
.breadcrumbs a:hover {
    text-decoration: underline;
}
.breadcrumbs span[aria-current="page"] {
    color: #333;
    font-weight: 600;
}

/* ページ全体: 本文幅48rem固定・縦積み(appbomb/tools配下の他ツールと同じ流儀) */
.jf-page {
    max-width: 48rem;
    margin: 0 auto;
    padding: 0 1rem 2.5rem;
    box-sizing: border-box;
    background: #f6f8fb;
    font-family: 'M PLUS 1p', 'Sawarabi Gothic', sans-serif;
    line-height: 1.7;
    color: #1f2a44;
}
.jf-page h1 {
    font-size: 2rem;
    line-height: 1.3;
    margin: 1.5rem 0 0.6rem;
    color: #111827;
}
.jf-page section {
    margin: 2rem 0 0;
}
.jf-page section > p {
    margin: 0 0 0.9rem;
    color: #4b5563;
}
.jf-page h2 {
    font-size: 1.15rem;
    margin: 0 0 0.9rem;
    color: #222222;
}
.jf-lead {
    color: #4b5563;
    font-size: 1rem;
    margin: 0 0 1.5rem;
}

/* ===== ツール本体を1枚のカードに ===== */
.json-tool-panel {
    margin: 1.25rem 0 1.75rem;
    background: #ffffff;
    border-radius: 1.25rem;
    padding: 1.25rem 1.25rem 1.5rem;
    box-shadow: 0 0.125rem 0.5rem rgba(15, 23, 42, 0.08);
}

/* タブ(セグメントコントロール) */
.jf-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 0.0625rem solid #edf2f7;
}
.jf-tab {
    font: inherit;
    font-size: 0.875rem;
    font-weight: 700;
    padding: 0.55rem 1rem;
    border: 0.0625rem solid #d6deeb;
    border-radius: 999px;
    background: #fbfdff;
    color: #4b5563;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.jf-tab:hover {
    border-color: #9eb8ef;
    color: #2f6ae6;
    transform: translateY(-0.0625rem);
}
.jf-tab.is-active {
    background: #2f6ae6;
    border-color: #2f6ae6;
    color: #fff;
    box-shadow: 0 0.25rem 0.75rem rgba(47, 106, 230, 0.25);
}
.jf-tab.is-active:hover {
    transform: none;
}

/* 入力・出力は縦積み */
.jf-field {
    margin-bottom: 1rem;
}
.jf-field label {
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    color: #374151;
    margin-bottom: 0.4rem;
}
.jf-textarea {
    width: 100%;
    box-sizing: border-box;
    font-family: Consolas, Menlo, monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    padding: 0.75rem 0.9375rem;
    border: 0.0625rem solid #d6deeb;
    border-radius: 0.75rem;
    background: #ffffff;
    color: #1f2a44;
    resize: vertical;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.jf-textarea:focus {
    outline: none;
    border-color: #9eb8ef;
    box-shadow: 0 0 0 0.1875rem rgba(47, 106, 230, 0.18);
}
.jf-textarea--output {
    background: #f8fbff;
    color: #1f2a44;
}

.jf-option-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem 1.5rem;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    background: #fbfdff;
    border: 0.0625rem solid #dbe4f0;
    border-radius: 0.875rem;
}
.jf-option {
    display: flex;
    flex-direction: column;
    font-size: 0.8125rem;
    font-weight: 700;
    color: #374151;
    gap: 0.35rem;
}
.jf-option select {
    font: inherit;
    font-weight: 400;
    padding: 0.5rem 0.7rem;
    border: 0.0625rem solid #d6deeb;
    border-radius: 0.5rem;
    background: #fff;
    color: #1f2a44;
}
.jf-option select:focus {
    outline: none;
    border-color: #9eb8ef;
    box-shadow: 0 0 0 0.1875rem rgba(47, 106, 230, 0.18);
}
.jf-option--checkbox {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
}
.jf-option--checkbox input {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: #2f6ae6;
}

.jf-hint {
    color: #64748b;
    font-size: 0.8125rem;
    margin: 0 0 1rem;
}

.jf-error {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    color: #b42318;
    background: #fffafa;
    border: 0.0625rem solid #f1c0c0;
    border-radius: 0.75rem;
    padding: 0.75rem 0.9375rem;
    font-size: 0.875rem;
    margin: 0 0 1rem;
}
.jf-error::before {
    content: "⚠";
    flex: 0 0 auto;
}
.jf-error:empty {
    display: none;
}

.jf-output-wrap {
    position: relative;
}
.jf-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 700;
    padding: 0.45rem 0.9rem;
    margin-top: 0.6rem;
    border: 0.0625rem solid #2f6ae6;
    border-radius: 0.5rem;
    background: #ffffff;
    color: #2f6ae6;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.jf-copy-btn:hover {
    background: #eef4ff;
    transform: translateY(-0.0625rem);
}
.jf-copy-btn.is-copied {
    background: #2f6ae6;
    border-color: #2f6ae6;
    color: #fff;
}

/* diff出力 */
.jf-diff-output {
    width: 100%;
    box-sizing: border-box;
    font-family: Consolas, Menlo, monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    padding: 0.75rem 0.9375rem;
    border: 0.0625rem solid #d6deeb;
    border-radius: 0.75rem;
    background: #f8fbff;
    min-height: 3rem;
    white-space: pre-wrap;
    word-break: break-all;
}
.jf-diff-row {
    padding: 0.2rem 0.5rem;
    border-radius: 0.4rem;
    margin-bottom: 0.15rem;
}
.jf-diff-row--added { background: #dcfce7; color: #166534; }
.jf-diff-row--removed { background: #fee2e2; color: #991b1b; }
.jf-diff-row--changed { background: #fef9c3; color: #854d0e; }
.jf-diff-empty { color: #64748b; }

/* ===== ほかの機能・関連コラムのカード ===== */
.jf-other-tools {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: 0.75rem;
}
.jf-other-tools__card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem 1.1rem;
    border-radius: 1rem;
    background: #ffffff;
    box-shadow: 0 0.125rem 0.5rem rgba(15, 23, 42, 0.08);
    text-decoration: none;
    color: #222222;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.jf-other-tools__card:hover,
.jf-other-tools__card:focus-visible {
    transform: translateY(-0.0938rem);
    box-shadow: 0 0.3125rem 1rem rgba(47, 106, 230, 0.16);
    outline: none;
}
.jf-other-tools__title {
    font-weight: 700;
    font-size: 0.9375rem;
    line-height: 1.5;
}
.jf-other-tools__more {
    /* タイトルの行数がカードごとに違っても、リンクは常にカード下端に揃える */
    margin-top: auto;
    padding-top: 0.5rem;
    color: #2f6ae6;
    font-size: 0.8125rem;
    font-weight: 700;
}

@media (max-width: 36rem) {
    .jf-page h1 {
        font-size: 1.5rem;
    }
    .json-tool-panel {
        padding: 1rem 0.9rem 1.25rem;
        border-radius: 1rem;
    }
    .jf-tabs {
        gap: 0.3rem;
    }
    .jf-tab {
        padding: 0.45rem 0.75rem;
        font-size: 0.8125rem;
    }
}

/* よくある質問 */
.jf-faq dt {
    font-weight: bold;
    margin-top: 0.8rem;
}
.jf-faq dd {
    margin: 0.2rem 0 0;
    color: #444;
}
