/* ======================================================================
   EzzPRX Design System
   نظام تصميم موحّد — يستبدل الأنماط الـinline التي كانت مكررة في كل صفحة.
   منظَّم بالأقسام: Tokens → Base → Navigation → Ticker → Utilities →
   Footer → Floating Buttons → Assistant → Legal Pages → Page Components
   ====================================================================== */

/* ============ 1) Design Tokens ============ */
:root {
    /* الألوان الأساسية */
    --void: #0A0C12;
    --surface: #12151E;
    --surface-2: #171B27;
    --elevated: #1D2230;
    --hairline: #262B3A;
    --border-soft: rgba(255, 255, 255, 0.07);
    --text-1: #F3F4F7;
    --text-2: #9AA1B4;
    --text-3: #7E869B; /* رُفع من #656C7E — كان يعطي تبايناً ~3.5:1 على --void فقط، أقل من 4.5:1 المطلوب لنص WCAG AA العادي */

    /* اللون الأساسي للعلامة أزرق (--gold تسمية موروثة من نسخة سابقة، أُبقيت
       لتفادي كسر عشرات الاستخدامات الحالية؛ --brand-blue* هو الاسم الدقيق
       الذي يُستخدم في أي CSS جديد من الآن فصاعداً) */
    --gold: #0B7EEF;
    --gold-bright: #4FA6FF;
    --gold-soft: rgba(11, 126, 239, 0.12);
    --brand-blue: var(--gold);
    --brand-blue-bright: var(--gold-bright);
    --brand-blue-soft: var(--gold-soft);

    --emerald: #22B378;
    --emerald-soft: rgba(34, 179, 120, 0.13);
    --coral: #E5555F;
    --coral-soft: rgba(229, 85, 95, 0.13);
    --whatsapp-green: #25d366;

    /* الطباعة */
    --font-display: 'Almarai', 'IBM Plex Sans Arabic', sans-serif;
    --font-body: 'IBM Plex Sans Arabic', 'Almarai', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;

    /* مقياس أحجام الخط */
    --fs-xs: .78rem;
    --fs-sm: .88rem;
    --fs-base: 1rem;
    --fs-lg: 1.15rem;
    --fs-xl: 1.4rem;
    --fs-2xl: clamp(1.6rem, 3vw, 2.2rem);
    --fs-3xl: clamp(1.9rem, 4.2vw, 2.9rem);
    --fs-4xl: clamp(2.1rem, 5vw, 3.4rem);

    /* مقياس التباعد */
    --space-1: .25rem;
    --space-2: .5rem;
    --space-3: .75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 2.75rem;
    --space-8: 3.5rem;
    --space-10: 5.5rem;

    /* نصف القطر */
    --r-lg: 26px;
    --r-md: 16px;
    --r-sm: 10px;

    /* الظلال */
    --shadow-sm: 0 6px 18px rgba(11, 126, 239, 0.28);
    --shadow-md: 0 10px 26px rgba(11, 126, 239, 0.4);
    --shadow-lg: 0 20px 45px rgba(0, 0, 0, 0.45);
    --shadow-xl: 0 20px 55px rgba(0, 0, 0, 0.5);

    /* إعادة تعريف ألوان Bootstrap الافتراضية لتتبع نفس الهوية تلقائياً في أي صفحة */
    --bs-primary: #0B7EEF;
    --bs-primary-rgb: 11, 126, 239;
    --bs-success: #22B378;
    --bs-success-rgb: 34, 179, 120;
    --bs-danger: #E5555F;
    --bs-danger-rgb: 229, 85, 95;
    --bs-info: #4B9FD8;
    --bs-info-rgb: 75, 159, 216;
    --bs-warning: #D89A4B;
    --bs-warning-rgb: 216, 154, 75;
    --bs-body-bg: #0A0C12;
    --bs-body-color: #F3F4F7;
}

/* ============ 2) Base ============ */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--void);
    color: var(--text-1);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-top: 108px;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    text-wrap: balance;
}

a {
    color: inherit;
}

::selection {
    background: var(--gold-soft);
    color: var(--gold-bright);
}

/* فوكس مرئي واضح لإتاحة لوحة المفاتيح */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

