/**
 * ToniMaxx Contact Form Enhanced Styling
 * Custom styles for improved form appearance and user feedback
 */

/* Contact Form Base Styling */
.tonimaxx-contact-form {
    position: relative;
}

.tonimaxx-contact-form .form-group {
    position: relative;
    margin-bottom: 1.25rem;
}

/* Form Icon Positioning - Fixed for contact-form-style-02 */
.tonimaxx-contact-form .form-icon {
    position: absolute;
    top: 50%;
    left: 15px;
    transform: translateY(-50%);
    z-index: 10;
    pointer-events: none;
    color: #6c757d;
    transition: color 0.3s ease;
}

.tonimaxx-contact-form .form-textarea .form-icon {
    top: 15px;
    transform: translateY(0);
}

/* Input Field Styling */
.tonimaxx-contact-form input,
.tonimaxx-contact-form textarea {
    transition: all 0.3s ease;
    position: relative;
    z-index: 5;
}

.tonimaxx-contact-form input:focus,
.tonimaxx-contact-form textarea:focus {
    border-color: #dd6531 !important;
    box-shadow: 0 0 0 0.2rem rgba(221, 101, 49, 0.25) !important;
    outline: none;
}

.tonimaxx-contact-form input:focus + .form-icon,
.tonimaxx-contact-form textarea:focus + .form-icon {
    color: #dd6531;
}

/* Validation States */
.tonimaxx-contact-form .is-valid {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25) !important;
}

.tonimaxx-contact-form .is-valid + .form-icon {
    color: #28a745;
}

.tonimaxx-contact-form .is-invalid {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

.tonimaxx-contact-form .is-invalid + .form-icon {
    color: #dc3545;
}

/* Field Error Messages */
.field-error {
    display: block;
    font-size: 0.75rem;
    color: #dc3545;
    margin-top: 0.25rem;
    animation: slideInError 0.3s ease;
}

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

/* Submit Button Enhanced States */
.contact-submit-btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.contact-submit-btn.btn-loading {
    background-color: #6c757d !important;
    border-color: #6c757d !important;
    cursor: not-allowed;
}

.contact-submit-btn.btn-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: shimmer 2s infinite;
}

.contact-submit-btn.btn-success {
    background-color: #28a745 !important;
    border-color: #28a745 !important;
    animation: pulse-success 0.6s ease;
}

.contact-submit-btn.btn-error {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
    animation: shake 0.6s ease;
}

.contact-submit-btn.btn-shake {
    animation: shake 0.6s ease;
}

/* Button Animations */
@keyframes pulse-success {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-3px); }
    20%, 40%, 60%, 80% { transform: translateX(3px); }
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Form Results Styling */
.tonimaxx-contact-form .form-results {
    transition: all 0.3s ease-in-out;
    transform: translateY(0);
    border: 1px solid transparent;
}

.tonimaxx-contact-form .form-results.d-none {
    opacity: 0;
    transform: translateY(-10px);
}

.tonimaxx-contact-form .bg-light-success {
    background-color: #d4edda !important;
    border-color: #c3e6cb !important;
    color: #155724 !important;
}

.tonimaxx-contact-form .bg-light-danger {
    background-color: #f8d7da !important;
    border-color: #f5c6cb !important;
    color: #721c24 !important;
}

.tonimaxx-contact-form .bg-light-info {
    background-color: #d1ecf1 !important;
    border-color: #bee5eb !important;
    color: #0c5460 !important;
}

/* Spinner Animation */
.fa-spinner {
    animation: spin 1s linear infinite;
}

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

/* Icon Transitions */
.contact-submit-btn i {
    transition: all 0.3s ease;
}

/* Hover Effects */
.contact-submit-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.contact-submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .tonimaxx-contact-form .form-icon {
        left: 10px;
    }
    
    .tonimaxx-contact-form input,
    .tonimaxx-contact-form textarea {
        padding-left: 35px !important;
    }
}

/* Enhanced Input Focus Effects */
.tonimaxx-contact-form .form-group {
    position: relative;
}

.tonimaxx-contact-form .form-group::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #dd6531;
    transition: width 0.3s ease;
    z-index: 2;
}

.tonimaxx-contact-form .form-group:focus-within::before {
    width: 100%;
}

/* Improved Placeholder Styling */
.tonimaxx-contact-form input::placeholder,
.tonimaxx-contact-form textarea::placeholder {
    color: #adb5bd;
    transition: color 0.3s ease;
}

.tonimaxx-contact-form input:focus::placeholder,
.tonimaxx-contact-form textarea:focus::placeholder {
    color: #6c757d;
}

/* Loading Overlay for Form */
.tonimaxx-contact-form.form-submitting {
    position: relative;
    pointer-events: none;
}

.tonimaxx-contact-form.form-submitting::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 100;
    opacity: 0;
    animation: fadeInOverlay 0.3s ease forwards;
}

@keyframes fadeInOverlay {
    to {
        opacity: 1;
    }
}

/* Improved Button Icon Alignment */
.contact-submit-btn .btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Success/Error State Icons */
.form-results i {
    display: inline-block;
    margin-right: 0.5rem;
}

/* Form Group Hover Effects */
.tonimaxx-contact-form .form-group:hover .form-icon {
    color: #495057;
    transform: translateY(-50%) scale(1.1);
}

.tonimaxx-contact-form .form-textarea:hover .form-icon {
    transform: translateY(0) scale(1.1);
}

/* reCAPTCHA Widget Styling */
.tonimaxx-contact-form .g-recaptcha {
    margin-bottom: 1.25rem;
    display: flex;
    justify-content: center;
}

.tonimaxx-contact-form .g-recaptcha > div {
    transform: scale(0.9);
    transform-origin: center;
}

@media (max-width: 480px) {
    .tonimaxx-contact-form .g-recaptcha > div {
        transform: scale(0.85);
    }
}

/* reCAPTCHA Error Styling */
.tonimaxx-contact-form .g-recaptcha-error {
    border: 1px solid #dc3545;
    border-radius: 4px;
    padding: 8px;
    margin-top: 5px;
    background-color: #f8d7da;
    color: #721c24;
    font-size: 0.875rem;
    display: none;
}

.tonimaxx-contact-form .g-recaptcha-error.show {
    display: block;
    animation: slideInError 0.3s ease;
}