/*
=============================================
Custom CSS - Dr Mahmoud Farouk
تخصيصات CSS إضافية للموقع
=============================================
*/

/* ========================================
   تنسيقات Contact Form 7 العامة
   ======================================== */

.wpcf7-form p {
    margin-bottom: 20px;
}

.wpcf7-form-control {
    width: 100% !important;
    padding: 15px !important;
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    font-family: Arial, sans-serif !important;
    background: #f9f9f9 !important;
}

.wpcf7-form-control:focus {
    border-color: #2563eb !important;
    background: white !important;
    outline: none !important;
}

.wpcf7-submit {
    width: 100% !important;
    background: #2563eb !important;
    color: white !important;
    padding: 15px !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 18px !important;
    cursor: pointer !important;
}

.wpcf7-submit:hover {
    background: #1d4ed8 !important;
}

.wpcf7-mail-sent-ok {
    background: #10b981 !important;
    color: white !important;
    padding: 15px !important;
    border-radius: 8px !important;
    text-align: center !important;
}

/* ========================================
   عنوان الصفحة في المنتصف
   ======================================== */

.header {
    text-align: center !important;
    direction: ltr !important;
}

.header h2 {
    text-align: center !important;
    direction: ltr !important;
    margin: 0 auto 15px auto !important;
}

.header p {
    text-align: center !important;
    direction: ltr !important;
    margin: 0 auto !important;
}

/* ========================================
   زر الإرسال في المنتصف
   ======================================== */

.submit-section {
    text-align: center !important;
    margin-top: 30px !important;
    direction: ltr !important;
}

.wpcf7-submit {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
    color: white !important;
    padding: 15px 40px !important;
    border: none !important;
    border-radius: 25px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3) !important;
    transition: all 0.3s ease !important;
    width: auto !important;
    min-width: 200px !important;
    text-align: center !important;
    direction: ltr !important;
}

.wpcf7-submit:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4) !important;
}

/* ========================================
   باقي العناصر RTL
   ======================================== */

.wpcf7-form,
.form-field,
.form-field label {
    direction: rtl;
    text-align: right;
}

.wpcf7-form-control {
    direction: rtl !important;
    text-align: right !important;
}

/* ========================================
   أيقونة زر الإرسال
   ======================================== */

.wpcf7-submit:before {
    content: '\f1d8' !important;
    font-family: 'Font Awesome 6 Free' !important;
    font-weight: 900 !important;
    font-size: 28px !important;
    margin-left: 20px !important;
    display: inline-block !important;
    animation: pulse 2s infinite !important;
}

.wpcf7-form input[type="submit"] {
    background: #2563eb !important;
    color: white !important;
    padding: 25px 60px !important;
    border: none !important;
    border-radius: 30px !important;
    font-size: 22px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    width: 100% !important;
    max-width: 350px !important;
    height: 70px !important;
    margin: 30px auto !important;
    display: block !important;
    text-align: center !important;
    box-shadow: 0 5px 15px rgba(37, 99, 235, 0.4) !important;
}

/* ========================================
   صور الخدمات
   ======================================== */

.service-image {
    background: linear-gradient(135deg, #0070f3, #0051cc);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
}

.service-image[alt]::after {
    content: attr(alt);
    text-align: center;
    padding: 20px;
}

/* ========================================
   تنسيقات فورم المركز الأوروبي الطبي
   ======================================== */

/* تصميم الفورم الأساسي - أولوية قصوى */
.wpcf7-form .emc-form,
div.wpcf7 .emc-form,
.emc-form {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 30px !important;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%) !important;
    border-radius: 20px !important;
    box-shadow: 0 20px 40px rgba(30, 58, 138, 0.1) !important;
    border: 1px solid #e5e7eb !important;
    position: relative !important;
    overflow: hidden !important;
    flex-wrap: nowrap !important;
}

/* إزالة أي inline styles قد تتداخل */
.emc-form[style*="flex-direction"] {
    flex-direction: column !important;
}

/* خلفية ديكوريف للفورم */
.emc-form::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%233b82f6' fill-opacity='0.03' fill-rule='nonzero'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
    pointer-events: none;
    z-index: 0;
}

