/* =========================================
   style.css (Overrides / Compatibility Layer)
   هدف الملف ده:
   - الحفاظ على ستايل modern-style.css (ستايل en.html) كـ المصدر الأساسي
   - دعم RTL/LTR بشكل صحيح بدون ما نكسر الستايل
   - دعم بعض الصفحات القديمة اللي بتستخدم dropdown-menu بدل dropdown-content
========================================= */

/* Language-aware direction & fonts */
html[dir="rtl"] body {
    direction: rtl;
    text-align: right;
    font-family: 'Cairo', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html[dir="ltr"] body {
    direction: ltr;
    text-align: left;
    font-family: 'Inter', 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* RTL: mirror small horizontal micro-interactions */
html[dir="rtl"] .logo:hover .logo-text {
    transform: translateX(-5px);
}

html[dir="rtl"] .dropdown-item:hover {
    transform: translateX(-5px);
}

/* RTL: reverse icon/text order for common flex rows (keeps same colors/spacing) */
html[dir="rtl"] .btn,
html[dir="rtl"] .dropdown-item,
html[dir="rtl"] .benefits-list li,
html[dir="rtl"] .contact-item,
html[dir="rtl"] .sidebar-widget a {
    flex-direction: row-reverse;
}

/* RTL: typing caret should appear on the left */
html[dir="rtl"] .typing-animation {
    border-right: none !important;
    border-left: 3px solid var(--typing-caret-color, var(--primary)) !important;
}


/* RTL: make header layout feel natural (logo on the right) */
html[dir="rtl"] .navbar {
    flex-direction: row-reverse;
}

html[dir="rtl"] .nav-menu {
    flex-direction: row-reverse;
}

html[dir="rtl"] .nav-actions {
    flex-direction: row-reverse;
}


/* =========================================
   Compatibility: Top-level nav links without .nav-link
   (some inner pages had <a> without nav-link class)
========================================= */
.nav-menu > li > a:not(.nav-link) {
    position: relative;
    padding: 14px 24px;
    font-weight: 600;
    color: var(--gray);
    text-decoration: none;
    border-radius: var(--radius-full);
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

body.light-theme .nav-menu > li > a:not(.nav-link) {
    color: var(--day-text-secondary);
}

.nav-menu > li > a:not(.nav-link)::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0;
    border-radius: var(--radius-full);
    transition: var(--transition-normal);
    z-index: -1;
}

body.light-theme .nav-menu > li > a:not(.nav-link)::before {
    background: var(--day-gradient-primary);
}

.nav-menu > li > a:not(.nav-link)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: var(--transition-normal);
}

body.light-theme .nav-menu > li > a:not(.nav-link)::after {
    background: var(--day-gradient-primary);
}

.nav-menu > li > a:not(.nav-link):hover {
    color: var(--light);
    transform: translateY(-2px);
}

body.light-theme .nav-menu > li > a:not(.nav-link):hover {
    color: var(--day-text);
}

.nav-menu > li > a:not(.nav-link):hover::before {
    opacity: 0.1;
}

.nav-menu > li > a:not(.nav-link):hover::after {
    width: 60%;
}

.nav-menu > li > a.active:not(.nav-link) {
    color: var(--light);
    background: rgba(99, 102, 241, 0.1);
    box-shadow: var(--shadow-inner);
}

body.light-theme .nav-menu > li > a.active:not(.nav-link) {
    color: var(--day-text);
    background: rgba(79, 70, 229, 0.1);
}

.nav-menu > li > a.active:not(.nav-link)::before {
    opacity: 0.1;
}

.nav-menu > li > a.active:not(.nav-link)::after {
    width: 60%;
    box-shadow: 0 0 20px var(--primary-glow);
}

body.light-theme .nav-menu > li > a.active:not(.nav-link)::after {
    box-shadow: 0 0 20px rgba(79, 70, 229, 0.2);
}

/* =========================================
   Compatibility: Legacy dropdown markup (.dropdown-menu)
========================================= */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 280px;
    background: rgba(2, 6, 23, 0.95);
    backdrop-filter: var(--blur-xl);
    border-radius: var(--radius-xl);
    padding: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: var(--transition-normal);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-3xl);
    z-index: 1000;
    list-style: none;
}

body.light-theme .dropdown-menu {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--day-border);
    box-shadow: var(--day-shadow-2xl);
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--gray);
    text-decoration: none;
    border-radius: var(--radius-lg);
    transition: var(--transition-fast);
}

body.light-theme .dropdown-menu li a {
    color: var(--day-text-secondary);
}

.dropdown-menu li a:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-light);
    transform: translateX(5px);
}

body.light-theme .dropdown-menu li a:hover {
    background: rgba(79, 70, 229, 0.1);
    color: var(--day-primary);
}


