* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f7fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content > div {
    text-align: center;
    flex: 1;
}

.lang-toggle {
    background: #ecf0f1;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.3s;
}

.lang-toggle:hover {
    background: #bdc3c7;
}

header h1 {
    color: #2c3e50;
    margin-bottom: 10px;
}

header p {
    color: #7f8c8d;
}

.input-section, .results-section, .api-key-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

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

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #34495e;
}

input[type="text"],
input[type="number"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

input[type="file"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus,
input[type="file"]:focus {
    outline: none;
    border-color: #3498db;
}

small {
    display: block;
    margin-top: 5px;
    color: #7f8c8d;
    font-size: 13px;
}

textarea {
    resize: none;
}

.submit-btn, #saveApiKey {
    background: #3498db;
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.submit-btn:hover, #saveApiKey:hover {
    background: #2980b9;
}

.submit-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

.results-section h2 {
    color: #2c3e50;
    margin-bottom: 20px;
}

/* ICF分類表スタイル */
.icf-classification-table {
    margin-top: 20px;
}

.icf-table-title {
    text-align: center;
    color: #2c3e50;
    font-size: 24px;
    margin-bottom: 30px;
    font-weight: 700;
    border-bottom: 3px solid #3498db;
    padding-bottom: 10px;
}

.icf-section {
    background: #ffffff;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.icf-section-title {
    background: #34495e;
    color: white;
    padding: 15px 20px;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.icf-section-content {
    padding: 20px;
}

.icf-item {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.icf-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.icf-item strong {
    color: #2c3e50;
    margin-right: 8px;
    display: inline-block;
    min-width: 120px;
}

.icf-item ul {
    margin: 10px 0 10px 140px;
    padding-left: 20px;
}

.icf-item ul li {
    margin: 8px 0;
    list-style-type: disc;
    line-height: 1.6;
}

.icf-item.no-data {
    color: #95a5a6;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* セクションごとの色分け */
.icf-section:nth-child(2) .icf-section-title { background: #2c3e50; } /* 健康状態 */
.icf-section:nth-child(3) .icf-section-title { background: #e74c3c; } /* 心身機能・身体構造 */
.icf-section:nth-child(4) .icf-section-title { background: #3498db; } /* 活動 */
.icf-section:nth-child(5) .icf-section-title { background: #2ecc71; } /* 参加 */
.icf-section:nth-child(6) .icf-section-title { background: #f39c12; } /* 環境因子 */
.icf-section:nth-child(7) .icf-section-title { background: #9b59b6; } /* 個人因子 */

/* プライバシー通知 */
.privacy-notice {
    background: #e8f4fd;
    border: 1px solid #bee5ff;
    border-radius: 4px;
    padding: 10px;
    margin-top: 10px;
    color: #0c5460;
}

.privacy-notice svg {
    color: #0c5460;
}

/* 主要機能とオプション機能のスタイル */
.primary-feature {
    background: #f0f7ff;
    border: 2px solid #3498db;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.primary-feature h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 600;
}

.optional-feature {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.optional-feature h3 {
    color: #6c757d;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    padding-left: 25px;
}

.optional-feature h3::before {
    content: '▼';
    position: absolute;
    left: 0;
    transition: transform 0.3s;
}

.optional-feature.collapsed h3::before {
    transform: rotate(-90deg);
}

.collapsible-content {
    transition: max-height 0.3s ease;
    overflow: hidden;
}

.optional-feature.collapsed .collapsible-content {
    max-height: 0;
}

/* アップロードエリアのスタイル */
.upload-area {
    position: relative;
    border: 2px dashed #3498db;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    background: #f8fcff;
    transition: all 0.3s;
}

.upload-area:hover {
    background: #e8f4fd;
    border-color: #2980b9;
}

.upload-area input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-prompt {
    pointer-events: none;
}

.upload-prompt svg {
    color: #3498db;
    margin-bottom: 10px;
}

.upload-prompt p {
    color: #34495e;
    font-size: 16px;
    margin: 0;
}

.upload-area.dragover {
    background: #e8f4fd;
    border-color: #2980b9;
}

/* ファイル選択時の表示 */
.file-selected {
    background: #d4edda;
    border-color: #28a745;
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
}

.loading {
    text-align: center;
    padding: 40px;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    background: #fee;
    color: #e74c3c;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.api-key-section {
    background: #f8f9fa;
    border: 1px dashed #bdc3c7;
}

.api-key-section h3 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.api-key-section .form-group {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.api-key-section input {
    flex: 1;
}

.api-key-section button {
    white-space: nowrap;
}

/* 広告コンテナ */
.ad-container {
    text-align: center;
    margin: 20px auto;
    background: #f9f9f9;
    padding: 10px;
    border-radius: 5px;
}

.ad-horizontal {
    max-width: 728px;
    min-height: 90px;
}

.ad-footer {
    margin-top: 40px;
    max-width: 970px;
    min-height: 90px;
}

/* 広告のプレースホルダー（AdSense承認前） */
/* コメントアウト - 実際の広告を表示するため
.ad-container::before {
    content: "広告スペース";
    color: #999;
    font-size: 14px;
    display: block;
    padding: 20px;
}
*/

.adsbygoogle {
    background: transparent;
}

/* フッター */
.site-footer {
    text-align: center;
    padding: 30px 20px;
    color: #7f8c8d;
    font-size: 14px;
}

.site-footer a {
    color: #3498db;
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

.site-footer .separator {
    margin: 0 15px;
    color: #bdc3c7;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .input-section, .results-section, .api-key-section {
        padding: 20px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .header-content > div {
        margin-bottom: 10px;
    }
    
    .lang-toggle {
        width: 100%;
        max-width: 200px;
    }
    
    .api-key-section .form-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .api-key-section button {
        width: 100%;
    }
    
    .ad-horizontal {
        max-width: 100%;
        min-height: 60px;
    }
    
    .ad-footer {
        max-width: 100%;
        min-height: 100px;
    }
    
    /* ICF分類表のモバイル対応 */
    .icf-table-title {
        font-size: 20px;
    }
    
    .icf-section-title {
        font-size: 16px;
        padding: 12px 15px;
    }
    
    .icf-section-content {
        padding: 15px;
    }
    
    .icf-item strong {
        display: block;
        min-width: auto;
        margin-bottom: 5px;
    }
    
    .icf-item ul {
        margin-left: 20px;
    }
    
    /* アップロードエリアのモバイル対応 */
    .upload-area {
        padding: 20px;
    }
    
    .upload-prompt svg {
        width: 36px;
        height: 36px;
    }
    
    .upload-prompt p {
        font-size: 14px;
    }
    
    .primary-feature, .optional-feature {
        padding: 15px;
    }
    
    .primary-feature h3 {
        font-size: 18px;
    }
    
    .optional-feature h3 {
        font-size: 16px;
    }
}