/* ====================================================================
   responsive.css — طبقة الريسبونسيف الشاملة (تُحمَّل آخر ملف CSS)
   تعمل مع RTL و LTR. Breakpoints:
   1280 laptop-small | 1100 tablet-landscape (القائمة تتحول لدرج)
   900 tablet | 768 | 600 phone-large | 480 phone | 360 phone-small
   ==================================================================== */

/* ---------- أساسيات: منع أي سكرول أفقي ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: clip; }
body { overflow-x: hidden; min-width: 320px; }
img, video, svg, canvas, iframe { max-width: 100%; }
img, video { height: auto; }
.container { width: 100%; padding-inline: clamp(16px, 4vw, 24px); }
h1, h2, h3, h4, p, li { overflow-wrap: break-word; }
.btn { max-width: 100%; }
.hero-title, .section-title h2, .page-header h1 { overflow-wrap: break-word; word-break: normal; }
pre, code { max-width: 100%; overflow-x: auto; }
table { max-width: 100%; }

/* اللمس: أهداف أكبر + إلغاء hover المزعج */
@media (hover: none) {
    .business-system-card:hover, .service-card:hover, .subsystem-card:hover,
    .blog-card:hover, .portfolio-card:hover { transform: none; }
}

/* ---------- شبكات مرنة بدون overflow ---------- */
.subsystems-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.blog-grid[style*="auto-fill"] { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)) !important; }
.services-grid > *, .subsystems-grid > *, .business-systems-grid > *,
.stats-grid > *, .testimonials-grid > *, .footer-grid > *, .blog-grid > *,
.portfolio-grid > *, .contact-grid > * { min-width: 0; }

/* ---------- صفحة التواصل (كانت inline بدون ريسبونسيف) ---------- */
.contact-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 50px; align-items: start; }

/* ====================================================================
   ≤ 1280  — لابتوب صغير: تصغير القائمة لتتسع بدون التفاف
   ==================================================================== */
@media (max-width: 1280px) {
    .nav-container { gap: 16px; }
    .nav-menu { gap: 2px; }
    .nav-link { padding: 9px 11px; font-size: 14px; }
    .nav-cta { padding: 10px 16px !important; font-size: 14px; margin-inline: 4px 0; }
    .nav-lang { margin-inline: 4px; }
    .lang-switch { padding: 7px 11px; font-size: 12px; }
    .logo-tagline { display: none; }
    .section-title h2, .why-content h2 { font-size: clamp(26px, 3.4vw, 40px); }
}

/* ====================================================================
   ≤ 1100 — تابلت أفقي: القائمة تصير درج جانبي (كانت 768 فقط)
   ==================================================================== */
