/* リセットとベーススタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
    min-height: 100vh;
}

/* コンテナ */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ヘッダー */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    width: 1400px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo i {
    font-size: 2rem;
    color: #ffd700;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.header-actions {
    display: flex;
    gap: 15px;
}

/* メインコンテンツ */
.main-content {
    display: grid;
    grid-template-columns: 1fr 450px;
    gap: 30px;
    align-items: start;
    width: 1400px;
}

/* カード */
.card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    margin-top: 20px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid #e1e8ed;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.card h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card h2 i {
    color: #667eea;
    width: 20px;
}

/* セクションヘッダー */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    margin-bottom: 0;
}

/* ボタン */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
}

.btn-secondary:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-1px);
}

/* フォーム */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #495057;
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* 材料項目 */
.ingredient-item {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    position: relative;
}

.ingredient-item:hover {
    border-color: #667eea;
    background: #f7f8ff;
}

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

.ingredient-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 1.1rem;
}

.ingredient-cost {
    font-weight: 600;
    color: #28a745;
    font-size: 1.1rem;
}

.ingredient-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    font-size: 0.85rem;
    color: #6c757d;
}

.ingredient-actions {
    display: flex;
    gap: 8px;
    margin-top: 15px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* サマリーカード */
.summary-card {
    position: sticky;
    top: 20px;
}

.cost-summary {
    margin-bottom: 10px;
}

.cost-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f1f3f4;
}

.cost-item:last-child {
    border-bottom: none;
}

.cost-item.total-cost {
    font-size: 1.1rem;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea, #764ba2);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    border-bottom: 2px solid #667eea;
    margin-bottom: 10px;
}

.cost-item.recommended-price {
    font-weight: 600;
    color: #28a745;
}

.cost-item.profit-margin {
    font-weight: 600;
    color: #17a2b8;
}

.cost-item .label {
    font-weight: 500;
}

.cost-item .value {
    font-weight: 600;
    font-size: 1.05rem;
}

/* チャートコンテナ */
.chart-container {
    margin: 25px 0;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

/* 材料別内訳 */
.ingredient-breakdown h3 {
    font-size: 1.1rem;
    color: #495057;
    margin-bottom: 15px;
    font-weight: 600;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f1f3f4;
}

.breakdown-item:last-child {
    border-bottom: none;
}

.breakdown-name {
    font-weight: 500;
    color: #495057;
}

.breakdown-cost {
    font-weight: 600;
    color: #28a745;
}

.breakdown-percentage {
    font-size: 0.85rem;
    color: #6c757d;
    margin-left: 8px;
}

/* 利益分析 */
.analysis-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.metric {
    text-align: center;
    padding: 15px 10px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 10px;
    border: 1px solid #dee2e6;
}

.metric-label {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 5px;
    font-weight: 500;
}

.metric-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
}

/* 提案 */
.recommendations h3 {
    font-size: 1.1rem;
    color: #495057;
    margin-bottom: 15px;
    font-weight: 600;
}

.recommendation-item {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: #856404;
}

.recommendation-item i {
    margin-right: 8px;
    color: #f39c12;
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60px);
    }
    to {
        opacity: 1;
        transform: translate(0, 0);
    }
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e1e8ed;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2c3e50;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: #f8f9fa;
    color: #495057;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e1e8ed;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

/* 価格設定 */
.pricing-settings .form-row {
    margin-bottom: 15px;
}

/* レスポンシブデザイン */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr 400px;
        gap: 25px;
    }
}

@media (max-width: 992px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .right-panel {
        order: -1;
    }
    
    .summary-card {
        position: static;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header {
        padding: 20px;
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header-actions {
        width: 100%;
        justify-content: center;
    }
    
    .card {
        padding: 20px;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .ingredient-details {
        grid-template-columns: 1fr;
    }
    
    .analysis-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
}

@media (max-width: 480px) {
    .ingredient-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .ingredient-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .analysis-metrics {
        grid-template-columns: 1fr;
    }
    
    .cost-item {
        font-size: 0.9rem;
    }
}