/* العناصر داخل الفورم */
.emc-form > * {
    position: relative;
    z-index: 1;
}

/* تصميم عنوان الفورم */
.emc-form-title {
    text-align: center;
    color: #1e3a8a;
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 25px;
    position: relative;
    font-family: 'Arial', 'Tahoma', sans-serif;
}

.emc-form-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    border-radius: 2px;
}

/* تصميم حقول الإدخال - أولوية عالية */
.emc-form input[type="text"],
.emc-form input[type="tel"],
.emc-form input[type="email"],
.emc-form select,
.emc-form textarea,
.wpcf7-form .emc-form input[type="text"],
.wpcf7-form .emc-form input[type="tel"],
.wpcf7-form .emc-form input[type="email"],
.wpcf7-form .emc-form select,
.wpcf7-form .emc-form textarea,
div.wpcf7 .emc-form input[type="text"],
div.wpcf7 .emc-form input[type="tel"],
div.wpcf7 .emc-form input[type="email"],
div.wpcf7 .emc-form select,
div.wpcf7 .emc-form textarea {
    width: 100% !important;
    padding: 18px 20px !important;
    border: 2px solid #e5e7eb !important;
    border-radius: 12px !important;
    font-size: 16px !important;
    font-family: 'Arial', 'Tahoma', sans-serif !important;
    background: #f9fafb !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-sizing: border-box !important;
    color: #374151 !important;
    font-weight: 500 !important;
    margin-bottom: 0 !important;
    text-align: right !important;
    direction: rtl !important;
}

/* تأثير التركيز */
.emc-form input[type="text"]:focus,
.emc-form input[type="tel"]:focus,
.emc-form input[type="email"]:focus,
.emc-form select:focus,
.emc-form textarea:focus {
    border-color: #3b82f6 !important;
    background: white !important;
    outline: none !important;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15) !important;
    transform: translateY(-2px) !important;
}

/* تأثير الهوفر */
.emc-form input[type="text"]:hover,
.emc-form input[type="tel"]:hover,
.emc-form input[type="email"]:hover,
.emc-form select:hover,
.emc-form textarea:hover {
    border-color: #60a5fa !important;
    background: white !important;
}

/* تصميم زر الإرسال - أولوية عالية */
.emc-form input[type="submit"],
.wpcf7-form .emc-form input[type="submit"],
div.wpcf7 .emc-form input[type="submit"] {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #60a5fa 100%) !important;
    color: white !important;
    border: none !important;
    padding: 20px 40px !important;
    border-radius: 12px !important;
    font-size: 18px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    position: relative !important;
    overflow: hidden !important;
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3) !important;
    margin-bottom: 0 !important;
    width: 100% !important;
}

/* تأثير متحرك للزر */
.emc-form input[type="submit"]:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.6s;
}

.emc-form input[type="submit"]:hover:before {
    left: 100%;
}

/* تأثير الهوفر على الزر */
.emc-form input[type="submit"]:hover {
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 50%, #3b82f6 100%) !important;
    transform: translateY(-3px) !important;
    box-shadow: 0 15px 35px rgba(59, 130, 246, 0.4) !important;
}

.emc-form input[type="submit"]:active {
    transform: translateY(-1px) !important;
}

/* ========================================
   التصميم الأفقي للديسكتوب
   ======================================== */

