/* ===== フォーム関連スタイル ===== */

/* フォームヘッダー（タイトルとトグルボタン） */
.form-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.form-header h1 {
    color: #ff6b6b;
    margin: 0;
    text-align: center;
}

.form-toggle-btn {
    background: linear-gradient(135deg, #ff6b6b, #feca57);
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    color: white;
}

.form-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.form-toggle-btn:active {
    transform: translateY(0);
}

.toggle-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.form-toggle-btn.active .toggle-icon {
    transform: rotate(180deg);
}

/* フォーム入力欄のスライドイン */
.form-fields {
    max-height: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    transform: translateY(-20px) !important;
    transition: all 0.5s ease-in-out !important;
    visibility: hidden !important;
    display: block !important;
}

.form-fields.active {
    max-height: 3000px !important;
    opacity: 1 !important;
    transform: translateY(0) !important;
    visibility: visible !important;
}

/* フォーム */
.contact-form {
    width: 80%;
    margin: auto;
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 10px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
    text-align: left;
    width: 50%;
    margin-left: auto;
    margin-right: auto;
    justify-content: flex-start;
}

.required-badge {
    background: linear-gradient(135deg, #ff6b6b, #feca57);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 12px;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(255, 107, 107, 0.2);
}

.optional-badge {
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    color: white;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 12px;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(116, 185, 255, 0.2);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 50%;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    font-family: inherit;
    margin: 0 auto;
    display: block;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #ff6b6b;
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

.form-group input:invalid,
.form-group textarea:invalid,
.form-group select:invalid {
    border-color: #e74c3c;
}

.form-group input:valid,
.form-group textarea:valid,
.form-group select:valid {
    border-color: #27ae60;
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.field-error {
    color: #e74c3c;
    font-size: 14px;
    margin-top: 5px;
    min-height: 20px;
    display: flex;
    align-items: center;
    gap: 5px;
    width: 50%;
    margin-left: auto;
    margin-right: auto;
}

.character-count {
    text-align: right;
    font-size: 12px;
    color: #666;
    margin: 5px auto;
    width: 50%;
}

.character-count.warning {
    color: #f39c12;
}

.character-count.danger {
    color: #e74c3c;
}

/* キャプチャ */
.captcha-group {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #dee2e6;
    width: 50%;
    margin: 0 auto;
}

.captcha-group label {
    justify-content: flex-start;
    text-align: left;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
}

.captcha-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}

.captcha-question {
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 18px;
    color: #333;
    border: 2px solid #dee2e6;
    min-width: 120px;
    text-align: center;
    font-family: 'Courier New', monospace;
}

#captcha {
    width: 150px;
    text-align: center;
    font-weight: bold;
    margin: 0 5px;
}

.captcha-refresh {
    background: linear-gradient(135deg, #54a0ff, #2e86de);
    border: none;
    border-radius: 8px;
    padding: 12px;
    color: white;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.captcha-refresh:hover {
    transform: scale(1.1);
    background: linear-gradient(135deg, #2e86de, #54a0ff);
}

/* チェックボックス */
.checkbox-group {
    margin: 20px 0;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    line-height: 1.5;
    flex-wrap: wrap;
}

.checkbox-label .required-badge {
    margin-left: 10px;
    align-self: center;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
    margin-top: 2px;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: linear-gradient(135deg, #ff6b6b, #feca57);
    border-color: #ff6b6b;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark:after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 12px;
}

.privacy-link {
    color: #ff6b6b;
    text-decoration: underline;
    font-weight: 500;
}

.privacy-link:hover {
    color: #e74c3c;
}

/* レート制限 */
.rate-limit-info {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    text-align: center;
    color: #856404;
}

.rate-limit-text {
    font-weight: 500;
    display: block;
    margin-bottom: 5px;
}

.rate-limit-timer {
    font-size: 14px;
    color: #6c757d;
}

/* 送信ボタン */
.contact-form .btn {
    display: block;
    margin: 0 auto;
    font-size: 18px;
}

.btn-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ハニーポット（非表示） */
.honeypot {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    visibility: hidden !important;
}

/* セキュリティアラート */
.security-alert {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.security-alert:before {
    content: "🛡️";
    font-size: 16px;
}

/* 成功メッセージ */
.success-message {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
}

.success-message:before {
    content: "✅";
    font-size: 16px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* プライバシーポリシーモーダル */
.modal {
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.modal-show {
    opacity: 1;
    visibility: visible;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from { 
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    border-radius: 15px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: translateY(-50px) scale(0.9);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.modal.modal-show .modal-content {
    transform: translateY(0) scale(1);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 25px 30px 15px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #ff6b6b, #feca57);
    color: white;
    border-radius: 15px 15px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.modal-close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.modal-close:hover {
    opacity: 1;
    transform: scale(1.1);
}

.modal-body {
    padding: 30px;
    line-height: 1.6;
    color: #333;
}

.modal-body h3 {
    color: #ff6b6b;
    margin: 0 0 20px 0;
    font-size: 1.3rem;
}

.modal-body h4 {
    color: #333;
    margin: 25px 0 15px 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-body ul {
    margin: 10px 0 20px 20px;
}

.modal-body li {
    margin-bottom: 8px;
}

.policy-date {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-top: 25px;
    font-size: 14px;
    color: #666;
    border-left: 4px solid #ff6b6b;
}

.modal-footer {
    padding: 20px 30px 30px;
    text-align: center;
    border-top: 1px solid #dee2e6;
}

.modal-close-btn {
    min-width: 120px;
}

/* フォーム関連レスポンシブデザイン */
@media (max-width: 768px) {
    .contact-form {
        width: 95%;
        padding: 25px 15px;
        border-radius: 15px;
    }
    
    .form-header {
        gap: 10px;
        margin-bottom: 25px;
    }
    
    .form-header h1 {
        font-size: 1.4rem;
    }
    
    .form-toggle-btn {
        width: 40px;
        height: 40px;
    }
    
    .toggle-icon {
        width: 18px;
        height: 18px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-group label {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        font-size: 15px;
    }
    
    .required-badge,
    .optional-badge {
        align-self: flex-start;
        font-size: 11px;
        padding: 3px 6px;
    }
    
    .form-group input,
    .form-group textarea,
    .form-group select {
        width: 100%;
        padding: 12px;
        font-size: 16px;
        border-radius: 8px;
    }
    
    .form-group textarea {
        min-height: 100px;
    }
    
    .captcha-group {
        width: 100%;
        margin: 15px 0;
        padding: 12px;
    }
    
    .captcha-container {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .captcha-question {
        padding: 12px 15px;
        font-size: 16px;
        min-width: auto;
        width: 100%;
    }
    
    #captcha {
        width: 100%;
        margin: 0;
        font-size: 16px;
        padding: 12px;
    }
    
    .captcha-refresh {
        width: 50px;
        height: 50px;
        align-self: center;
        font-size: 18px;
    }
    
    .checkbox-group {
        margin: 20px 0;
    }
    
    .checkbox-label {
        gap: 10px;
        line-height: 1.4;
        font-size: 14px;
    }
    
    .checkbox-label .required-badge {
        margin-left: 0;
        align-self: flex-start;
        margin-top: 5px;
    }
    
    .checkmark {
        width: 18px;
        height: 18px;
        margin-top: 1px;
    }
    
    .field-error,
    .character-count {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        font-size: 13px;
    }
    
    .character-count {
        text-align: right;
        margin-top: 5px;
    }
    
    .rate-limit-info {
        padding: 12px;
        font-size: 14px;
    }
    
    .contact-form .btn {
        width: 100%;
        padding: 15px;
        font-size: 16px;
        margin-top: 10px;
    }
    
    .modal-content {
        margin: 5% auto;
        width: 95%;
        max-height: 90vh;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 20px 15px;
    }
    
    .modal-header h2 {
        font-size: 1.3rem;
    }
    
    .modal-body {
        font-size: 14px;
        line-height: 1.5;
    }
    
    .modal-body h3 {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }
    
    .modal-body h4 {
        font-size: 1rem;
        margin: 20px 0 10px 0;
    }
}

@media (max-width: 480px) {
    .contact-form {
        width: 100%;
        padding: 20px 12px;
        margin: 0 auto;
        border-radius: 12px;
    }
    
    .form-header h1 {
        font-size: 1.2rem;
    }
    
    .form-toggle-btn {
        width: 36px;
        height: 36px;
    }
    
    .toggle-icon {
        width: 16px;
        height: 16px;
    }
    
    .form-group {
        margin-bottom: 18px;
    }
    
    .form-group label {
        font-size: 14px;
        gap: 6px;
    }
    
    .required-badge,
    .optional-badge {
        font-size: 10px;
        padding: 2px 5px;
    }
    
    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 10px;
        font-size: 16px;
        border-radius: 6px;
    }
    
    .form-group textarea {
        min-height: 90px;
    }
    
    .captcha-group {
        padding: 10px;
        margin: 12px 0;
    }
    
    .captcha-group label {
        font-size: 13px;
    }
    
    .captcha-question {
        padding: 10px 12px;
        font-size: 15px;
    }
    
    #captcha {
        padding: 10px;
        font-size: 15px;
    }
    
    .captcha-refresh {
        width: 45px;
        height: 45px;
        font-size: 16px;
    }
    
    .checkbox-label {
        font-size: 13px;
        gap: 8px;
    }
    
    .checkmark {
        width: 16px;
        height: 16px;
    }
    
    .field-error,
    .character-count {
        font-size: 12px;
    }
    
    .rate-limit-info {
        padding: 10px;
        font-size: 13px;
    }
    
    .contact-form .btn {
        padding: 12px;
        font-size: 15px;
    }
    
    .modal-content {
        margin: 2% auto;
        width: 98%;
        max-height: 95vh;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 15px 12px;
    }
    
    .modal-header h2 {
        font-size: 1.1rem;
    }
    
    .modal-close {
        font-size: 24px;
    }
    
    .modal-body {
        font-size: 13px;
    }
    
    .modal-body h3 {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }
    
    .modal-body h4 {
        font-size: 0.9rem;
        margin: 15px 0 8px 0;
    }
    
    .modal-body ul {
        margin: 8px 0 15px 15px;
    }
    
    .modal-body li {
        margin-bottom: 5px;
    }
    
    .policy-date {
        padding: 12px;
        font-size: 12px;
    }
}