/* ========================================
   form-style.css - Complete Updated Version
   PORT2PORT CMS Form Styling
   ======================================== */

/* ----------------------------------------
   Hide Header in Iframe (All Screens)
   ---------------------------------------- */
body .main-header,
body > div.main-header,
header.main-header,
.page-wrapper > .main-header {
    display: none !important;
}

/* Hide Footer in Iframe */
body .main-footer,
body > div.main-footer,
footer.main-footer,
.page-wrapper > .main-footer,
footer {
    display: none !important;
}

/* Hide Accessibility Widget */
#nagishli,
.nagishli-widget,
[id*="accessibility"],
[class*="accessibility-widget"],
div[style*="z-index: 999999"],
div[style*="z-index:999999"] {
    display: none !important;
}

/* ----------------------------------------
   Form Container
   ---------------------------------------- */
.ContactForm {
    max-width: 580px;
    margin: 0 auto;
    padding: 10px 20px 30px;
}

/* ----------------------------------------
   Form Table Structure
   ---------------------------------------- */
table.tbfix {
    width: 100%;
    border-collapse: collapse;
    direction: rtl;
}

table.tbfix tr.form-row-input {
    display: flex;
    flex-direction: row;
    direction: rtl;
    align-items: center;
    margin-bottom: 16px;
    width: 100%;
}

/* Required asterisk */
table.tbfix td.form-required {
    width: 20px;
    min-width: 20px;
    text-align: center;
    padding: 0 4px;
}

table.tbfix td.form-required .required,
table.tbfix td.form-required div.required {
    color: #e74c3c;
    font-weight: 700;
    font-size: 1rem;
}

/* Field label */
table.tbfix td.form-lable {
    width: 120px;
    min-width: 120px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1a1a;
    text-align: right;
    padding: 0 8px 0 0;
    font-family: 'Assistant', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    white-space: nowrap;
}

/* Input field - takes remaining width */
table.tbfix td.form-field {
    flex: 1 1 auto;
    min-width: 0;
}

table.tbfix td.form-field input.input_text,
table.tbfix td.form-field input[type="text"],
table.tbfix td.form-field input[type="email"],
table.tbfix td.form-field input[type="tel"],
table.tbfix td.form-field textarea,
table.tbfix td.form-field select {
    width: 100% !important;
    padding: 10px 14px !important;
    border: 1.5px solid #d0d7e3 !important;
    border-radius: 6px !important;
    font-size: 0.95rem !important;
    font-family: 'Assistant', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    color: #1a1a1a !important;
    background: #fff !important;
    box-sizing: border-box !important;
    direction: rtl !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}

table.tbfix td.form-field input.input_text:focus,
table.tbfix td.form-field input[type="text"]:focus,
table.tbfix td.form-field input[type="email"]:focus,
table.tbfix td.form-field input[type="tel"]:focus {
    outline: none !important;
    border-color: #1b58a3 !important;
    box-shadow: 0 0 0 3px rgba(27, 88, 163, 0.1) !important;
}

/* ----------------------------------------
   reCAPTCHA
   ---------------------------------------- */
.g-recaptcha,
div[class*="recaptcha"] {
    margin: 20px 0 20px auto;
    display: flex;
    justify-content: flex-end;
}

/* ----------------------------------------
   Submit Button
   ---------------------------------------- */
table.tbfix input[type="submit"],
.ContactForm input[type="submit"],
form input[type="submit"] {
    background: #1b58a3 !important;
    color: #fff !important;
    padding: 14px 50px !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    font-family: 'Assistant', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    display: block !important;
    margin: 25px auto 0 !important;
}

form input[type="submit"]:hover {
    background: #002d62 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(27, 88, 163, 0.4) !important;
}

/* ----------------------------------------
   Form Header Responsive
   ---------------------------------------- */
@media (max-width: 1024px) and (min-width: 769px) {
    #reg-header-box { 
        padding: 45px 30px 35px !important; 
    }
    #reg-header-box img { 
        height: 65px !important; 
        margin-bottom: 25px !important; 
    }
    #reg-header-box h1 { 
        font-size: 2.2rem !important; 
    }
    #reg-header-box p { 
        font-size: 1.2rem !important; 
    }
}

@media (max-width: 768px) {
    #reg-header-box { 
        padding: 35px 20px 30px !important; 
    }
    #reg-header-box img { 
        height: 55px !important; 
        margin-bottom: 20px !important; 
    }
    #reg-header-box h1 { 
        font-size: 1.8rem !important; 
        margin-bottom: 12px !important; 
        padding: 0 10px !important; 
    }
    #reg-header-box p { 
        font-size: 1.1rem !important; 
        padding: 0 10px !important; 
    }
    #reg-header-box hr { 
        width: 60px !important; 
        height: 2.5px !important; 
        margin-top: 25px !important; 
    }
}