.dropdown-menu li a.active {
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary-light);
}

body.light-theme .dropdown-menu li a.active {
    background: rgba(79, 70, 229, 0.12);
    color: var(--day-primary);
}

html[dir="rtl"] .dropdown-menu li a {
    flex-direction: row-reverse;
}

html[dir="rtl"] .dropdown-menu li a:hover {
    transform: translateX(-5px);
}

/* Mobile behavior for legacy dropdown-menu (match modern-style mobile dropdown-content behavior) */
@media (max-width: 768px) {
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        background: transparent;
        padding: 0;
        min-width: auto;
        display: none;
    }

    .dropdown:hover .dropdown-menu {
        display: block;
    }
}

/* =========================================
   Service Pages (pages/*.html)
   هدف الجزء ده: توحيد تنسيق صفحات الخدمات مع ستايل modern-style.css
========================================= */

.page-hero {
    position: relative;
    padding: 110px 0 60px;
    overflow: hidden;
}

.page-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(800px circle at 20% 20%, rgba(99, 102, 241, 0.25), transparent 55%),
                radial-gradient(700px circle at 80% 60%, rgba(168, 85, 247, 0.20), transparent 55%);
    pointer-events: none;
}

.page-hero .page-hero-content {
    position: relative;
    max-width: 860px;
}

.page-title {
    margin: 0 0 12px;
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 800;
    letter-spacing: -0.02em;
}

.page-description {
    margin: 0;
    color: var(--gray);
    font-size: 1.05rem;
    line-height: 1.8;
}

body.light-theme .page-description {
    color: var(--day-text-secondary);
}

.service-content {
    padding: 60px 0;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 28px;
    align-items: start;
}

.main-content {
    background: rgba(2, 6, 23, 0.55);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-2xl);
    padding: 28px;
    backdrop-filter: var(--blur-xl);
}

body.light-theme .main-content {
    background: rgba(255,255,255,0.78);
    border: 1px solid var(--day-border);
    box-shadow: var(--day-shadow-xl);
}

.main-content h2,
.main-content h3 {
    margin-top: 0;
}

.sidebar {
    position: sticky;
    top: 100px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sidebar-widget {
    background: rgba(2, 6, 23, 0.55);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-2xl);
    padding: 18px;
    backdrop-filter: var(--blur-xl);
}

body.light-theme .sidebar-widget {
    background: rgba(255,255,255,0.78);
    border: 1px solid var(--day-border);
    box-shadow: var(--day-shadow-xl);
}

.services-sidebar {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.services-sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: var(--gray);
    transition: var(--transition-fast);
    background: rgba(255,255,255,0.04);
}

body.light-theme .services-sidebar a {
    color: var(--day-text-secondary);
    background: rgba(2,6,23,0.03);
}

.services-sidebar a:hover {
    transform: translateY(-2px);
    background: rgba(99, 102, 241, 0.10);
    color: var(--primary-light);
}

body.light-theme .services-sidebar a:hover {
    background: rgba(79, 70, 229, 0.08);
    color: var(--day-primary);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 14px;
}

.feature {
    padding: 16px;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
}

body.light-theme .feature {
    border: 1px solid var(--day-border);
    background: rgba(2,6,23,0.02);
}

.feature-icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(99, 102, 241, 0.18);
    margin-bottom: 10px;
}

body.light-theme .feature-icon {
    background: rgba(79, 70, 229, 0.12);
}

.solutions-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 12px 0 12px;
}

.solution-tab {
    padding: 10px 14px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.03);
    cursor: pointer;
    user-select: none;
    font-weight: 700;
}

body.light-theme .solution-tab {
    border: 1px solid var(--day-border);
    background: rgba(2,6,23,0.02);
}

.solution-tab.active {
    background: rgba(99, 102, 241, 0.18);
    border-color: rgba(99, 102, 241, 0.35);
}

body.light-theme .solution-tab.active {
    background: rgba(79, 70, 229, 0.12);
    border-color: rgba(79, 70, 229, 0.22);
}

.solution-content {
    display: none;
    padding: 14px;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.02);
}

.solution-content.active {
    display: block;
}

.benefits-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.benefit {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-lg);
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
}

body.light-theme .benefit {
    background: rgba(2,6,23,0.02);
    border: 1px solid var(--day-border);
}

.hardware-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.hardware-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: var(--radius-xl);
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
}

body.light-theme .hardware-item {
    background: rgba(2,6,23,0.02);
    border: 1px solid var(--day-border);
}

body.light-theme .cta-section {
    background: rgba(79, 70, 229, 0.07);
    border: 1px solid rgba(79, 70, 229, 0.18);
}

