/**
 * メニュー原価計算ツール - 専用スタイル
 */

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

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

/* 食材テーブル */
.ingredient-table-wrapper {
    overflow-x: auto;
    margin: 0 -20px;
    padding: 0 20px;
}

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

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

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

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

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

/* テーブル列幅 */
.col-name { width: 22%; }
.col-amount { width: 12%; }
.col-unit { width: 10%; }
.col-unit-price { width: 14%; }
.col-unit-amount { width: 14%; }
.col-cost { width: 14%; text-align: right; }
.col-action { width: 40px; text-align: center; }

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

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

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

/* 数値入力は右寄せ */
.ingredient-input[type="number"] {
    text-align: right;
}

/* 単位セレクト */
.unit-select {
    width: 100%;
    padding: 8px 24px 8px 10px;
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 8px center;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    cursor: pointer;
    appearance: none;
}

.unit-select:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* 小計セル */
.cost-value {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--color-text);
    text-align: right;
    padding-right: 8px;
}

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

/* 食材追加行 */
.add-ingredient-row {
    padding-top: 16px;
}

.btn-add-ingredient {
    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-ingredient:hover {
    background: var(--color-white);
    border-color: var(--color-primary);
}

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

/* 原価合計セクション */
.count-section {
    padding: 24px 20px;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
}

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

/* オプション設定セクション */
.options-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.option-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--color-text);
}

.option-input {
    width: 60px;
    padding: 6px 8px;
    font-size: 14px;
    text-align: right;
    color: var(--color-text);
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: 4px;
}

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

.option-unit {
    color: var(--color-text-secondary);
}

.option-help {
    font-size: 12px;
    color: var(--color-text-muted);
}

/* 結果表示セクション */
.result-section {
    padding: 20px;
    border-bottom: 1px solid var(--color-border);
}

.result-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.result-row + .result-row {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.result-item {
    flex: 1;
    min-width: 200px;
    padding: 16px;
    background: var(--color-bg);
    border-radius: var(--radius);
}

.result-item-highlight {
    background: var(--color-primary);
}

.result-item-highlight .result-label {
    color: rgba(255, 255, 255, 0.85);
}

.result-item-highlight .result-value {
    color: var(--color-white);
}

.result-item-highlight .result-unit {
    color: rgba(255, 255, 255, 0.85);
}

.result-label {
    display: block;
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 6px;
}

.result-value-group {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.result-value {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1;
}

.result-value-large {
    font-size: 32px;
    color: var(--color-primary-dark);
}

.result-unit {
    font-size: 14px;
    color: var(--color-text-secondary);
}

/* シミュレーションテーブル */
.simulation-description {
    margin-bottom: 16px;
}

.simulation-table-wrapper {
    overflow-x: auto;
}

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

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

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

.simulation-table th:first-child,
.simulation-table td:first-child {
    text-align: left;
}

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

.simulation-table .highlight-row {
    background: rgba(61, 90, 128, 0.05);
}

.simulation-table .highlight-row td {
    font-weight: 500;
}

.rate-cell {
    font-weight: 500;
    color: var(--color-text);
}

.rate-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 700;
    color: var(--color-white);
    background: var(--color-primary);
    border-radius: 3px;
    vertical-align: middle;
}

.price-cell,
.price-tax-cell {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--color-primary-dark);
}

.profit-cell {
    color: var(--color-text-secondary);
}

/* 空状態 */
.empty-state {
    padding: 40px 20px;
    text-align: center;
}

.empty-message {
    font-size: 14px;
    color: var(--color-text-muted);
    margin-bottom: 16px;
}

/* レスポンシブ対応 */
@media (max-width: 600px) {
    .ingredient-section {
        padding: 16px;
    }
    
    .ingredient-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .ingredient-table-wrapper {
        margin: 0 -16px;
        padding: 0 16px;
    }
    
    .options-section {
        flex-direction: column;
        gap: 16px;
    }
    
    .option-group {
        flex-wrap: wrap;
    }
    
    .result-section {
        padding: 16px;
    }
    
    .result-item {
        min-width: 100%;
    }
    
    .result-value-large {
        font-size: 28px;
    }
    
    .count-section {
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .count-value {
        font-size: 40px;
    }
    
    .simulation-table th,
    .simulation-table td {
        padding: 10px 8px;
        font-size: 13px;
    }
    
    .rate-badge {
        display: none;
    }
}
