/* フォームグループの基本スタイル */
.form-group {
    margin-bottom: 24px;
}

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

/* デスクトップ（768px以上）で2列表示 */
@media screen and (min-width: 768px) {
    .form-row {
        grid-template-columns: 1fr 1fr;
    }
}

/* ラベルスタイル */
.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;
}

/* 入力フィールドスタイル */
.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;
}

/* ラジオボタンとチェックボックスのホバー */
.radio-item:hover,
.checkbox-group:hover {
    background-color: #f8f9fa;
    border-radius: 4px;
    transition: background-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.error {
    border-color: #e74c3c;
    background-color: #ffe6e6; /* 薄ピンク背景 */
}

.formContent.success {
    border-color: #27ae60;
    background-color: #fff;
}

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

/* セレクトボックス */
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;
}

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

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

.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;
}

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

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

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

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

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

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

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

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

/* 文字数カウンター */
.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;
}

/* 通知メッセージ */
.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;
}

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

/* 送信ボタン */
.formSubmitButton {
    background-color: #333;
    color: #fff;
    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: #000;
    background-color: #c1c1c1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(58, 58, 58, 0.3);
}

.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;
}

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

/* 文字数カウンターとエラーメッセージの横並び */
.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;
}

@keyframes spinner {
    to { transform: rotate(360deg); }
}

/* レスポンシブ対応 */
@media screen and (max-width: 768px) {
    .formContent {
        font-size: 16px; /* iOS Safariのズームを防ぐ */
    }
    
    .formSubmitButton {
        width: 100%;
        padding: 16px 24px;
    }
    
    .radio-group {
        gap: 16px;
    }
}

/* フォーカス時のアクセシビリティ向上 */
*:focus-visible {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* プリント時の最適化 */
@media print {
    .formSubmitButton {
        display: none;
    }
}

/* エラーフィールドのアニメーション */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.formContent.error {
    animation: shake 0.5s;
}

/* エラーメッセージのフェードイン */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* サーバーサイドエラーメッセージ */
.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;
}

/* ============================================
   ★ 新機能：日本語リアルタイムプレビュー表示
   ============================================ */

/* 日本語プレビュー表示エリア */
.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;
}

/* スライドダウンアニメーション */
@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;
    }
}

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