.btn-outline-primary {
    --bs-btn-color: var(--bs-primary);
    --bs-btn-border-color: var(--bs-primary);
    --bs-btn-hover-bg: var(--bs-primary);
    --bs-btn-hover-border-color: var(--bs-primary);
    --bs-btn-hover-color: #ffffff;
    --bs-btn-active-bg: var(--bs-primary);
    --bs-btn-active-border-color: var(--bs-primary);
}

.btn-ghost {
    border: 1px solid var(--hairline);
    color: var(--text-1);
    background: transparent;
    font-weight: 600;
    border-radius: var(--r-sm);
    transition: all .15s ease;
}

    .btn-ghost:hover {
        border-color: var(--text-2);
        background: rgba(255, 255, 255, 0.04);
        color: var(--text-1);
    }

.btn-gold {
    background: linear-gradient(135deg, var(--gold-bright), var(--gold));
    color: #ffffff !important;
    font-weight: 700;
    border: none;
    border-radius: var(--r-sm);
    transition: all .18s ease;
    box-shadow: var(--shadow-sm);
}

    .btn-gold:hover {
        transform: translateY(-1px);
        box-shadow: var(--shadow-md);
        color: #ffffff;
    }

/* ============ 3) القائمة العلوية ============ */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(10, 12, 18, 0.88) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-soft);
    z-index: 1030;
    padding-top: .65rem;
    padding-bottom: .65rem;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: var(--fs-xl);
    color: var(--text-1) !important;
    letter-spacing: -0.3px;
    text-decoration: none;
}

.brand-mark-icon {
    width: 34px;
    height: 34px;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 4px 10px rgba(11, 126, 239, 0.35));
}

.nav-link {
    color: var(--text-2) !important;
    font-weight: 600;
    font-size: .92rem;
    padding: .5rem .9rem !important;
    border-radius: var(--r-sm);
    transition: all .15s ease;
}

    .nav-link:hover, .nav-link:focus {
        color: var(--text-1) !important;
        background: rgba(255, 255, 255, 0.04);
    }

/* ============ Mega menu (Product / Solutions) — يعتمد على Bootstrap Dropdown الجاهز ============ */
.dropdown-menu.mega-menu {
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-xl);
    padding: var(--space-4);
}

@media (min-width: 992px) {
    .dropdown-menu.mega-menu {
        width: min(560px, 90vw);
        /* تثبيت الموضع يدوياً بدل الاعتماد على Popper، الذي لا يحترم dir="rtl" هنا فيدفع القائمة خارج الشاشة */
        top: 100% !important;
        bottom: auto !important;
        inset-inline-start: 0 !important;
        inset-inline-end: auto !important;
        transform: none !important;
        margin-top: .6rem;
    }

    /* .show فقط — كي لا يُلغي هذا القاعدة إخفاء Bootstrap الافتراضي (display:none) للقائمة قبل فتحها */
    .dropdown-menu.mega-menu.show {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-1) var(--space-4);
    }
}

.mega-menu-link {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--r-sm);
    text-decoration: none;
    color: var(--text-1);
    transition: background .15s ease;
}

    .mega-menu-link:hover {
        background: rgba(255, 255, 255, 0.04);
    }

    .mega-menu-link i {
        font-size: 1.1rem;
        color: var(--gold-bright);
        margin-top: .2rem;
        flex-shrink: 0;
    }

.mega-menu-link-title {
    font-weight: 700;
    font-size: .88rem;
    color: var(--text-1);
    display: block;
}

.mega-menu-link-desc {
    font-size: .76rem;
    color: var(--text-3);
    display: block;
    margin-top: .1rem;
}

