/* ============================================================
   modal-safe-area.css
   مودالات ملء الشاشة على الموبايل: حجز منطقة الـ notch / شريط الحالة
   (env(safe-area-inset-top)) أعلى المودال حتى لا يقع العنوان وزر الإغلاق
   تحتها. شريط علوى بارتفاع الـ inset (صفر على الديسكتوب والأجهزة بلا notch
   فلا أثر)، لا يمس padding الرأس الأصلى فى أى مودال.
   يُحمَّل بعد كل ملفات الـ CSS فى _Layout و _LayoutLegal.
   ============================================================ */
@supports (height: env(safe-area-inset-top)) {

    .modal-fullscreen .modal-content::before {
        content: "";
        display: block;
        flex: 0 0 auto;
        position: sticky;
        top: 0;
        z-index: 5;
        height: env(safe-area-inset-top, 0px);
        background: var(--primary-dark, #0f2538);
    }

    @media (max-width: 767.98px) {
        #fatwaDetailModal .modal-content::before {
            content: "";
            display: block;
            flex: 0 0 auto;
            position: sticky;
            top: 0;
            z-index: 5;
            height: env(safe-area-inset-top, 0px);
            background: var(--primary-dark, #0f2538);
        }
    }
}

/* ============================================================
   SweetAlert2 على الموبايل: يحترم الـ notch وشريط الحالة والحافة السفلية،
   ويحتوى النموذج داخل الشاشة بفراغات مضغوطة (الحقول القصيرة صفّان بدل صف).
   ============================================================ */
@media (max-width: 767.98px) {
    body .swal2-container {
        padding: calc(.5rem + env(safe-area-inset-top, 0px)) .5rem calc(.5rem + env(safe-area-inset-bottom, 0px));
    }

    body .swal2-popup {
        max-height: calc(100vh - 1rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        max-height: calc(100dvh - 1rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        overflow-y: auto;
        padding: .6rem .75rem .9rem;
        border-radius: 14px;
    }

    body .swal2-title {
        margin: 0;
        padding: .1rem 0 .4rem;
        font-size: 1.1rem;
        line-height: 1.4;
    }

    body .swal2-html-container {
        margin: .2rem 0 0;
        padding: 0;
        font-size: .9rem;
    }

    body .swal2-actions {
        width: 100%;
        margin: .7rem 0 0;
        gap: .5rem;
    }

        body .swal2-actions .swal2-styled {
            flex: 1 1 0;
            margin: 0;
            padding: .55rem .5rem;
            font-size: .95rem;
        }

    body .swal2-popup .lc-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .45rem .5rem;
    }

    body .swal2-popup .lc-field {
        margin-bottom: .5rem;
    }

    body .swal2-popup .lc-dialog .form-label {
        margin-bottom: .15rem;
        font-size: .8rem;
    }

    body .swal2-popup .lc-dialog .form-control,
    body .swal2-popup .lc-dialog .form-select {
        min-height: 36px;
        padding: .3rem .55rem;
    }

    body .swal2-popup .lc-dialog .alert {
        margin-top: .5rem !important;
        padding: .45rem .65rem;
        font-size: .78rem;
        line-height: 1.5;
    }
}

@media (max-width: 359.98px) {
    body .swal2-popup .lc-grid {
        grid-template-columns: 1fr;
    }
}
