/* Contact Form Enhancements CSS */

/* Loading spinner animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Spinner styles */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
}

/* Button loading state */
.tp-contact-form-btn button.loading {
    opacity: 0.8;
    cursor: not-allowed;
    pointer-events: none;
}

.tp-contact-form-btn button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Form validation error styles */
.tp-contact-form-input.error input,
.tp-contact-form-input.error textarea {
    border-color: #dc3545 !important;
    background-color: rgba(220, 53, 69, 0.1) !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

.tp-contact-form-input.error label {
    color: #dc3545 !important;
}

/* Success and error message styles */
.ajax-response {
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    margin-top: 10px;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(-10px);
}

.ajax-response.success {
    color: #155724;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    opacity: 1;
    transform: translateY(0);
}

.ajax-response.error {
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    opacity: 1;
    transform: translateY(0);
}

/* Form input focus states */
.tp-contact-form-input input:focus,
.tp-contact-form-input textarea:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 0.2rem rgba(0, 124, 186, 0.25);
    transition: all 0.3s ease;
}

/* Form input valid state */
.tp-contact-form-input input:valid,
.tp-contact-form-input textarea:valid {
    border-color: #28a745;
}

/* Smooth transitions for form elements */
.tp-contact-form-input input,
.tp-contact-form-input textarea {
    transition: all 0.3s ease;
}

/* Button hover effects enhancement */
.tp-contact-form-btn button:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

/* Loading state text animation */
.tp-contact-form-btn button.loading .text-1,
.tp-contact-form-btn button.loading .text-2 {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Form container enhancements */
.tp-contact-form-wrap {
    position: relative;
}

/* Mobile responsive adjustments */
@media (max-width: 767px) {
    .ajax-response {
        font-size: 13px;
        padding: 10px 12px;
    }
    
    .spinner {
        width: 14px;
        height: 14px;
        margin-right: 6px;
    }
    
    .tp-contact-form-btn button {
        font-size: 14px;
    }
}

/* Dark theme support for widget popup */
.popup .tp-contact-form-input.error input,
.popup .tp-contact-form-input.error textarea {
    border-color: #ff6b6b !important;
    background-color: rgba(255, 107, 107, 0.1) !important;
}

.popup .ajax-response.success {
    background-color: rgba(40, 167, 69, 0.2);
    border-color: rgba(40, 167, 69, 0.3);
    color: #28a745;
}

.popup .ajax-response.error {
    background-color: rgba(220, 53, 69, 0.2);
    border-color: rgba(220, 53, 69, 0.3);
    color: #dc3545;
}

/* Form field animation on focus */
.tp-contact-form-input {
    position: relative;
    overflow: hidden;
}

.tp-contact-form-input::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #007cba, #0056b3);
    transition: width 0.3s ease;
    z-index: 1;
}

.tp-contact-form-input:focus-within::before {
    width: 100%;
}

/* Success checkmark animation */
.ajax-response.success::before {
    content: '✓';
    display: inline-block;
    margin-right: 8px;
    font-weight: bold;
    animation: checkmark 0.5s ease-in-out;
}

@keyframes checkmark {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Error icon animation */
.ajax-response.error::before {
    content: '⚠';
    display: inline-block;
    margin-right: 8px;
    font-weight: bold;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* reCAPTCHA styling */
.grecaptcha-badge {
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Show reCAPTCHA badge on form focus (optional) */
.contact-form:focus-within ~ .grecaptcha-badge {
    visibility: visible;
    opacity: 1;
}

/* reCAPTCHA loading state */
.recaptcha-loading {
    position: relative;
}

.recaptcha-loading::after {
    content: 'Verifying...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    color: #666;
}