.lang-flag {
    width: 18px;
    height: 18px;
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

@media (max-width: 991.98px) {
    .navbar-collapse {
        background: var(--surface);
        padding: 1.25rem;
        border-radius: var(--r-md);
        margin-top: .75rem;
        border: 1px solid var(--hairline);
    }
}

/* ============ 4) شريط السوق الحي (Ticker Tape) ============ */
.market-strip {
    position: fixed;
    top: 60px;
    width: 100%;
    z-index: 1025;
    background: var(--surface);
    border-bottom: 1px solid var(--hairline);
    overflow: hidden;
    height: 40px;
    display: flex;
    align-items: center;
}

.market-strip-track {
    display: flex;
    width: max-content;
    animation: tickerScroll 55s linear infinite;
    white-space: nowrap;
}

.market-strip:hover .market-strip-track {
    animation-play-state: paused;
}

@keyframes tickerScroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

html[dir="rtl"] .market-strip-track {
    animation-name: tickerScrollRtl;
}

@keyframes tickerScrollRtl {
    from { transform: translateX(0); }
    to { transform: translateX(50%); }
}

.ticker-item {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: 0 1.35rem;
    font-family: var(--font-mono);
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-2);
    border-left: 1px solid var(--hairline);
}

html[dir="rtl"] .ticker-item {
    border-left: none;
    border-right: 1px solid var(--hairline);
}

.ticker-item .ticker-name {
    font-family: var(--font-body);
    color: var(--text-1);
    font-weight: 600;
}

.ticker-item .ticker-value {
    color: var(--emerald);
}

.ticker-item .ticker-arrow {
    color: var(--emerald);
    font-size: .7rem;
}

/* ============ 5) عناصر عامة قابلة لإعادة الاستخدام بكل الصفحات ============ */
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--gold-bright);
    background: var(--gold-soft);
    border: 1px solid rgba(11, 126, 239, 0.25);
    padding: .45rem 1rem;
    border-radius: 30px;
}

.section-pad {
    padding: var(--space-10) 0;
}

@media (max-width: 767.98px) {
    .section-pad {
        padding: var(--space-8) 0;
    }
}

.section-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: var(--fs-2xl);
    color: var(--text-1);
    text-align: center;
}

.section-subtitle {
    color: var(--text-2);
    max-width: 560px;
    text-align: center;
    line-height: 1.8;
    margin: .6rem auto 0;
}

/* عنوان/فقرة الـHero — يُستخدم في الرئيسية وصفحات القطاعات وأي صفحة هيرو مستقبلية */
.hero-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: var(--fs-4xl);
    line-height: 1.25;
    color: var(--text-1);
    margin: 1.25rem 0 1.1rem;
    letter-spacing: -0.5px;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-2);
    max-width: 640px;
    margin: 0 auto;
    line-height: 1.8;
}

    .hero-subtitle.text-start {
        margin-inline: 0;
    }

.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }

.font-mono {
    font-family: var(--font-mono);
}

.divider-fade {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--hairline) 20%, var(--hairline) 80%, transparent);
    border: none;
}

/* بطاقة عامة (تُستخدم في صفحات التسعير/القطاعات/ZATCA الجديدة) */
.ez-card {
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--r-lg);
    padding: var(--space-6);
    transition: all .2s ease;
}

    .ez-card:hover {
        transform: translateY(-4px);
        border-color: rgba(11, 126, 239, 0.3);
        background: var(--surface-2);
    }

.stat-tile {
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--r-md);
    padding: var(--space-5);
    text-align: center;
}

.stat-tile .stat-number {
    font-family: var(--font-mono);
    font-size: clamp(1.8rem, 3.5vw, 2.5rem);
    font-weight: 700;
    color: var(--gold-bright);
}

.stat-tile .stat-label {
    color: var(--text-3);
    font-size: .85rem;
    margin-top: .3rem;
}

/* ============ 6) فوتر ============ */
footer {
    background: #07080D;
    border-top: 1px solid var(--hairline);
    margin-top: auto;
}

    footer a {
        font-size: .88rem;
        color: var(--text-2);
        text-decoration: none;
        transition: color .15s ease;
    }

        footer a:hover {
            color: var(--gold-bright);
        }

.footer-heading {
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-3);
    margin-bottom: var(--space-3);
}

.footer-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

.social-links a {
    font-size: 1.05rem;
    display: inline-flex;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--hairline);
    transition: all .18s ease;
}

    .social-links a:hover {
        transform: translateY(-2px);
        border-color: var(--gold);
        color: var(--gold-bright);
    }

