/**
 * メニューABC分析ツール - 専用スタイル
 */

/* 入力モード選択 */
.options-section {
    align-items: center;
}

.abc-mode-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
}

.option-radio {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* メニュー入力セクション */
.abc-section {
    padding: 20px;
    border-bottom: 1px solid var(--color-border);
}

.abc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

/* テーブル共通 */
.abc-table-wrapper {
    overflow-x: auto;
    margin: 0 -20px;
    padding: 0 20px;
}

.abc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.abc-table thead {
    background: var(--color-bg);
}

.abc-table th {
    padding: 10px 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-muted);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

.abc-table td {
    padding: 8px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.abc-table tbody tr:last-child td {
    border-bottom: none;
}

/* 入力テーブルの最小幅 */
.abc-input-table {
    min-width: 560px;
}

/* 列幅（入力） */
.abc-col-name { width: 34%; }
.abc-col-qty { width: 14%; }
.abc-col-price { width: 16%; }
.abc-col-sales { width: 22%; }
.abc-col-margin { width: 16%; }
.abc-col-action { width: 40px; text-align: center; }

/* モードによる列の表示切替 */
.mode-is-sales .mode-qty {
    display: none;
}

.mode-is-qty .mode-sales {
    display: none;
}

/* 入力フィールド */
.abc-input {
    width: 100%;
    padding: 8px 10px;
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    transition: border-color 0.2s;
}

.abc-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.abc-input::placeholder {
    color: var(--color-text-muted);
}

.abc-input[type="number"] {
    text-align: right;
}

/* 削除ボタン */
.btn-delete {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-delete:hover {
    background: #fee;
    border-color: #f99;
    color: #c44;
}

.btn-delete svg {
    width: 14px;
    height: 14px;
}

/* 行追加ボタン */
.abc-add-row {
    padding-top: 16px;
}

.btn-add-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-primary);
    background: var(--color-bg);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-row:hover {
    background: var(--color-white);
    border-color: var(--color-primary);
}

.add-icon {
    font-size: 18px;
    line-height: 1;
}

/* サマリー */
.abc-summary {
    padding: 16px 20px;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    display: none;
}

.abc-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

.abc-summary-item {
    padding: 12px 16px;
    background: var(--color-white);
    border-radius: var(--radius);
    text-align: center;
}

.abc-summary-label {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.abc-summary-value {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--color-primary-dark);
}

/* ランク別件数 */
.abc-rank-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.rank-count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 20px;
    background: var(--color-white);
    border: 1px solid var(--color-border);
}

.rank-count strong {
    font-family: var(--font-display);
}

.rank-count-A { border-color: #2f855a; color: #2f855a; }
.rank-count-B { border-color: #b7791f; color: #b7791f; }
.rank-count-C { border-color: #9b9b9b; color: #777; }

/* 分析結果テーブル */
.abc-result-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    display: none;
}

.abc-result-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 12px;
}

.abc-result-table {
    min-width: 640px;
}

.abc-result-table th,
.abc-result-table td {
    text-align: right;
    white-space: nowrap;
}

.abc-result-table th.abc-rcol-rank,
.abc-result-table td.abc-rcol-rank,
.abc-result-table th.abc-rcol-name,
.abc-result-table td.abc-rcol-name {
    text-align: left;
}

.abc-result-table th.abc-rcol-rank2,
.abc-result-table td.abc-rcol-rank2 {
    text-align: center;
}

.abc-rcol-rank { width: 48px; }
.abc-rcol-rank2 { width: 64px; }

.abc-result-table td.abc-rcol-sales,
.abc-result-table td.abc-rcol-cumulative {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--color-text);
}

/* ランク行の左ボーダー */
.rank-row-A td:first-child { box-shadow: inset 4px 0 0 #38a169; }
.rank-row-B td:first-child { box-shadow: inset 4px 0 0 #d69e2e; }
.rank-row-C td:first-child { box-shadow: inset 4px 0 0 #cbd5e0; }

/* ランクバッジ */
.rank-badge {
    display: inline-block;
    width: 26px;
    height: 26px;
    line-height: 26px;
    text-align: center;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    color: var(--color-white);
    border-radius: 50%;
}

.rank-badge-A { background: #38a169; }
.rank-badge-B { background: #d69e2e; }
.rank-badge-C { background: #a0aec0; }

/* 参考テーブル（SEOカード内） */
.simulation-table-wrapper {
    overflow-x: auto;
}

.reference-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.reference-table th,
.reference-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.reference-table th {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-muted);
    background: var(--color-bg);
}

.reference-table tbody tr:last-child td {
    border-bottom: none;
}

.reference-table .recommend-value {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--color-primary-dark);
    white-space: nowrap;
}

/* レスポンシブ対応 */
@media (max-width: 600px) {
    .abc-section {
        padding: 16px;
    }

    .abc-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .abc-table-wrapper {
        margin: 0 -16px;
        padding: 0 16px;
    }

    .options-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .abc-summary-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .abc-summary-value {
        font-size: 16px;
    }

    .reference-table th,
    .reference-table td {
        padding: 10px 8px;
        font-size: 13px;
    }
}