/* Social icons: always inline */
.social-links {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Responsive tweaks */
@media (max-width: 1024px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: static;
    }
    .hardware-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .features-grid,
    .benefits-list {
        grid-template-columns: 1fr;
    }
    .hardware-grid {
        grid-template-columns: 1fr;
    }
}


/* Extra benefits cards */
.extra-benefits{
    margin-top:24px;
    padding-top:10px;
}
.extra-benefits .section-subtitle{margin-bottom:12px;}
.feature h4{
    margin: 0 0 6px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--light);
}
body.light-theme .feature h4{color: var(--day-text);}
.feature p{
    margin: 0;
    color: var(--gray);
    font-size: .95rem;
    line-height: 1.7;
}
body.light-theme .feature p{color: var(--day-text-secondary);} 

/* Chat widget (RTL/LTR) */
/* Keep the flex alignment stable (bot left / user right) by forcing message row to LTR,
   while keeping the text itself RTL when the page is Arabic. */
html[dir="rtl"] .chat-message{direction:ltr;}
html[dir="rtl"] .message-content{direction:rtl;text-align:right;unicode-bidi: plaintext;}

/* In Arabic, it feels more natural to keep the input on the right and send button on the left */
html[dir="rtl"] .chat-input{flex-direction:row-reverse;}
html[dir="rtl"] .chat-input input{direction:rtl;text-align:right;}

/* Scroll padding (works better across browsers) */
html[dir="rtl"] .chat-messages{padding-right:8px;padding-left:0;}

/* Quick replies styling */
.quick-replies{
    margin-top: 14px;
    padding: 12px;
    border-radius: var(--radius-lg);
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
}
body.light-theme .quick-replies{
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid var(--day-border);
}
.quick-replies h5{
    margin: 0 0 10px;
    font-size: .9rem;
    font-weight: 700;
    color: var(--light);
}
body.light-theme .quick-replies h5{color: var(--day-text);}
.quick-reply-buttons{
    display:flex;
    flex-wrap:wrap;
    gap: 8px;
}
.quick-reply-btn{
    appearance:none;
    border: 1px solid rgba(99, 102, 241, 0.25);
    background: rgba(99, 102, 241, 0.08);
    color: var(--light);
    padding: 10px 12px;
    border-radius: var(--radius-full);
    font-size: .85rem;
    cursor:pointer;
    transition: var(--transition-fast);
}
body.light-theme .quick-reply-btn{
    border: 1px solid rgba(79, 70, 229, 0.18);
    background: rgba(79, 70, 229, 0.08);
    color: var(--day-text);
}
.quick-reply-btn:hover{
    transform: translateY(-1px);
    border-color: rgba(99, 102, 241, 0.5);
    background: rgba(99, 102, 241, 0.16);
}
body.light-theme .quick-reply-btn:hover{
    border-color: rgba(79, 70, 229, 0.38);
    background: rgba(79, 70, 229, 0.14);
}

/* Ensure chat does not overlap safe areas on mobile */
@media (max-width: 480px){
  .chat-toggle{bottom:18px;right:18px;width:62px;height:62px;}
  .chat-widget{bottom:92px;right:18px;width:calc(100vw - 36px);}
}


/* =========================================
   تحسينات RTL عامة
========================================= */
html[dir="rtl"] ul,
html[dir="rtl"] ol{
  padding-right: 1.2rem;
  padding-left: 0;
}
html[dir="rtl"] .feature-list{
  padding-right: 0;
  padding-left: 0;
}
html[dir="rtl"] .feature-list li{
  gap: 10px;
  align-items: flex-start;
  line-height: 1.7;
}

/* =========================================
   تحسينات صفحة الموديولات
========================================= */
body.modules-page .page-hero .hero-content{
  max-width: 980px;
}
body.modules-page .services-grid{
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}
body.modules-page .service-card{
  padding: 28px;
}
body.modules-page .service-title{
  margin-top: 12px;
}
body.modules-page .benefits-list{
  margin-top: 14px;
}
body.modules-page .benefit{
  gap: 10px;
}
body.modules-page .verticals-grid .service-card{
  border: 1px solid rgba(99,102,241,0.16);
}
body.light-theme.modules-page .verticals-grid .service-card{
  border: 1px solid rgba(79,70,229,0.14);
}

/* =========================================
   تحسينات صفحة الأنشطة
========================================= */
body.industries-page .services-grid{
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
}
body.industries-page .service-card{
  padding: 26px;
}

/* =========================================
   تحسينات واجهة الدردشة (RTL + موبايل)
========================================= */
html[dir="rtl"] .chat-header{
  flex-direction: row-reverse;
}
html[dir="rtl"] .chat-title{
  flex-direction: row-reverse;
}
html[dir="rtl"] .chat-title span{
  text-align: right;
}