/* ============ 7) أزرار عائمة (واتساب / المساعد الذكي) ============ */
.floating-whatsapp {
    position: fixed;
    bottom: 25px;
    inset-inline-end: 25px;
    background-color: var(--whatsapp-green);
    color: white;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.32);
    z-index: 1000;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

    .floating-whatsapp:hover {
        transform: scale(1.1) rotate(10deg);
        color: white;
    }

.assistant-fab {
    position: fixed;
    bottom: 92px;
    inset-inline-end: 25px;
    background: linear-gradient(135deg, var(--gold-bright), var(--gold));
    color: #ffffff;
    width: 54px;
    height: 54px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: var(--shadow-sm);
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

    .assistant-fab:hover {
        transform: scale(1.1);
    }

.assistant-panel {
    position: fixed;
    bottom: 156px;
    inset-inline-end: 25px;
    width: min(340px, calc(100vw - 50px));
    height: min(480px, calc(100vh - 200px));
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-xl);
    z-index: 1040;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

    .assistant-panel.show {
        display: flex;
    }

.assistant-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .9rem 1rem;
    background: var(--surface-2);
    border-bottom: 1px solid var(--hairline);
}

.assistant-panel-title {
    font-weight: 700;
    font-size: .95rem;
    color: var(--text-1);
}

.assistant-panel-subtitle {
    font-size: .74rem;
    color: var(--text-3);
    margin-top: .1rem;
}

.assistant-panel-close {
    background: none;
    border: none;
    color: var(--text-3);
    padding: .3rem;
}

.assistant-panel-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

.assistant-msg {
    max-width: 85%;
    padding: .55rem .8rem;
    border-radius: var(--r-sm);
    font-size: .85rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

.assistant-msg.user {
    align-self: flex-end;
    background: var(--gold-soft);
    color: var(--text-1);
}

.assistant-msg.bot {
    align-self: flex-start;
    background: var(--elevated);
    color: var(--text-2);
}

.assistant-panel-inputbar {
    display: flex;
    gap: .5rem;
    padding: .75rem;
    border-top: 1px solid var(--hairline);
    background: var(--surface-2);
}

.assistant-panel-input {
    flex: 1;
    background: var(--void);
    border: 1px solid var(--hairline);
    border-radius: var(--r-sm);
    color: var(--text-1);
    padding: .5rem .75rem;
    font-size: .85rem;
}

    .assistant-panel-input:focus {
        outline: none;
        border-color: var(--gold);
    }

.assistant-panel-send {
    background: linear-gradient(135deg, var(--gold-bright), var(--gold));
    color: #ffffff;
    border: none;
    border-radius: var(--r-sm);
    width: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .assistant-panel-send:disabled {
        opacity: .6;
    }

/* ============ 8) مقالات قانونية (خصوصية / شروط) ============ */
.legal-page {
    padding: 4rem 0 5rem;
}

.legal-header {
    text-align: center;
    margin-bottom: 3rem;
}

.legal-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(1.9rem, 4vw, 2.6rem);
    color: var(--text-1);
}

.legal-updated {
    color: var(--text-3);
    font-size: .85rem;
    margin-top: .6rem;
    font-family: var(--font-mono);
}

.legal-card {
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--r-lg);
    padding: 2.75rem;
}

@media (max-width: 576px) {
    .legal-card {
        padding: 1.5rem;
    }
}

.legal-card p {
    color: var(--text-2);
    line-height: 1.9;
    font-size: .98rem;
}

.legal-card h2 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-1);
    margin-top: 2.25rem;
    margin-bottom: 1rem;
    padding-top: 1.75rem;
    border-top: 1px solid var(--hairline);
}

.legal-card p:first-child {
    margin-top: 0;
}

.legal-card h2:first-child {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

.legal-card ul {
    color: var(--text-2);
    line-height: 1.9;
    padding-inline-start: 1.4rem;
}

    .legal-card ul li {
        margin-bottom: .5rem;
    }

.legal-card a {
    color: var(--gold-bright);
    font-weight: 600;
    text-decoration: none;
}

    .legal-card a:hover {
        text-decoration: underline;
    }

.legal-footnote {
    text-align: center;
    color: var(--text-3);
    font-size: .85rem;
    margin-top: 2.5rem;
}
