/* ============================================
   Contact Form CSS
   お問い合わせフォーム専用スタイル
   ============================================ */

/* ============================================
   1. レイアウト - メインラッパー
   ============================================ */
.single-contact-mainwrapper {
    margin: 0 auto;
    padding-top: 130px;
    padding-bottom: 100px;
}

.single-contact-mainwrapper .single-contact-content {
    width: 800px;
    margin: 0 auto;
}

.single-contact-mainwrapper .single-contact-content .single-contact-article .contact-title {
    text-align: center;
}

.single-contact-mainwrapper .single-contact-content .single-contact-article h1 {
    color: #3c4d69;
    font-size: 34px;
    margin: 0.67em 0;
}

.single-contact-mainwrapper .single-contact-content .single-contact-article h2 {
    color: #505050;
}

.single-contact-article p {
    padding-top: 0px!important;
    font-size: 14px!important;
}

/* ============================================
   2. フォームグループ - 基本構造
   ============================================ */
.form-group {
    margin-bottom: 24px;
}

/* 横2列レイアウト用のラッパー */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ============================================
   3. ラベル・バッジ
   ============================================ */
.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 16px;
}

/* 必須バッジ */
.required-badge {
    display: inline-block;
    background-color: #e74c3c;
    color: #fff;
    font-size: 11px;
    padding: 2px 8px 4px;
    border-radius: 3px;
    margin-left: 6px;
    font-weight: 500;
}

/* 任意バッジ */
.optional-badge {
    display: inline-block;
    background-color: #95a5a6;
    color: #fff;
    font-size: 11px;
    padding: 2px 8px 4px;
    border-radius: 3px;
    margin-left: 6px;
    font-weight: 500;
}

/* ============================================
   4. 入力フィールド - 共通スタイル
   ============================================ */
.formContent {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    margin-bottom: 0px;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s ease;
    box-sizing: border-box;
    background-color: #fff;
}

/* ホバー状態 */
.formContent:hover:not(:focus):not(.error) {
    border-color: #bbb;
    transition: border-color 0.2s ease;
}

/* フォーカス状態 */
.formContent:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.2);
    background-color: #f8fbff;
    transform: scale(1.01);
}

/* 成功状態 */
.formContent.success {
    border-color: #27ae60;
    background-color: #fff;
}

/* ============================================
   5. テキストエリア
   ============================================ */
textarea.formContent {
    resize: vertical;
    min-height: 120px;
}

/* ============================================
   6. セレクトボックス
   ============================================ */
select.formContent {
    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='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
    cursor: pointer;
}

/* 未選択状態（プレースホルダー風）- グレー表示 */
select.formContent.placeholder-shown {
    color: #999;
}

/* 選択済み状態 - 黒表示 */
select.formContent.has-value {
    color: #333;
}

/* ============================================
   7. ラジオボタン
   ============================================ */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.radio-item {
    display: flex;
    align-items: center;
}

.radio-item:hover {
    background-color: #f8f9fa;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.radio-item input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: #161616;
}

.radio-label {
    margin-left: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
}

/* ============================================
   8. チェックボックス
   ============================================ */
.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.checkbox-group:hover {
    background-color: #f8f9fa;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: #161616;
}

.checkbox-label {
    cursor: pointer;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}

.checkbox-label a {
    color: #ba4d4d;
    text-decoration: underline;
}

/* ============================================
   9. エラー表示
   ============================================ */

/* エラー状態の入力フィールド */
.formContent.error {
    border-color: #e74c3c;
    background-color: #ffe6e6;
    animation: shake 0.5s;
}

/* エラーメッセージ */
.error-message {
    display: block;
    color: #e74c3c;
    font-size: 13px;
    margin-top: 6px;
    min-height: 18px;
}

.error-message:empty {
    display: none;
}

.error-message:not(:empty) {
    animation: fadeIn 0.3s ease-out;
}

/* エラー通知バナー */
.form-notification {
    padding: 12px 20px 16px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
}

.error-notification {
    background-color: #ffe6e6;
    border-left: 4px solid #e74c3c;
    color: #c0392b;
}

/* サーバーサイドエラーメッセージ */
.server-error {
    background-color: #fee;
    border: 2px solid #f66;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
    animation: slideDown 0.3s ease-out;
}

.server-error p {
    color: #c33;
    font-weight: 500;
    margin: 0;
}

/* ============================================
   10. ヒント・補助テキスト
   ============================================ */
.form-hint {
    display: block;
    color: #7f8c8d;
    font-size: 12px;
    margin-top: 6px;
}

/* ============================================
   11. 文字数カウンター
   ============================================ */
.char-counter {
    text-align: right;
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 6px;
}

.char-count {
    font-weight: 600;
    color: #333;
}

.char-counter.warning .char-count {
    color: #f39c12;
}

.char-counter.danger .char-count {
    color: #e74c3c;
}

/* 文字数カウンターとエラーメッセージの横並び */
.char-counter-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    gap: 12px;
}

.char-counter-wrapper .char-counter {
    margin-top: 0;
    flex-shrink: 0;
}

.char-counter-wrapper .error-message {
    margin-top: 0;
    text-align: left;
    flex-grow: 1;
}

/* ============================================
   12. 日本語リアルタイムプレビュー表示
   ============================================ */