@media screen and (min-width: 768px) {
    /* فرض التصميم الأفقي على الديسكتوب */
    .wpcf7-form .emc-form,
    div.wpcf7 .emc-form,
    .emc-form,
    .emc-form[style*="flex-direction"] {
        display: flex !important;
        flex-direction: row !important;
        align-items: flex-end !important;
        gap: 20px !important;
        padding: 40px !important;
        direction: rtl !important;
        justify-content: flex-start !important;
        flex-wrap: nowrap !important;
    }
    
    /* إعدادات العناصر للتصميم الأفقي */
    .emc-form > p,
    .emc-form > .form-field,
    .wpcf7-form .emc-form > p,
    div.wpcf7 .emc-form > p {
        flex: 1 1 auto !important;
        margin: 0 !important;
        padding: 0 !important;
        min-width: 200px !important;
        max-width: none !important;
    }
    
    /* حقول الإدخال */
    .emc-form input[type="text"],
    .emc-form input[type="tel"],
    .emc-form input[type="email"],
    .emc-form select,
    .emc-form textarea {
        width: 100% !important;
        margin-bottom: 0 !important;
    }
    
    /* زر الإرسال */
    .emc-form > p:last-child,
    .emc-form > .submit-field,
    .emc-form input[type="submit"] {
        flex: 0 0 auto !important;
        min-width: 180px !important;
        max-width: 220px !important;
        width: auto !important;
    }
    
    /* ترتيب العناصر من اليمين لليسار (RTL) */
    .emc-form > *:nth-child(1) { order: 1 !important; }
    .emc-form > *:nth-child(2) { order: 2 !important; }
    .emc-form > *:nth-child(3) { order: 3 !important; }
    .emc-form > *:nth-child(4) { order: 4 !important; }
    
    /* إزالة المسافات الجانبية بين العناصر */
    .emc-form > *:not(:last-child) {
        margin-left: 15px !important;
        margin-right: 0 !important;
    }
    
    .emc-form > *:first-child {
        margin-right: 0 !important;
    }
    
    .emc-form > *:last-child {
        margin-left: 0 !important;
    }
}

/* تحسين للشاشات الكبيرة */
@media screen and (min-width: 1024px) {
    .emc-form {
        gap: 25px !important;
    }
    
    .emc-form > *:not(:last-child) {
        margin-left: 20px !important;
    }
    
    .emc-form input[type="submit"] {
        min-width: 200px !important;
    }
}

/* تصميم التابلت */
@media screen and (min-width: 768px) and (max-width: 1023px) {
    .emc-form {
        gap: 18px !important;
        padding: 35px !important;
    }
    
    .emc-form input[type="submit"] {
        min-width: 160px !important;
        font-size: 16px !important;
        padding: 18px 30px !important;
    }
}

/* ========================================
   تصميم الموبايل - عمودي
   ======================================== */

@media screen and (max-width: 767px) {
    .emc-form,
    .wpcf7-form .emc-form,
    div.wpcf7 .emc-form,
    .emc-form[style*="flex-direction"] {
        flex-direction: column !important;
        padding: 25px 20px !important;
        gap: 18px !important;
        direction: rtl !important;
    }
    
    .emc-form > p,
    .emc-form > .form-field,
    .emc-form > .submit-field {
        width: 100% !important;
        margin: 0 !important;
        order: unset !important;
    }
    
    .emc-form input[type="text"],
    .emc-form input[type="tel"],
    .emc-form input[type="email"],
    .emc-form select,
    .emc-form textarea,
    .emc-form input[type="submit"] {
        width: 100% !important;
    }

    .emc-form-title {
        font-size: 24px !important;
        margin-bottom: 20px !important;
    }
}

/* تحسينات للموبايل الصغير */
@media screen and (max-width: 480px) {
    .emc-form {
        padding: 20px 15px !important;
        border-radius: 15px !important;
    }
    
    .emc-form input[type="text"],
    .emc-form input[type="tel"],
    .emc-form input[type="email"],
    .emc-form select,
    .emc-form textarea {
        font-size: 16px !important;
        padding: 15px !important;
    }

    .emc-form input[type="submit"] {
        font-size: 16px !important;
        padding: 18px 30px !important;
    }

    .emc-form-title {
        font-size: 22px !important;
    }
}

/* ========================================
   تصميم placeholder
   ======================================== */

.emc-form input::placeholder,
.emc-form textarea::placeholder {
    color: #9ca3af !important;
    opacity: 1 !important;
    font-style: italic !important;
    text-align: right !important;
    direction: rtl !important;
}

/* ========================================
   تحسين شكل الـ select مع دعم RTL
   ======================================== */

.emc-form select {
    appearance: none !important;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: left 20px center !important;
    background-size: 20px !important;
    padding-left: 55px !important;
    padding-right: 20px !important;
    color: #374151 !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    text-align: right !important;
    direction: rtl !important;
}

.emc-form select option {
    color: #374151 !important;
    background: white !important;
    padding: 12px !important;
    font-weight: normal !important;
    text-align: right !important;
    direction: rtl !important;
}

