/* ========================================
   歯科医院WEB問診システム - スタイルシート
   ======================================== */

/* ========================================
   1. リセット & 基本設定
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", 
                 "Hiragino Sans", Meiryo, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f8fa;
    min-height: 100vh;
}

/* ========================================
   2. レイアウト
   ======================================== */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background-color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    min-height: 100vh;
}

/* ========================================
   3. ヘッダー・ロゴエリア
   ======================================== */
.logo-area {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: -20px -20px 30px -20px;
    border-radius: 0 0 16px 16px;
}

.logo-area img {
    max-width: 280px;
    height: auto;
    display: block;
    margin: 0 auto 15px;
}

.logo-area h1 {
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ========================================
   4. セクション
   ======================================== */
.section {
    margin-bottom: 40px;
    padding: 25px;
    background-color: #fafbfc;
    border-radius: 12px;
    border: 1px solid #e1e8ed;
}

.section-title {
    font-size: 1.3rem;
    color: #667eea;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
    font-weight: 600;
}

/* ========================================
   5. 質問アイテム
   ======================================== */
.question-item {
    margin-bottom: 25px;
    padding: 20px;
    background-color: #ffffff;
    border-radius: 8px;
    border: 1px solid #e1e8ed;
    transition: box-shadow 0.2s ease;
}

.question-item:hover {
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.question-label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 12px;
    font-size: 1rem;
}

/* 必須マーク（改善版） */
.required {
    color: #e74c3c;
    font-weight: bold;
    background-color: #ffe6e6;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    font-size: 0.85em;
    white-space: nowrap;
    display: inline-block;
}

/* ========================================
   6. フォーム要素 - テキスト入力
   ======================================== */
.form-control {
    width: 100%;
    padding: 12px 15px;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    border: 2px solid #ced4da;
    border-radius: 6px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

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

.form-control::placeholder {
    color: #adb5bd;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* ========================================
   7. フォーム要素 - セレクトボックス
   ======================================== */
select.form-control {
    appearance: none;
    background-image: 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='%23667eea' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 35px;
    cursor: pointer;
}

/* ========================================
   8. フォーム要素 - ラジオボタン
   ======================================== */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background-color: #f8f9fa;
    border: 2px solid #e1e8ed;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
}

.radio-item:hover {
    background-color: #e9ecef;
    border-color: #667eea;
}

.radio-item input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
    flex-shrink: 0;
}

.radio-item label {
    cursor: pointer;
    flex-grow: 1;
    user-select: none;
}

.radio-item input[type="radio"]:checked + label {
    font-weight: 600;
    color: #667eea;
}

/* ========================================
   9. フォーム要素 - チェックボックス
   ======================================== */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background-color: #f8f9fa;
    border: 2px solid #e1e8ed;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
}

.checkbox-item:hover {
    background-color: #e9ecef;
    border-color: #667eea;
}

.checkbox-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-item label {
    cursor: pointer;
    flex-grow: 1;
    user-select: none;
}

.checkbox-item input[type="checkbox"]:checked + label {
    font-weight: 600;
    color: #667eea;
}

/* ========================================
   10. 画像アップロード
   ======================================== */
.image-upload {
    margin-top: 10px;
}

.image-upload-label {
    display: block;
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 8px;
}

.image-upload input[type="file"] {
    display: block;
    width: 100%;
    padding: 10px;
    font-size: 0.95rem;
    border: 2px dashed #ced4da;
    border-radius: 6px;
    background-color: #f8f9fa;
    cursor: pointer;
    transition: all 0.2s ease;
}

.image-upload input[type="file"]:hover {
    border-color: #667eea;
    background-color: #e9ecef;
}

.image-preview {
    margin-top: 10px;
    max-width: 200px;
    display: none;
}

.image-preview img {
    width: 100%;
    height: auto;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.image-preview.show {
    display: block;
}

/* ========================================
   11. 条件分岐質問（アニメーション）
   ======================================== */
.conditional-question {
    display: none;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, max-height 0.3s ease;
}

.conditional-question.show {
    display: block;
    opacity: 1;
    max-height: 500px;
}

/* ========================================
   12. 送信ボタン
   ======================================== */
.submit-area {
    margin-top: 40px;
    text-align: center;
    padding: 30px 20px;
}

.btn-submit {
    display: inline-block;
    padding: 16px 60px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    min-width: 200px;
}

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

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

.btn-submit:disabled {
    background: #adb5bd;
    cursor: not-allowed;
    box-shadow: none;
}

/* ========================================
   13. エラーメッセージ
   ======================================== */
.error-message {
    display: none;
    color: #e74c3c;
    font-size: 0.9rem;
    margin-top: 8px;
    padding: 8px 12px;
    background-color: #fee;
    border-left: 3px solid #e74c3c;
    border-radius: 4px;
}

.error-message.show {
    display: block;
}

.question-item.error .form-control {
    border-color: #e74c3c;
}

/* ========================================
   14. 完了画面
   ======================================== */
.completion-message {
    text-align: center;
    padding: 60px 20px;
}

.completion-message h2 {
    color: #27ae60;
    font-size: 2rem;
    margin-bottom: 20px;
}

.completion-message p {
    font-size: 1.1rem;
    color: #555;
    line-height: 1.8;
}

/* ========================================
   15. レスポンシブ - タブレット
   ======================================== */
@media (min-width: 768px) {
    .container {
        padding: 30px;
    }

    .logo-area {
        padding: 40px 30px;
        margin: -30px -30px 40px -30px;
    }

    .logo-area img {
        max-width: 320px;
    }

    .logo-area h1 {
        font-size: 1.8rem;
    }

    .section {
        padding: 30px;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .question-item {
        padding: 25px;
    }

    .radio-group,
    .checkbox-group {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 15px;
    }

    .radio-item,
    .checkbox-item {
        flex: 0 1 calc(50% - 8px);
    }
}

/* ========================================
   16. レスポンシブ - PC
   ======================================== */
@media (min-width: 1024px) {
    .container {
        padding: 40px;
        margin-top: 20px;
        margin-bottom: 20px;
        border-radius: 16px;
    }

    .logo-area {
        padding: 50px 40px;
        margin: -40px -40px 50px -40px;
    }

    .logo-area img {
        max-width: 360px;
    }

    .logo-area h1 {
        font-size: 2rem;
    }

    .section {
        padding: 35px;
    }

    .question-item {
        padding: 30px;
    }

    .btn-submit {
        font-size: 1.2rem;
        padding: 18px 80px;
    }
}

/* ========================================
   17. 印刷スタイル
   ======================================== */
@media print {
    body {
        background-color: #ffffff;
    }

    .container {
        box-shadow: none;
        max-width: 100%;
    }

    .logo-area {
        background: none;
        color: #000;
    }

    .logo-area h1 {
        color: #000;
        text-shadow: none;
    }

    .btn-submit,
    .image-upload {
        display: none;
    }

    .section {
        page-break-inside: avoid;
    }
}