.message-content{
  word-break: break-word;
}
@media (max-width: 768px){
  .chat-widget{
    width: min(420px, calc(100vw - 32px));
    right: 16px;
    bottom: 96px;
  }
  .chat-messages{height: 260px;}
}
@media (max-width: 520px){
  .chat-widget{
    left: 16px;
    right: 16px;
    width: auto;
  }
  .chat-messages{height: 240px;}
}


/* Anchor offset under fixed header */
section [id], h2[id], h3[id]{scroll-margin-top: 120px;}


/* =========================
   FAQ (Module Landing Pages)
   ========================= */
.faq-list { display: grid; gap: 14px; }
.faq-item {
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 16px;
  background: rgba(255,255,255,0.03);
  overflow: hidden;
}
body.light-theme .faq-item{
  border-color: rgba(0,0,0,0.10);
  background: rgba(0,0,0,0.03);
}
.faq-item summary{
  cursor: pointer;
  list-style: none;
  padding: 16px 18px;
  font-weight: 700;
  color: var(--light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
body.light-theme .faq-item summary{ color: var(--day-text); }
.faq-item summary::-webkit-details-marker{ display:none; }
.faq-item summary::after{
  content: '\f078';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  opacity: 0.85;
  transition: transform 0.2s ease;
}
.faq-item[open] summary::after{ transform: rotate(180deg); }
.faq-answer{
  padding: 0 18px 18px 18px;
  color: var(--gray);
  line-height: 1.8;
}
body.light-theme .faq-answer{ color: var(--day-text-secondary); }



/* =========================
   Case Studies (Landing Pages)
   ========================= */
.case-studies-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}
.case-card{
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  background: rgba(255,255,255,0.03);
  padding: 22px;
}
body.light-theme .case-card{
  border-color: rgba(0,0,0,0.10);
  background: rgba(0,0,0,0.03);
}
.case-badge{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--light);
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.02);
}
body.light-theme .case-badge{
  color: var(--day-text);
  border-color: rgba(0,0,0,0.10);
  background: rgba(0,0,0,0.02);
}
.case-title{
  margin: 14px 0 8px 0;
  font-size: 1.15rem;
  line-height: 1.5;
}
.case-meta{
  margin: 0 0 14px 0;
  color: var(--gray);
  display: flex;
  align-items: center;
  gap: 10px;
}
body.light-theme .case-meta{ color: var(--day-text-secondary); }
.case-points{
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
  color: var(--gray);
  line-height: 1.75;
}
body.light-theme .case-points{ color: var(--day-text-secondary); }
.case-points strong{ color: var(--light); }
body.light-theme .case-points strong{ color: var(--day-text); }


/* Breadcrumb (v9) */
.breadcrumb{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 0.95rem;
  color: var(--gray);
}
.breadcrumb a{
  color: inherit;
  text-decoration: underline;
}
.breadcrumb span:last-child{
  color: var(--light);
}
.breadcrumb .breadcrumb-current{
  color: var(--light);
  text-decoration: none;
}

/* =========================================
   UI Fixes (Footer Social, Floating Buttons)
========================================= */

.footer .social-links {
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.float-whatsapp {
  position: fixed;
  bottom: 40px;
  left: 40px;
  width: 70px;
  height: 70px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #fff;
  background: #25D366;
  box-shadow: var(--shadow-glow);
  z-index: 1001;
  transition: var(--transition-normal);
}

.float-whatsapp:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: var(--shadow-2xl);
}

.float-whatsapp i { font-size: 30px; }

/* Prevent overlap: keep scroll-to-top away from chat button */
.scroll-top {
  bottom: 40px;
  right: 120px;
}

@media (max-width: 768px) {
  .float-whatsapp { bottom: 18px; left: 18px; width: 62px; height: 62px; }
  .float-whatsapp i { font-size: 26px; }
  .scroll-top { bottom: 18px; right: 92px; }
}

/* Contact section ordering for RTL */
.contact-wrapper { grid-template-areas: "info form"; }
.contact-info { grid-area: info; }
.contact-form-container { grid-area: form; }
html[dir="rtl"] .contact-wrapper { grid-template-areas: "form info"; }

/* RTL: place form icons on the right */
html[dir="rtl"] .form-group label {
  flex-direction: row-reverse;
  justify-content: flex-start;
}

html[dir="rtl"] .contact-info,
html[dir="rtl"] .contact-details,
html[dir="rtl"] .contact-text {
  text-align: right;
}

/* Slightly reduce contact block size */
.contact-wrapper { padding: 44px; }
@media (max-width: 768px) { .contact-wrapper { padding: 28px; } }