.japanese-preview {
    display: none;
    margin-top: 8px;
    padding: 10px 14px;
    background-color: #fff5f5;
    border: 2px solid #e74c3c;
    border-radius: 4px;
    animation: slideDown 0.3s ease-out;
}

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

.japanese-preview-label {
    font-size: 12px;
    color: #e74c3c;
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.japanese-preview-label::before {
    content: "⚠️";
    font-size: 14px;
}

.japanese-preview-content {
    font-size: 16px;
    color: #e74c3c;
    font-weight: 700;
    letter-spacing: 2px;
    word-break: break-all;
    line-height: 1.6;
}

/* メールアドレスフィールドに日本語が含まれる場合 */
.formContent.has-japanese {
    border-color: #e74c3c;
    background-color: #ffe6e6;
}

/* ============================================
   13. 送信ボタン
   ============================================ */
.submit-area {
    margin-top: 32px;
    text-align: center;
}

.formSubmitButton {
    background: linear-gradient(#f4d04b 3%, #f9a918) !important;
    color: #a12007;
    font-size: 16px;
    font-weight: 600;
    padding: 14px 48px 16px;
    border: none;
    border-radius: 32px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 200px;
}

.formSubmitButton:hover:not(:disabled) {
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgb(84 2 2 / 30%);
    background: linear-gradient(#f07272 3%, #e1a230) !important;
}

.formSubmitButton:active:not(:disabled) {
    transform: translateY(0);
}

.formSubmitButton:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ローディング状態 */
.formSubmitButton.loading {
    position: relative;
    color: transparent;
}

.formSubmitButton.loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.8s linear infinite;
}

/* ============================================
   14. アニメーション定義
   ============================================ */

/* シェイクアニメーション（エラー時） */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* フェードインアニメーション */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* スライドダウンアニメーション */
@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        margin-top: 0;
    }
    to {
        opacity: 1;
        max-height: 200px;
        padding-top: 10px;
        padding-bottom: 10px;
        margin-top: 8px;
    }
}

/* スピナーアニメーション */
@keyframes spinner {
    to { transform: rotate(360deg); }
}

/* ============================================
   15. アクセシビリティ
   ============================================ */
*:focus-visible {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* ============================================
   16. レスポンシブ - タブレット (769px - 1023px)
   ============================================ */
@media screen and (min-width: 769px) and (max-width: 1023px) {
    .single-contact-mainwrapper {
        padding-top: 100px;
        padding-left: 40px;
        padding-right: 40px;
        padding-bottom: 0;
    }

    .single-contact-mainwrapper .single-contact-content {
        width: 100%;
        max-width: 700px;
        margin: 0 auto;
    }

    .form-row {
        grid-template-columns: 1fr 1fr;
    }

    .formSubmitButton {
        min-width: 250px;
    }
}

/* ============================================
   18. レスポンシブ - デスクトップ (1024px以上)
   ============================================ */
@media screen and (min-width: 1024px) {
    .sp {
        display: none !important;
    }
}

/* ============================================
   19. レスポンシブ - モバイル (768px以下)
   ============================================ */
@media screen and (max-width: 768px) {
    .sp {
        display: block;
    }

    .formContent {
        font-size: 16px; /* iOS Safariのズームを防ぐ */
    }
    
    .formSubmitButton {
        width: auto;
        padding: 16px 24px;
    }

    .single-contact-mainwrapper {
        padding-top: 66px;
        padding-bottom: 0px;
    }

    .single-contact-mainwrapper .single-contact-content .single-contact-article h1 {
        color: #3c4d69;
        font-size: 26px;
        margin: 0.67em 0;
    }

    .single-contact-mainwrapper .single-contact-content .single-contact-article h2 {
        font-size: 16px;
        margin: 0.67em 0;
    }

    .single-contact-mainwrapper .single-contact-content {
        width: auto;
        padding: 0px 26px 0px;
    }
    
    .radio-group {
        gap: 16px;
    }
}

@media screen and (max-width: 460px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 0px;
    }
} 


/* ============================================
   20. 印刷用スタイル
   ============================================ */
@media print {
    .formSubmitButton {
        display: none;
    }
}

/* ============================================
   自動入力ボタンのデザイン
   ============================================ */
.btn-autofill {
    background-color: #f0f4f8;
    border: 1px solid #d1d9e6;
    color: #3c4d69;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    line-height: 1.5;
}

.btn-autofill:hover {
    background-color: #e1e8f0;
    color: #2c3e50;
    transform: translateY(-1px);
}

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

.btn-autofill i {
    margin-right: 4px;
}

@media screen and (min-width: 1024px) and (max-width: 1288px) {
    /* ナビゲーションリンクを折り返さない */
    .header .header_inner .global_nav_div .global_nav li a {
        white-space: nowrap;
        font-size: 13px;
    }
    
    /* ナビゲーション項目の間隔を詰める */
    .header .header_inner .global_nav_div .global_nav li {
        margin-left: 14px;
    }
    
    /* CTAボタンを小さくする */
    .header .header_inner .global_nav_div .cta li {
        width: 160px;
        height: 42px;
    }
    
    .header .header_inner .global_nav_div .cta li .trial_cta,
    .header .header_inner .global_nav_div .cta li .download_cta {
        font-size: 14px;
    }
    
    /* CTAの左マージンを調整 */
    .header .header_inner .global_nav_div .cta {
        margin-left: 20px;
    }
    
    .header .header_inner .global_nav_div .cta li .download_cta {
        margin-left: 16px;
    }
}