/**
 * Form Elementor Validation - form styles
 */

/* ===================================
   עברית - תמיכה בטקסט מימין לשמאל
   =================================== */

html[lang="he"] {
    direction: rtl;
    text-align: right;
}

html[lang="he"] body {
    direction: rtl;
}

html[lang="he"] .elementor-field-group {
    direction: rtl;
}

/* ===================================
   טפסים - Elementor Forms
   =================================== */

.elementor-form-fields-wrapper {
    direction: rtl;
}

.elementor-field {
    direction: rtl;
}

.elementor-field-label {
    direction: rtl;
    text-align: right;
}

/* ===================================
   הודעות שגיאה - Validation Messages
   =================================== */

.elementor-message-danger {
    color: #c1272d;
    background-color: #fde9e9;
    border-left: 4px solid #c1272d;
    padding: 12px 15px;
    margin-top: 8px;
    border-radius: 3px;
    font-size: 14px;
    direction: rtl;
    text-align: right;
}

html[lang="he"] .elementor-message-danger {
    border-left: 0;
    border-right: 4px solid #c1272d;
}

.elementor-message-danger[data-custom-error="true"] {
    animation: slideInRight 0.3s ease-in-out;
}

/* ===================================
   שדות עם שגיאות
   =================================== */

.elementor-field-group.error input,
.elementor-field-group.error textarea,
.elementor-field-group.error select {
    border-color: #c1272d !important;
    background-color: #fff9f9;
}

.elementor-field-group.error input:focus,
.elementor-field-group.error textarea:focus,
.elementor-field-group.error select:focus {
    border-color: #c1272d !important;
    box-shadow: 0 0 0 3px rgba(193, 39, 45, 0.1);
}

input[aria-invalid="true"],
textarea[aria-invalid="true"],
select[aria-invalid="true"] {
    border-color: #c1272d !important;
}

/* ===================================
   שדות תקינים
   =================================== */

input[aria-invalid="false"],
textarea[aria-invalid="false"],
select[aria-invalid="false"] {
    /* 3.9:1 against a yellow (#FFDE59) form background, 5.2:1 against white (WCAG 1.4.11) - #27ae60 was 2.2:1 */
    border-color: #1e7e34;
}

/* ===================================
   אנימציות
   =================================== */

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

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

/* ===================================
   הודעות הצלחה
   =================================== */

.elementor-message-success {
    animation: successFadeIn 0.5s ease-in-out;
}

/* ===================================
   קורא מסך וגישוליות - Accessibility
   =================================== */

/* Valid example under phone / email / website fields (added by forms.js) - #4A5566 is 7.4:1 on white */
.elementor-form .fev-hint {
    flex-basis: 100%;
    width: 100%;
    margin: .35em 0 0;
    padding: 0;
    color: #4A5566;
    font-size: .9em;
    line-height: 1.4;
}

/* The example as placeholder (added by forms.js): Elementor shows placeholders at 60% of the field's text colour -
   about 4.2:1 on white for dark text, under the 4.5:1 WCAG 1.4.3 asks. 80% keeps it lighter than typed text and
   above 4.5:1 for any text colour that itself has 7:1 */
.elementor-form .fev-example-placeholder::placeholder {
    opacity: .8;
}

/* Fields side by side in a row: Elementor stretches the groups to the row's height and spreads their content, so a
   hint under one field would move its label and field down - keep every group's content at the top instead */
.elementor-form-fields-wrapper:has(.fev-hint) > .elementor-field-group {
    align-content: flex-start;
}

/* Error summary at the top of the form (added by forms.js after a failed submit) - 7.6:1 on white */
.elementor-form .fev-error-summary {
    width: 100%;
}

.elementor-form .fev-error-summary__box {
    margin: 0 0 1em;
    padding: .75em 1em;
    border: 3px solid #a4161a;
    background: #fff;
    color: #1a1a1a;
}

/* In a popup the close button sits over the top of the form */
.elementor-popup-modal .elementor-form .fev-error-summary__box {
    margin-top: 2.5em;
}

.elementor-form .fev-error-summary__title {
    margin: 0 0 .4em;
    font-weight: 700;
    color: #a4161a;
}

.elementor-form .fev-error-summary ul {
    margin: 0;
    padding-inline-start: 1.2em;
}

.elementor-form .fev-error-summary a {
    color: #a4161a;
    text-decoration: underline;
    font-weight: 600;
}

.elementor-field:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/* ===================================
   טלפון - Phone Fields
   =================================== */

input[type="tel"] {
    font-family: monospace;
    letter-spacing: 0.5px;
}

/* ===================================
   אימייל - Email Fields
   =================================== */

input[type="email"] {
    direction: ltr;
}

html[lang="he"] input[type="email"] {
    text-align: left;
}

/* ===================================
   הודעות עזר - Helper Text
   =================================== */

.elementor-field-description {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    direction: rtl;
}

/* ===================================
   Mobile - Responsive
   =================================== */

@media (max-width: 768px) {
    .elementor-message-danger {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .elementor-field-group {
        margin-bottom: 15px;
    }
}

/* ===================================
   Dark Mode - תמיכה
   =================================== */

@media (prefers-color-scheme: dark) {
    .elementor-message-danger {
        background-color: rgba(193, 39, 45, 0.15);
        color: #ff6b6b;
    }
    
    .elementor-field-group.error input,
    .elementor-field-group.error textarea,
    .elementor-field-group.error select {
        background-color: rgba(193, 39, 45, 0.05);
    }
}

/* ===================================
   Print - הדפסה
   =================================== */

@media print {
    .elementor-message-danger {
        page-break-inside: avoid;
        background-color: #f0f0f0;
        border: 1px solid #ccc;
    }
}