@media (max-width: 1100px) {
    .navbar { padding: 12px 0; }
    .nav-container { flex-wrap: nowrap; }
    .nav-logo { min-width: 0; flex: 1 1 auto; }
    .logo-text { min-width: 0; }
    .logo-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }

    .nav-toggle {
        display: flex; flex: 0 0 auto; align-items: center; justify-content: center;
        width: 46px; height: 46px; padding: 0; border-radius: 12px;
        background: #eaf5ff; z-index: 1001; position: relative;
    }
    .nav-toggle span { width: 24px; height: 3px; background: #123a7b; }
    .nav-toggle.active span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .nav-toggle.active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

    .nav-menu {
        position: fixed; top: 0; bottom: auto;
        width: min(86vw, 380px); height: 100vh; height: 100dvh;
        flex-direction: column; align-items: stretch; justify-content: flex-start;
        gap: 4px; padding: 84px 20px 28px;
        background: #fff; border: 0; border-radius: 0;
        box-shadow: 0 0 60px rgba(8, 30, 70, .25);
        overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
        z-index: 1000; visibility: hidden;
        transition: right .35s ease, left .35s ease, visibility 0s linear .35s;
    }
    html[dir="rtl"] .nav-menu { right: -110%; left: auto; }
    html[dir="ltr"] .nav-menu { left: -110%; right: auto; }
    html[dir="rtl"] .nav-menu.active { right: 0; }
    html[dir="ltr"] .nav-menu.active { left: 0; }
    .nav-menu.active { visibility: visible; transition-delay: 0s; }

    .nav-menu > li { width: 100%; }
    .nav-menu .nav-link { display: flex; align-items: center; width: 100%; padding: 14px 16px; font-size: 16px; color: #123a7b; }
    .nav-link.active::after { display: none; }
    .nav-dropdown > a { justify-content: space-between; }
    .nav-dropdown > a i { margin: 0 !important; }
    .nav-dropdown.active > a i { transform: rotate(180deg); }

    .dropdown-menu {
        position: static; min-width: 0; width: 100%;
        background: #f3f9ff; border: 0; box-shadow: none; border-radius: 12px;
        max-height: 0; opacity: 0; visibility: visible; overflow: hidden;
        padding: 0 8px; transform: none;
        transition: max-height .4s ease, padding .3s ease, opacity .3s ease;
    }
    .nav-dropdown:hover .dropdown-menu { opacity: 0; visibility: visible; }
    .nav-dropdown.active .dropdown-menu { max-height: 70vh; opacity: 1; padding: 8px; overflow-y: auto; }
    .dropdown-item { padding: 12px; }

    .nav-lang { margin: 8px 0 !important; }
    .lang-switch { width: 100%; justify-content: center; padding: 12px; font-size: 14px; }
    .nav-cta { width: 100%; justify-content: center; margin: 8px 0 0 !important; padding: 14px 20px !important; }

    /* طبقة معتمة خلف الدرج */
    body.nav-open::after {
        content: ""; position: fixed; inset: 0; background: rgba(8, 24, 56, .45);
        backdrop-filter: blur(2px); z-index: 999;
    }

    /* شبكات */
    .hero-content { grid-template-columns: 1fr !important; gap: 36px; }
    .hero-text { text-align: center; width: 100%; max-width: 680px; margin-inline: auto; padding: 0; }
    .hero-desc { margin-inline: auto; }
    .hero-buttons, .hero-stats { justify-content: center; }
    .hero-visual { max-width: 620px; width: 100%; margin-inline: auto; }
    .why-choose, .service-hero-grid, .contact-grid { grid-template-columns: 1fr; gap: 36px; }
    .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
}

/* ====================================================================
   ≤ 900 — تابلت عمودي
   ==================================================================== */
@media (max-width: 900px) {
    .section { padding: 64px 0; }
    .hero { min-height: auto; padding: 108px 0 60px; }
    .services-grid, .testimonials-grid, .blog-grid, .portfolio-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .service-card.featured { grid-column: 1 / -1; grid-template-columns: 1fr; padding: 32px; gap: 24px; }
    .service-card.featured .featured-image { height: 200px; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
    .system-detail-card { grid-template-columns: 1fr; gap: 18px; padding: 28px; }
    .systems-bottom-cta { flex-direction: column; align-items: flex-start; }
    .page-header { padding: 118px 0 52px; }
    .cta-card { padding: 48px 26px; border-radius: 26px; }
}

/* ====================================================================
   ≤ 768
   ==================================================================== */
@media (max-width: 768px) {
    .section { padding: 56px 0; }
    .section-title { margin-bottom: 32px; }
    .hero-title { font-size: clamp(30px, 8vw, 44px); }
    .hero-subtitle { font-size: 18px; margin-bottom: 18px; }
    .hero-desc { font-size: 15.5px; margin-bottom: 24px; }
    .hero-stats { flex-wrap: wrap; gap: 18px 24px; }
    .hero-stat { text-align: center; }
    [dir="ltr"] .hero-stat { text-align: center; border: 0; padding: 0; }
    .hero-scroll-cue { display: none; }

    .form-row { grid-template-columns: 1fr; gap: 0; }
    .contact-form, .generic-form, .blog-single { padding: 24px 18px; border-radius: 20px; }
    .form-control { font-size: 16px; } /* يمنع تكبير iOS التلقائي عند التركيز */

    .modal-overlay { padding: 12px; align-items: flex-end; }
    .modal-box { padding: 28px 20px; border-radius: 22px; max-height: 92vh; max-height: 92dvh; }
    .modal-features ul { grid-template-columns: 1fr; }

    .footer-bottom { flex-direction: column; gap: 10px; text-align: center; }
    .floating-actions { bottom: 16px; }
    html[dir="rtl"] .floating-actions { right: 14px; left: auto; }
    html[dir="ltr"] .floating-actions { left: auto; right: 14px; }
    .float-btn { width: 50px; height: 50px; font-size: 20px; }
}

/* ====================================================================
   ≤ 600 — موبايل كبير
   ==================================================================== */
@media (max-width: 600px) {
    .services-grid, .testimonials-grid, .blog-grid, .portfolio-grid,
    .business-systems-grid, .specialized-grid, .process-grid, .subsystems-grid { grid-template-columns: minmax(0, 1fr); }
    .footer-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
    .service-card { padding: 28px 22px; }
    .service-card.featured { padding: 26px 20px; }
    .service-card.featured .service-title { font-size: 22px; }
    .subsystem-card { padding: 28px 20px; }
    .system-detail-card { padding: 22px 18px; }
    .system-detail-content h2 { font-size: 22px; }
    .system-feature-list { grid-template-columns: minmax(0, 1fr); }
    .saudi-readiness { grid-template-columns: minmax(0, 1fr); padding: 20px; }
    .page-header { padding: 104px 0 44px; }
    .breadcrumb { font-size: 13px; gap: 6px; }
    .cta-card { padding: 38px 18px; border-radius: 22px; }
    .hero-buttons { flex-direction: column; align-items: stretch; margin-bottom: 28px; }
    .hero-buttons .btn { width: 100%; justify-content: center; }
    .systems-bottom-cta .btn, .cta-card .btn { width: 100%; justify-content: center; }
    .hero-visual { min-height: 330px; }
    .dashboard-window { transform: none; }
    .visual-orbit { display: none; }
    .stat-value { font-size: 32px; }
    .contact-grid { gap: 28px; }
}

/* ====================================================================
   ≤ 480 — موبايل
   ==================================================================== */
@media (max-width: 480px) {
    .section { padding: 48px 0; }
    .stats-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
    .stat-item { padding: 18px 10px; }
    .logo-title { font-size: 14px; max-width: 46vw; }
    .ticnexa-logo-wrap { width: 38px; height: 38px; flex-basis: 38px; }
    .navbar { padding: 10px 0; }
    .nav-toggle { width: 42px; height: 42px; }
    .hero { padding: 96px 0 48px; }
    .hero-visual { min-height: 300px; }
    .floating-chip { display: none; }          /* بطاقات عائمة تسبب قص على الشاشات الضيقة */
    .metric-grid { gap: 8px; }
    .btn { padding-inline: 18px; }
    .section-title h2, .why-content h2 { font-size: clamp(24px, 7vw, 30px); }
    .page-header h1 { font-size: clamp(26px, 8vw, 34px); }
    .blog-single-content h3 { font-size: 19px; }
    .social-link { width: 40px; height: 40px; }
}

/* ====================================================================
   ≤ 360 — موبايل صغير جدًا
   ==================================================================== */
@media (max-width: 360px) {
    .stats-grid { grid-template-columns: minmax(0, 1fr); }
    .hero-stats { gap: 14px; }
    .dashboard-rail { display: none; }
    .logo-title { max-width: 40vw; font-size: 13px; }
    .contact-form, .generic-form { padding: 20px 14px; }
}

/* ====================================================================
   شاشات عريضة جدًا
   ==================================================================== */
@media (min-width: 1600px) {
    .container { max-width: 1440px; }
}

/* ====================================================================
   شاشات أفقية قصيرة (موبايل landscape)
   ==================================================================== */
@media (max-height: 500px) and (orientation: landscape) {
    .hero { min-height: auto; padding: 90px 0 40px; }
    .nav-menu { padding-top: 70px; }
    .modal-box { max-height: 96vh; }
}

/* احترام تفضيل تقليل الحركة */
@media (prefers-reduced-motion: reduce) {
    .hero-3d-cube, .floating-chip, .orb, .logo-icon { animation: none !important; }
}
