/**
 * 標準PHPフォーム用のスタイル定義
 * 
 * このCSSファイルは、Contact Form 7に依存しない標準的なHTMLフォームの
 * スタイリングとユーザーエクスペリエンス向上のためのスタイルを提供します。
 * 
 * 主な機能：
 * 1. フォームフィールドのバリデーション状態表示
 * 2. エラーメッセージのスタイリング
 * 3. 確認画面のレイアウト
 * 4. レスポンシブ対応
 * 5. アニメーション効果
 * 
 * @author Claude Code
 * @version 1.0.0
 * @since 2025-06-09
 */

/* =============================================================================
   フォーム全体のレイアウト
   ============================================================================= */

#contact-form {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
}

/* メッセージコンテナ */
.form-message-container {
    margin: 20px 0;
    padding: 15px;
    border-radius: 5px;
    font-size: 14px;
    line-height: 1.5;
    display: none;
    animation: slideDown 0.3s ease-out;
}

.form-message-container.message-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.form-message-container.message-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.form-message-container.message-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* =============================================================================
   フィールドのバリデーション状態
   ============================================================================= */

/* 成功状態（有効な入力） */
.form-input:valid,
.form-textarea:valid {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

/* エラー状態（無効な入力） */
.form-input:invalid:not(:placeholder-shown),
.form-textarea:invalid:not(:placeholder-shown),
.form-input.error,
.form-textarea.error {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* フォーカス時のスタイル調整 */
.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* =============================================================================
   エラーメッセージ
   ============================================================================= */

.field-error-message {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
    line-height: 1.4;
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.field-error-message:not(:empty) {
    display: block;
}

/* メッセージコンテナのレイアウト */
.message-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-top: 2px;
    min-height: 20px;
}

.error-message {
    color: #dc3545;
    font-size: 12px;
    flex: 1;
    margin-right: 10px;
}

/* =============================================================================
   文字数カウンター
   ============================================================================= */

.character-counter {
    text-align: right;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    transition: color 0.3s ease;
}

.character-counter.warning {
    color: #ffc107;
}

.character-counter.error {
    color: #dc3545;
}

.character-counter.success {
    color: #28a745;
}

/* =============================================================================
   送信ボタンの状態
   ============================================================================= */

.submit-button {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.submit-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.submit-button.active {
    opacity: 1;
    cursor: pointer;
    pointer-events: auto;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.submit-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

/* 送信中のローディング効果 */
.submit-button.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.submit-button.loading {
    color: transparent;
}

/* =============================================================================
   確認画面のスタイル
   ============================================================================= */

.confirmation-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    animation: slideDown 0.3s ease-out;
}

.confirmation-content h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 24px;
    text-align: center;
}

.confirmation-content > p {
    color: #666;
    margin-bottom: 25px;
    text-align: center;
    line-height: 1.6;
}

.confirmation-data {
    background-color: #fff;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid #dee2e6;
}

.confirmation-row {
    display: flex;
    border-bottom: 1px solid #eee;
    padding: 12px 0;
}

.confirmation-row:last-child {
    border-bottom: none;
}

.confirmation-label {
    font-weight: bold;
    color: #333;
    min-width: 120px;
    flex-shrink: 0;
    margin-right: 20px;
}

.confirmation-value {
    color: #555;
    flex: 1;
    word-break: break-word;
    line-height: 1.5;
}

.confirmation-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}

.btn-back,
.btn-submit {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    min-width: 140px;
}

.btn-back {
    background-color: #6c757d;
    color: #fff;
}

.btn-back:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
}

.btn-submit {
    background-color: #007bff;
    color: #fff;
}

.btn-submit:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

/* =============================================================================
   チェックボックスのスタイル調整
   ============================================================================= */

.checkbox-container {
    position: relative;
}

.checkbox-input:invalid + .privacy-link {
    color: #dc3545;
}

.checkbox-input:valid + .privacy-link {
    color: inherit;
}

/* =============================================================================
   レスポンシブ対応
   ============================================================================= */

@media (max-width: 768px) {
    #contact-form {
        padding: 15px;
    }
    
    .confirmation-container {
        padding: 15px;
    }
    
    .confirmation-row {
        flex-direction: column;
    }
    
    .confirmation-label {
        min-width: auto;
        margin-right: 0;
        margin-bottom: 5px;
    }
    
    .confirmation-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn-back,
    .btn-submit {
        width: 100%;
        max-width: 300px;
    }
    
    .message-container {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .error-message {
        margin-right: 0;
        margin-bottom: 5px;
    }
}

@media (max-width: 480px) {
    .form-message-container {
        padding: 12px;
        font-size: 13px;
    }
    
    .confirmation-content h3 {
        font-size: 20px;
    }
    
    .confirmation-data {
        padding: 15px;
    }
    
    .field-error-message {
        font-size: 11px;
    }
    
    .character-counter {
        font-size: 11px;
    }
}

/* =============================================================================
   アニメーション
   ============================================================================= */

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* =============================================================================
   アクセシビリティ対応
   ============================================================================= */

/* ハイコントラストモード対応 */
@media (prefers-contrast: high) {
    .form-input,
    .form-textarea {
        border-width: 2px;
    }
    
    .field-error-message {
        font-weight: bold;
    }
    
    .form-message-container {
        border-width: 2px;
    }
}

/* 動きを減らす設定の場合のアニメーション無効化 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* フォーカス表示の強化 */
.form-input:focus-visible,
.form-textarea:focus-visible,
.submit-button:focus-visible,
.btn-back:focus-visible,
.btn-submit:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* =============================================================================
   印刷時のスタイル
   ============================================================================= */

@media print {
    .submit-button,
    .btn-back,
    .btn-submit {
        display: none;
    }
    
    .form-message-container {
        border: 1px solid #000;
        background-color: transparent !important;
        color: #000 !important;
    }
    
    .confirmation-container {
        background-color: transparent;
        border: 1px solid #000;
    }
    
    .confirmation-data {
        border: 1px solid #000;
    }
}