/* ==========================================================================
   RESET & MOBILE BASE (المرحلة 4: قواعد منع كسر الشكل)
   ========================================================================== */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-sans, "Cairo", sans-serif);
    background-color: var(--bg-page, #f8fafc);
    color: var(--text-main, #0f172a);
    line-height: 1.6;
    text-align: start;
    direction: rtl;
    min-width: 320px;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* منع تمدد النصوص الطويلة أو كسر الحاويات */
h1, h2, h3, h4, h5, h6, p, span, strong, a, label, dd, dt {
    overflow-wrap: anywhere;
    word-break: normal;
}

/* حل مشكلة flex / grid children التي لا تتقلص */
.flex > *, .grid > *, [class*="grid"] > *, [class*="flex"] > * {
    min-width: 0;
}

/* الصور والفيديو والأيقونات */
img, svg, video, canvas, audio, iframe, embed, object {
    display: block;
    max-width: 100%;
    height: auto;
}

/* الجداول والأطر الأفقية */
table {
    border-collapse: collapse;
    width: 100%;
}

/* الأزرار وحقول الإدخال */
button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    -webkit-tap-highlight-color: transparent;
}

button {
    cursor: pointer;
    background: none;
    border: none;
}

a {
    color: inherit;
    text-decoration: none;
}

/* منطقة لمس آمنة للأجهزة الذكية (44px min touch area) */
button, a.btn, a.button, input[type="button"], input[type="submit"], input[type="reset"] {
    min-height: var(--touch-min, 44px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* سهولة الاستخدام والحركة */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
