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

body {
    font-family: 'Noto Sans JP', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* ヘッダー */
.header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

.header-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* タブナビゲーション */
.tab-navigation {
    display: flex;
    background: #f8f9fa;
    border-bottom: 3px solid #e9ecef;
    overflow-x: auto;
}

.tab-button {
    flex: 1;
    padding: 20px 30px;
    border: none;
    background: transparent;
    color: #6c757d;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    white-space: nowrap;
}

.tab-button:hover {
    background: #e9ecef;
    color: #495057;
}

.tab-button.active {
    background: white;
    color: #2a5298;
    border-bottom: 3px solid #2a5298;
    margin-bottom: -3px;
}

.tab-button i {
    font-size: 1.2rem;
}

/* タブコンテンツ */
.tab-content {
    display: none;
    padding: 40px;
}

.tab-content.active {
    display: block;
}

.content-grid {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 30px;
}

/* 入力パネル */
.input-panel {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    height: fit-content;
    position: sticky;
    top: 20px;
}

.input-panel h2 {
    color: #2a5298;
    font-size: 1.5rem;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-section {
    margin-bottom: 30px;
}

.input-section h3 {
    font-size: 1.1rem;
    color: #495057;
    margin-bottom: 15px;
    font-weight: 600;
}

.input-group {
    margin-bottom: 20px;
}

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

.input-group input[type="number"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-group input[type="number"]:focus {
    outline: none;
    border-color: #2a5298;
    box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.1);
}

/* ラジオボタンとチェックボックス */
.radio-group,
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-label,
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 12px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.radio-label:hover,
.checkbox-label:hover {
    background: #e9ecef;
}

.radio-label input[type="radio"],
.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.radio-label span,
.checkbox-label span {
    font-size: 0.95rem;
    color: #495057;
}

/* ボタン */
.btn-primary {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-primary:active {
    transform: translateY(0);
}

/* 結果パネル */
.result-panel {
    background: white;
}

.result-panel h2 {
    color: #2a5298;
    font-size: 1.5rem;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.result-panel h3 {
    color: #495057;
    font-size: 1.2rem;
    margin: 30px 0 15px;
}

/* サマリーカード */
.result-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    border: 2px solid #dee2e6;
}

.summary-label {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 10px;
    font-weight: 500;
}

.summary-value {
    font-size: 1.8rem;
    color: #2a5298;
    font-weight: 700;
}

/* チャートコンテナ */
.chart-container {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 12px;
    margin: 30px 0;
    height: 500px;
}

.chart-container canvas {
    max-height: 100%;
}

/* テーブル */
.result-table-container {
    margin-top: 30px;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.9rem;
}

.result-table thead {
    background: linear-gradient(135deg, #2a5298 0%, #1e3c72 100%);
    color: white;
}

.result-table th {
    padding: 15px;
    text-align: right;
    font-weight: 600;
    white-space: nowrap;
}

.result-table th:first-child {
    text-align: center;
}

.result-table tbody tr {
    border-bottom: 1px solid #e9ecef;
    transition: background 0.2s ease;
}

.result-table tbody tr:hover {
    background: #f8f9fa;
}

.result-table td {
    padding: 12px 15px;
    text-align: right;
}

.result-table td:first-child,
.result-table td:nth-child(2) {
    text-align: center;
    font-weight: 600;
}

.result-table .negative {
    color: #dc3545;
}

.result-table .positive {
    color: #28a745;
}

/* 逆算結果 */
.reverse-result {
    margin-bottom: 30px;
}

.big-result-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    color: white;
    margin-bottom: 25px;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.big-result-label {
    font-size: 1.2rem;
    margin-bottom: 15px;
    opacity: 0.9;
}

.big-result-value {
    font-size: 3rem;
    font-weight: 700;
}

.result-details {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #2a5298;
}

.detail-label {
    font-weight: 500;
    color: #6c757d;
}

.detail-value {
    font-weight: 600;
    color: #2a5298;
}

/* 比較サマリー */
.comparison-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.comparison-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 25px;
    border-radius: 12px;
    border: 2px solid #dee2e6;
}

.comparison-card h4 {
    color: #2a5298;
    font-size: 1.2rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.comparison-card .metric {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #dee2e6;
}

.comparison-card .metric:last-child {
    border-bottom: none;
}

.comparison-card .metric-label {
    font-size: 0.9rem;
    color: #6c757d;
}

.comparison-card .metric-value {
    font-weight: 600;
    color: #495057;
}

/* 説明カード */
.comparison-explanation {
    margin-top: 30px;
    background: #f8f9fa;
    padding: 30px;
    border-radius: 12px;
}

.comparison-explanation h3 {
    color: #2a5298;
    margin-bottom: 20px;
}

.explanation-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    border-left: 4px solid #667eea;
}

.explanation-card h4 {
    color: #495057;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.explanation-card p {
    color: #6c757d;
    line-height: 1.6;
    font-size: 0.95rem;
}

/* フッター */
.footer {
    background: #1e3c72;
    color: white;
    text-align: center;
    padding: 30px;
}

.footer p {
    margin: 5px 0;
}

.disclaimer {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-top: 10px;
}

/* ユーティリティクラス */
.hidden {
    display: none !important;
}

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

@media (max-width: 992px) {
    .content-grid {
        grid-template-columns: 1fr;
    }

    .input-panel {
        position: static;
    }

    .header-content h1 {
        font-size: 2rem;
    }

    .chart-container {
        height: 400px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        border-radius: 15px;
    }

    .header {
        padding: 25px;
    }

    .header-content h1 {
        font-size: 1.5rem;
        flex-direction: column;
        gap: 10px;
    }

    .subtitle {
        font-size: 1rem;
    }

    .tab-button {
        padding: 15px 20px;
        font-size: 0.9rem;
    }

    .tab-button i {
        font-size: 1rem;
    }

    .tab-content {
        padding: 20px;
    }

    .input-panel,
    .result-panel {
        padding: 20px;
    }

    .result-summary {
        grid-template-columns: 1fr;
    }

    .chart-container {
        height: 300px;
        padding: 15px;
    }

    .big-result-value {
        font-size: 2rem;
    }

    .result-details {
        grid-template-columns: 1fr;
    }

    .comparison-summary {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .header-content h1 {
        font-size: 1.3rem;
    }

    .tab-button {
        padding: 12px 15px;
        font-size: 0.85rem;
    }

    .tab-button span {
        display: none;
    }

    .tab-button i {
        margin: 0;
    }

    .result-table {
        font-size: 0.8rem;
    }

    .result-table th,
    .result-table td {
        padding: 8px 5px;
    }
}