.emc-form select option:first-child {
    color: #9ca3af !important;
    font-style: italic !important;
}

.emc-form select:invalid {
    color: #9ca3af !important;
}

/* ========================================
   إزالة التداخل مع الثيم
   ======================================== */

.emc-form *,
.wpcf7-form .emc-form *,
div.wpcf7 .emc-form * {
    float: none !important;
    clear: none !important;
}

.emc-form .wpcf7-form-control-wrap,
.wpcf7-form .emc-form .wpcf7-form-control-wrap {
    width: 100% !important;
    display: block !important;
}

/* ========================================
   تأثيرات التحقق
   ======================================== */

.emc-form input:invalid:not(:placeholder-shown),
.emc-form select:invalid,
.emc-form textarea:invalid:not(:placeholder-shown) {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.emc-form input:valid:not(:placeholder-shown),
.emc-form select:valid,
.emc-form textarea:valid:not(:placeholder-shown) {
    border-color: #10b981 !important;
}

/* ========================================
   رسائل الأخطاء من Contact Form 7
   ======================================== */

.emc-form .wpcf7-not-valid-tip {
    color: #ef4444 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    margin-top: 8px !important;
    display: block !important;
    padding-right: 5px !important;
}

.emc-form .wpcf7-response-output {
    margin-top: 20px !important;
    padding: 15px 20px !important;
    border-radius: 10px !important;
    font-weight: 500 !important;
    text-align: center !important;
}

.emc-form .wpcf7-mail-sent-ok {
    background: linear-gradient(135deg, #10b981, #34d399) !important;
    color: white !important;
    border: none !important;
}

.emc-form .wpcf7-mail-sent-ng,
.emc-form .wpcf7-validation-errors {
    background: linear-gradient(135deg, #ef4444, #f87171) !important;
    color: white !important;
    border: none !important;
}

.emc-form .wpcf7-spam-blocked {
    background: linear-gradient(135deg, #f59e0b, #fbbf24) !important;
    color: white !important;
    border: none !important;
}

/* ========================================
   تأثير التحميل
   ======================================== */

.emc-form.wpcf7-submitting input[type="submit"] {
    background: #94a3b8 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

.emc-form.wpcf7-submitting input[type="submit"]:hover {
    background: #94a3b8 !important;
    transform: none !important;
    box-shadow: none !important;
}

/* ========================================
   تحسين accessibility
   ======================================== */

.emc-form input:focus-visible,
.emc-form select:focus-visible,
.emc-form textarea:focus-visible {
    outline: 2px solid #3b82f6 !important;
    outline-offset: 2px !important;
}

/* ========================================
   تحسينات خاصة بـ Contact Form 7
   ======================================== */

.emc-form .wpcf7-form-control-wrap {
    position: relative !important;
    display: block !important;
    width: 100% !important;
}

.emc-form .wpcf7-form-control {
    width: 100% !important;
}

/* Force Override لأي تداخل محتمل */
.emc-form[style] {
    display: flex !important;
}

@media screen and (min-width: 768px) {
    .emc-form[style*="column"] {
        flex-direction: row !important;
    }
}



/* ========================================
   تنسيقات الجداول (Tables)
   ======================================== */

/* 🎯 إصلاح عام لجميع الجداول في الموقع لتجنب كسر التخطيط في الموبايل */
table {
    width: 100%;
    border-collapse: collapse;
    overflow-x: auto;
    display: block;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1.5rem;
    border-radius: 8px;
}

/* تحسين مظهر الخلايا */
th, td {
    padding: 10px;
    text-align: center;
    border: 1px solid #ddd;
    white-space: nowrap;
}

/* شريط تمرير أفقي في الموبايل */
table::-webkit-scrollbar {
    height: 8px;
}

table::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

table::-webkit-scrollbar-track {
    background: #f5f5f5;
}

/* جعل الجدول قابل للتمرير فقط على الشاشات الصغيرة */
@media (max-width: 768px) {
    table {
        overflow-x: auto;
    }
}

/* ========================================
   نهاية ملف التنسيقات المخصصة
   ======================================== */
