/* نظام العرض المتجاوب للنماذج المدمجة - Responsive Forms System */

/* حاوي النماذج الأساسي */
.form-container-responsive {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 15px;
    box-sizing: border-box;
}

.form-container-responsive .embedded-form {
    width: 100%;
    margin: 20px 0;
}

/* تخطيط السوائل للنماذج */
.embedded-form.fluid-form {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* تحسين العناصر للشاشات العريضة */
@media (min-width: 1400px) {
    .form-container-responsive {
        max-width: 1200px;
    }
    
    .embedded-form {
        padding: 40px;
        border-radius: 16px;
        max-width: 1000px;
        margin: 0 auto;
    }
    
    .embedded-form .form-control,
    .embedded-form .form-select {
        padding: 15px 20px;
        margin-bottom: 15px;
        font-size: 16px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .embedded-form .btn-primary {
        padding: 18px 50px;
        font-size: 18px;
        max-width: 300px;
        width: 100%;
    }
    
    /* تحسين التخطيط للصفوف */
    .embedded-form .form-row {
        display: block;
        width: 100%;
        margin-bottom: 20px;
    }
    
    .embedded-form .form-col {
        width: 100%;
        max-width: 600px;
        margin: 0 auto 15px auto;
        display: block;
    }
}

/* تحسين للأجهزة اللوحية الكبيرة */
@media (min-width: 1024px) and (max-width: 1399px) {
    .form-container-responsive {
        max-width: 900px;
    }
    
    .embedded-form {
        padding: 35px;
    }
}

/* تحسين للأجهزة اللوحية */
@media (min-width: 768px) and (max-width: 1023px) {
    .form-container-responsive {
        max-width: 700px;
        padding: 0 20px;
    }
    
    .embedded-form {
        padding: 25px;
        margin: 15px auto;
        width: 100%;
        max-width: 650px;
    }
    
    .embedded-form .form-row {
        display: block;
        width: 100%;
        margin-bottom: 20px;
    }
    
    .embedded-form .form-col {
        width: 100%;
        max-width: 600px;
        margin: 0 auto 15px auto;
        display: block;
    }
    
    .embedded-form .form-control,
    .embedded-form .form-select {
        width: 100%;
        box-sizing: border-box;
    }
}

/* تحسين للهواتف الكبيرة */
@media (min-width: 481px) and (max-width: 767px) {
    .form-container-responsive {
        padding: 0 15px;
    }
    
    .embedded-form {
        padding: 20px;
        margin: 10px auto;
        border-radius: 10px;
        width: 100%;
        max-width: 100%;
    }
    
    .embedded-form .form-row {
        display: block;
    }
    
    .embedded-form .form-col {
        width: 100%;
        margin-bottom: 15px;
    }
    
    .embedded-form .form-control,
    .embedded-form .form-select {
        width: 100%;
        box-sizing: border-box;
        font-size: 16px;
    }
    
    .embedded-form .form-title {
        font-size: 22px;
        margin-bottom: 15px;
    }
    
    .embedded-form .form-description {
        font-size: 15px;
        margin-bottom: 20px;
    }
}

/* تحسين للهواتف الصغيرة */
@media (max-width: 480px) {
    .form-container-responsive {
        padding: 0 10px;
    }
    
    .embedded-form {
        padding: 15px;
        margin: 8px auto;
        border-radius: 8px;
        box-shadow: 0 1px 10px rgba(0,0,0,0.08);
        width: 100%;
        max-width: 100%;
    }
    
    .embedded-form .form-header {
        margin-bottom: 20px;
        padding-bottom: 15px;
    }
    
    .embedded-form .form-title {
        font-size: 20px;
        line-height: 1.3;
        margin-bottom: 10px;
    }
    
    .embedded-form .form-description {
        font-size: 14px;
        line-height: 1.4;
        margin-bottom: 15px;
    }
    
    .embedded-form .form-control,
    .embedded-form .form-select {
        padding: 12px 15px;
        font-size: 16px; /* منع zoom في iOS */
        border-radius: 6px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .embedded-form .btn-primary {
        width: 100%;
        padding: 15px;
        font-size: 16px;
        border-radius: 6px;
        margin-top: 10px;
    }
    
    .embedded-form .form-row {
        display: block;
        margin-bottom: 15px;
    }
    
    .embedded-form .form-col {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .embedded-form .form-check {
        padding: 10px;
        margin-bottom: 8px;
    }
    
    .embedded-form .form-check-label {
        font-size: 14px;
        line-height: 1.4;
    }
}

/* تحسينات خاصة للنماذج في المحتوى */
.page-content .embedded-form,
.article-content .embedded-form,
.content-formatted .embedded-form {
    margin: 30px 0;
    width: 100%;
    max-width: 100%;
}

/* تحسين النماذج داخل الأعمدة */
.col-md-6 .embedded-form,
.col-lg-4 .embedded-form,
.col-lg-6 .embedded-form {
    margin: 15px 0;
    padding: 20px;
}

@media (max-width: 768px) {
    .col-md-6 .embedded-form,
    .col-lg-4 .embedded-form,
    .col-lg-6 .embedded-form {
        padding: 15px;
        margin: 10px 0;
    }
}

/* تحسين النماذج في الشريط الجانبي */
.sidebar .embedded-form,
.widget .embedded-form {
    padding: 20px 15px;
    margin: 15px 0;
}

@media (max-width: 768px) {
    .sidebar .embedded-form,
    .widget .embedded-form {
        padding: 15px 10px;
        margin: 10px 0;
    }
}

/* تحسين النماذج الطويلة */
.embedded-form.long-form {
    max-height: 80vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #007cba #f1f1f1;
}

.embedded-form.long-form::-webkit-scrollbar {
    width: 6px;
}

.embedded-form.long-form::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.embedded-form.long-form::-webkit-scrollbar-thumb {
    background: #007cba;
    border-radius: 3px;
}

.embedded-form.long-form::-webkit-scrollbar-thumb:hover {
    background: #0056b3;
}

/* تحسين الطباعة */
@media print {
    .embedded-form {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
        margin: 20px 0;
    }
    
    .embedded-form .btn-primary {
        display: none;
    }
    
    .embedded-form .form-control,
    .embedded-form .form-select {
        border: 1px solid #000;
        background: transparent;
    }
}