/* ==========================================================================
   1. المتغيرات والتهيئة العامة (CSS Variables & Reset)
   ========================================================================== */
:root {
    /* لوحة الألوان المظلمة العصرية والراقية */
    --bg-primary: #0A0F14;       /* خلفية التطبيق العميقة والمريحة للعين */
    --bg-card: #141B22;          /* خلفية البطاقات والشاشات المنبثقة */
    --bg-button: #1E2630;        /* الخلفية الافتراضية للأزرار */
    
    /* الألوان التفاعلية الباستيل والنقية */
    --color-accent: #DEFF9A;      /* اللون الأساسي للبراند (أخضر ليموني مشع هادئ) */
    --color-text-main: #FAFAFA;   /* النص الأساسي شديد الوضوح */
    --color-text-muted: #A0AAB5;  /* النصوص الثانوية والوصفية */
    --color-success: #2ECC71;     /* لحالات النجاح والإجابات الصحيحة */
    --color-error: #E74C3C;       /* لحالات الأخطاء والتنبيهات */

    /* الخطوط المعتمدة للهوية */
    --font-display: 'Montserrat', sans-serif;
    --font-body: 'Tajawal', sans-serif;
}

/* تصفير الهوامش لضمان التوافق المطلق ومنع التمرير العشوائي */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* منع الوميض الأزرق عند اللمس في أندرويد */
    user-select: none;                        /* منع تحديد النصوص لتبدو كالتطبيق الأصلي */
}

body {
    background-color: var(--bg-primary);
    color: var(--color-text-main);
    font-family: var(--font-body);
    direction: rtl;
    min-height: 100vh;
    overflow: hidden; /* يمنع الـ Scroll تماماً للامتثال لـ Capacitor */
}

/* الحاوية الرئيسية الثابتة بمقاس الشاشة بالكامل */
#app-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    /* دعم الهواتف الحديثة التي تحتوي على نتوء الشاشة (Notch) */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* ==========================================================================
   2. إدارة الشاشات ونظام التنقل (Screen Management)
   ========================================================================== */
.app-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease-in-out;
    z-index: 1;
}

/* الشاشة النشطة حالياً تظهر وتصبح قابلة للتفاعل */
.app-screen.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 10;
}

/* إخفاء تام للشاشات غير النشطة */
.app-screen.hidden {
    display: none !important;
}

/* ==========================================================================
   3. القواعد المشتركة للبطاقات والشاشات الفرعية (Reusable UI Elements)
   ========================================================================== */
.screen-card {
    background-color: var(--bg-card);
    border: 1px solid rgba(222, 255, 154, 0.1); /* لمعان خفيف بلون البراند */
    border-radius: 24px;
    padding: 24px;
    width: 90%;
    max-width: 500px;
    margin: auto; /* لتوسيطها تماماً في الشاشة بواسطة Flexbox */
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.screen-card h2 {
    font-size: 24px;
    color: var(--color-accent);
    margin-bottom: 20px;
    text-align: center;
    font-weight: 700;
}

.screen-card h2 .en-title {
    font-family: var(--font-display);
    font-size: 18px;
    display: block;
    margin-top: 4px;
    color: var(--color-text-muted);
}

.card-content {
    font-size: 15px;
    line-height: 1.7;
    color: var(--color-text-muted);
    margin-bottom: 24px;
}

.card-content ul {
    margin-right: 20px;
    margin-top: 10px;
    margin-bottom: 10px;
}

.card-content li {
    margin-bottom: 12px;
}

.card-content strong {
    color: var(--color-text-main);
}

.text-center {
    text-align: center;
}

/* زر العودة الموحد للشاشات القانونية والفرعية */
.back-btn {
    width: 100%;
    background-color: var(--bg-button);
    color: var(--color-text-main);
    border: 1px solid rgba(250, 250, 250, 0.1);
    padding: 14px;
    border-radius: 14px;
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-btn:active {
    background-color: var(--color-accent);
    color: var(--bg-primary);
    transform: scale(0.98);
}