/**
 * Form Security Styles
 * Error messages and validation states
 */

/* Error Messages */
.error-msg,
.error-msg-general {
    display: none;
    color: #d32f2f;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
    font-weight: 400;
    line-height: 1.4;
}

.error-msg-general {
    background-color: #ffebee;
    border: 1px solid #ef5350;
    border-radius: 4px;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
}

/* Success Messages */
.success-msg {
    display: none;
    color: #2e7d32;
    font-size: 0.875rem;
    background-color: #e8f5e9;
    border: 1px solid #66bb6a;
    border-radius: 4px;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    font-weight: 400;
    line-height: 1.4;
}

/* Field Error State */
input.error,
textarea.error,
select.error {
    border-color: #d32f2f !important;
    background-color: #fff5f5;
}

input.error:focus,
textarea.error:focus,
select.error:focus {
    border-color: #c62828 !important;
    box-shadow: 0 0 0 0.2rem rgba(211, 47, 47, 0.25);
}

/* Honeypot Field - Must be invisible */
.hp-field,
input[name*="_confirm"],
input[name*="_alt"],
input[name*="_verify"],
input[name*="alternative"],
input[name*="backup"],
input[name*="address_line_3"],
input[name*="fax_number"] {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Loading State */
button[type="submit"]:disabled,
.custom-cta:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Form Loading Indicator */
.loader_ajax {
    display: none;
    text-align: center;
    margin: 1rem 0;
}

.loader_ajax img {
    max-width: 50px;
    height: auto;
}

/* Validation Icons (Optional Enhancement) */
.field-wrapper {
    position: relative;
}

.field-wrapper input.error::after {
    content: '✖';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #d32f2f;
    font-weight: bold;
}

/* Focus States for Better UX */
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #02a3b3;
    box-shadow: 0 0 0 0.2rem rgba(2, 163, 179, 0.25);
}

/* Required Field Indicator (Optional) */
[data-validate*="required"] + label::after,
label[for] [data-validate*="required"]::after {
    content: ' *';
    color: #d32f2f;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .error-msg,
    .error-msg-general,
    .success-msg {
        font-size: 0.8125rem;
        padding: 0.5rem 0.75rem;
    }
}

/* Animation for Error Messages */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.error-msg,
.error-msg-general,
.success-msg {
    animation: slideDown 0.3s ease-out;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .error-msg,
    .error-msg-general {
        border-width: 2px;
    }
    
    input.error,
    textarea.error,
    select.error {
        border-width: 2px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .error-msg-general {
        background-color: #3a1f1f;
        border-color: #d32f2f;
        color: #ffcdd2;
    }
    
    .success-msg {
        background-color: #1b3a1f;
        border-color: #2e7d32;
        color: #c8e6c9;
    }
    
    input.error,
    textarea.error,
    select.error {
        background-color: #2a1717;
    }
}

/* Print Styles */
@media print {
    .error-msg,
    .error-msg-general,
    .success-msg,
    .hp-field {
        display: none !important;
    }
}

/* Accessibility - Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus Visible for Keyboard Navigation */
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid #02a3b3;
    outline-offset: 2px;
}

/* Form Submission Success State */
form.submitted {
    opacity: 0.5;
    pointer-events: none;
}

/* reCAPTCHA Badge Position */
.grecaptcha-badge {
    visibility: visible;
    z-index: 9999;
}

/* Custom Styling to Match Your Theme */
/* Adjust these colors to match your brand */
:root {
    --form-error-color: #d32f2f;
    --form-error-bg: #fff5f5;
    --form-error-border: #ef5350;
    --form-success-color: #2e7d32;
    --form-success-bg: #e8f5e9;
    --form-success-border: #66bb6a;
    --form-focus-color: #02a3b3;
}

/* Override with your brand colors */
.error-msg,
.error-msg-general {
    color: var(--form-error-color);
}

.error-msg-general {
    background-color: var(--form-error-bg);
    border-color: var(--form-error-border);
}

.success-msg {
    color: var(--form-success-color);
    background-color: var(--form-success-bg);
    border-color: var(--form-success-border);
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--form-focus-color);
}
