/**
 * 歩留まり計算ツール - 専用スタイル
 */

/* 食材入力セクション */
.yld-section {
    padding: 20px;
    border-bottom: 1px solid var(--color-border);
}

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

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

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

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

.yld-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;
}

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

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

/* 入力テーブルの最小幅 */
.yld-table:not(.yld-result-table) {
    min-width: 620px;
}

/* 列幅（入力） */
.yld-col-name { width: 26%; }
.yld-col-buy { width: 17%; }
.yld-col-net { width: 16%; }
.yld-col-price { width: 17%; }
.yld-col-portion { width: 14%; }
.yld-col-action { width: 40px; text-align: center; }

/* 入力フィールド */
.yld-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;
}

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

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

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

/* 注記 */
.yld-note {
    margin-top: 12px;
    font-size: 12px;
}

/* 削除ボタン */
.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;
}

/* 行追加ボタン */
.yld-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;
}

/* 結果テーブルセクション */
.yld-result-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    display: none;
}

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

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

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

.yld-result-table td.yld-rcol-netprice,
.yld-result-table td.yld-rcol-portion {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--color-text);
}

.yld-rate-value {
    display: inline-block;
    padding: 2px 10px;
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--color-primary-dark);
    background: rgba(61, 90, 128, 0.08);
    border-radius: 12px;
}

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

.yld-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

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

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

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

.yld-summary-help {
    margin-top: 12px;
    font-size: 12px;
}

.yld-summary-help:empty {
    margin-top: 0;
}

/* 参考テーブル（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) {
    .yld-section {
        padding: 16px;
    }

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

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

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

    .yld-summary-value {
        font-size: 18px;
    }

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