@media (max-width: 480px) {
    #reg-header-box { 
        padding: 30px 15px 25px !important; 
    }
    #reg-header-box img { 
        height: 50px !important; 
        margin-bottom: 18px !important; 
    }
    #reg-header-box h1 { 
        font-size: 1.5rem !important; 
        line-height: 1.2 !important; 
    }
    #reg-header-box p { 
        font-size: 1rem !important; 
    }
    #reg-header-box hr { 
        width: 50px !important; 
        margin-top: 20px !important; 
    }
}

/* ----------------------------------------
   Mobile Form Width Fix (CRITICAL)
   ---------------------------------------- */
@media (max-width: 768px) {
    /* Hide main header when in iframe */
    body .main-header,
    body > div.main-header,
    header.main-header {
        display: none !important;
    }
    
    body {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .ContactForm {
        max-width: 100% !important;
        margin: 0 !important;
        padding: 10px 15px 30px !important;
    }
    
    table.tbfix {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    table.tbfix tr.form-row-input {
        width: 100% !important;
        padding: 0 !important;
        margin-bottom: 14px !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
    }
    
    table.tbfix td.form-required {
        flex: 0 0 auto !important;
    }
    
    table.tbfix td.form-lable {
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: auto !important;
        max-width: 120px !important;
        font-size: 0.9rem !important;
    }
    
    table.tbfix td.form-field {
        flex: 1 1 0 !important;
        max-width: none !important;
        min-width: 0 !important;
    }
    
    table.tbfix td.form-field input,
    table.tbfix td.form-field textarea,
    table.tbfix td.form-field select {
        font-size: 0.9rem !important;
        padding: 9px 12px !important;
    }
    
    form input[type="submit"] {
        width: 100% !important;
        padding: 12px 30px !important;
        font-size: 1rem !important;
    }
}

/* ----------------------------------------
   Extra Small Mobile
   ---------------------------------------- */
@media (max-width: 480px) {
    .ContactForm {
        padding: 10px 10px 25px !important;
    }
    
    table.tbfix tr.form-row-input {
        margin-bottom: 12px !important;
    }
    
    table.tbfix td.form-required {
        width: 18px !important;
        min-width: 18px !important;
    }
    
    table.tbfix td.form-lable {
        font-size: 0.85rem !important;
    }
    
    table.tbfix td.form-field input,
    table.tbfix td.form-field textarea {
        font-size: 0.85rem !important;
        padding: 8px 10px !important;
    }
}


/* =======================================================
   תיקון כפייתי נגד סקריפטים (JS Override) לכפתורי רדיו
   ======================================================= */

@keyframes forceRTL {
    from {
        display: inline-block !important;
        float: right !important;
        flex: 0 0 auto !important;
        width: auto !important;
        margin-left: 8px !important;
        margin-right: 0 !important;
        position: relative !important;
        left: auto !important;
    }
    to {
        display: inline-block !important;
        float: right !important;
        flex: 0 0 auto !important;
        width: auto !important;
        margin-left: 8px !important;
        margin-right: 0 !important;
        position: relative !important;
        left: auto !important;
    }
}

/* הפעלת האנימציה בלולאה אינסופית על כפתור הרדיו */
body .ContactForm input[type="radio"],
table.tbfix td.form-field input[type="radio"],
input[type="radio"] {
    animation: forceRTL 0.1s infinite !important;
}

/* מניעת העלמת הטקסט והחזרת המבנה לקדמותו */
table.tbfix tr, 
.form-row-input {
    display: table-row !important;
}

table.tbfix td, 
.form-field {
    display: table-cell !important;
    text-align: right !important;
}

.form-field label, 
.form-field span {
    display: inline-block !important;
    vertical-align: middle !important;
    text-align: right !important;
    float: none !important;
}


/* =======================================================
   התאמה רספונסיבית מוחלטת למובייל (מסכים קטנים מ-768px)
   ======================================================= */
@media (max-width: 768px) {
    /* הכרחת שורת הטופס להתפרס על כל הרוחב */
    table.tbfix tr.form-row-input,
    .form-row-input {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        clear: both !important;
    }

    /* הגדרת אזור השדה במובייל */
    table.tbfix td.form-field,
    .form-field {
        display: block !important;
        width: 100% !important;
        text-align: right !important;
        float: none !important;
    }

    /* סידור אופציות הרדיו והטקסט במובייל - שורה תחת שורה */
    .form-field input[type="radio"] {
        display: inline-block !important;
        vertical-align: middle !important;
        margin-left: 10px !important;
        margin-right: 0 !important;
        transform: scale(1.2) !important; /* הגדלה קלה לנוחות לחיצה באצבע */
    }

    .form-field label,
    .form-field span {
        display: inline-block !important;
        vertical-align: middle !important;
        text-align: right !important;
        font-size: 1rem !important;
        line-height: 1.6 !important;
        margin-bottom: 8px !important; /* רווח קטן בין אופציה לאופציה */
    }
}
