/* =============================================
 *  reset.css - إعادة تعيين التنسيقات الافتراضية
 * =============================================
 * هذا الملف يقوم بإعادة تعيين جميع تنسيقات المتصفح
 * الافتراضية لتوحيد الشكل عبر جميع المتصفحات.
 * =============================================
 */

/* =============================================
 * 1.  تعيين box-sizing لجميع العناصر
 * =============================================
 * استخدام border-box يضمن أن الحواف والهوامش
 * الداخلية تُحتسب ضمن أبعاد العنصر.
 */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* =============================================
 * 2.  تنسيق الصفحة الأساسي
 * =============================================
 * تعيين العرض الكامل، التمرير السلس، وضبط الخط
 * الأساسي للصفحة.
 */
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 16px;
    /* يمكن تغييرها حسب الحاجة */
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    /* دعم الـ dynamic viewport في المتصفحات الحديثة */
    font-family: var(--font-family, 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-text, #F8FAFC);
    background: var(--color-background, #0B0F17);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

/* =============================================
 * 3.  إعادة تعيين الروابط
 * =============================================
 * إزالة التزيين الافتراضي وإضافة لون أساسي.
 */
a {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

a:hover,
a:focus {
    text-decoration: none;
}

a:focus-visible {
    outline: 2px solid var(--color-primary, #CDFC8A);
    outline-offset: 2px;
}

/* =============================================
 * 4.  تنسيق النصوص والعناوين
 * =============================================
 * إزالة الهوامش الافتراضية وتوحيد أحجام الخطوط.
 */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-size: inherit;
    font-weight: inherit;
    line-height: 1.2;
    margin: 0;
}

p {
    margin: 0;
}

/* =============================================
 * 5.  القوائم
 * =============================================
 * إزالة التعداد والنقاط الافتراضية.
 */
ul,
ol {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* =============================================
 * 6.  الصور والوسائط
 * =============================================
 * جعل الصور تتكيف مع عرض الحاوية الخاصة بها.
 */
img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* =============================================
 * 7.  الأزرار
 * =============================================
 * إزالة الخلفية والحدود الافتراضية مع الاحتفاظ
 * بمؤشر اليد.
 */
button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
    padding: 0;
    margin: 0;
}

button:focus-visible {
    outline: 2px solid var(--color-primary, #CDFC8A);
    outline-offset: 2px;
}

/* =============================================
 * 8.  حقول الإدخال والنماذج
 * =============================================
 * توحيد تنسيق حقول الإدخال وإزالة الحدود
 * والخلفيات الافتراضية.
 */
input,
textarea,
select,
button {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}

input,
textarea,
select {
    border: none;
    outline: none;
    background: none;
    margin: 0;
    padding: 0;
    width: 100%;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px var(--color-glass, #161F2E) inset !important;
    -webkit-text-fill-color: var(--color-text, #F8FAFC) !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* إزالة زر إظهار كلمة المرور في Edge/IE */
::-ms-reveal {
    display: none;
}

/* =============================================
 * 9.  الجداول
 * =============================================
 * توحيد تنسيق الجداول وإزالة المسافات
 * والحدود الافتراضية.
 */
table {
    border-collapse: collapse;
    border-spacing: 0;
    width: 100%;
}

th,
td {
    padding: 0;
    text-align: start;
}

/* =============================================
 * 10.  العناصر الداخلية (Blockquotes, HR, etc.)
 * =============================================
 * إعادة تعيين تنسيق العناصر الأخرى.
 */
blockquote,
figure,
hr {
    margin: 0;
    padding: 0;
}

hr {
    border: none;
    border-top: 1px solid var(--color-border, rgba(255, 255, 255, 0.12));
    height: 0;
}

/* =============================================
 * 11.  التحديد (Selection)
 * =============================================
 * تخصيص لون تحديد النص.
 */
::selection {
    background: var(--color-primary, #CDFC8A);
    color: var(--color-background, #0B0F17);
}

::-moz-selection {
    background: var(--color-primary, #CDFC8A);
    color: var(--color-background, #0B0F17);
}

/* =============================================
 * 12.  إخفاء شريط التمرير في WebKit (اختياري)
 * =============================================
 * للحفاظ على نظافة التصميم، يمكن إظهاره عند الحاجة.
 * يمكن تفعيله حسب الحاجة.
 */
/* 
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--color-muted, #94A3B8);
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text, #F8FAFC);
}
*/

/* =============================================
 * 13. ♿ دعم ضعف البصر (Reduced Motion)
 * =============================================
 * احترام تفضيلات المستخدم للحركة المخففة.
 */
@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;
    }
}

/* =============================================
 * 14.  دعم الاتجاه من اليمين لليسار (RTL)
 * =============================================
 * ضبط تلقائي عند وجود dir="rtl" على html.
 */
html[dir="rtl"] {
    direction: rtl;
}

html[dir="rtl"] th,
html[dir="rtl"] td {
    text-align: right;
}

/* =============================================
 * 15.  تنسيق الطباعة (Print)
 * =============================================
 * إزالة الخلفيات والظلال عند الطباعة.
 */
@media print {
    *,
    *::before,
    *::after {
        background: transparent !important;
        color: #000 !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    body {
        background: #fff !important;
        color: #000 !important;
    }

    a[href]::after {
        content: " (" attr(href) ")";
    }
}

/* =============================================
 * 16.  منع انزلاق المحتوى عند ظهور شريط التمرير
 * =============================================
 * الحفاظ على عرض ثابت للصفحة.
 */
html {
    scrollbar-gutter: stable;
}

/* =============================================
 * 17.  دعم الوضع المظلم (Dark Mode) الافتراضي
 * =============================================
 * إذا كان التصميم يدعم الوضع المظلم فقط.
 */
@media (prefers-color-scheme: light) {
    body {
        background: var(--color-background, #0B0F17);
        color: var(--color-text, #F8FAFC);
    }
}

/* =============================================
 * 18.  تخصيص التركيز لسهولة الوصول
 * =============================================
 * تحسين ظهور حالة التركيز للمستخدمين الذين
 * يتنقلون باستخدام لوحة المفاتيح.
 */
:focus-visible {
    outline: 2px solid var(--color-primary, #CDFC8A);
    outline-offset: 2px;
}

/* =============================================
 * 19.  إعادة تعيين التفاف النص
 * =============================================
 * منع الكلمات الطويلة من كسر التنسيق.
 */
* {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* =============================================
 * 20.  تنسيق العناصر المضمنة
 * =============================================
 * تحسين عرض العناصر المضمنة.
 */
code,
kbd,
samp,
pre {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9em;
}

pre {
    white-space: pre-wrap;
    word-break: break-all;
}

/* =============================================
 * 21.  منع تحديد النص عند السحب
 * =============================================
 * تحسين تجربة المستخدم.
 */
.no-select {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* =============================================
 * 22.  تحسين التمرير للعناصر التي تتجاوز الحدود
 * =============================================
 */
.overflow-auto {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

/* =============================================
 * 23.  دعم الوضع المظلم في جميع المتصفحات
 * =============================================
 */
:root {
    color-scheme: dark;
}

/* =============================================
 * 24.  تحسين التوافق مع الشاشات الصغيرة
 * =============================================
 */
@media (max-width: 640px) {
    html {
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
}