/* ========== أساسيات ========== */
:root{ --sheet-top:0px; --vh:100dvh; }
.mt-170{ margin-top:1px; }
.navbar{ overflow:visible; position:relative; z-index:2000; }
.navbar-collapse{ overflow:visible; }
/* لا تمنع السحب داخل الشيت */
body.no-scroll{ overflow:hidden !important; }

/* داخل ميديا الجوال لعنصر .services-menu */
@media (max-width:991.98px){
  .nav-item.services-mega .services-menu{
    max-height: calc(var(--vh, 100dvh) - var(--sheet-top, 0px));
    padding-bottom: max(24px, env(safe-area-inset-bottom, 16px));
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
}


/* ========== Products – Coming Soon ========== */
.products-soon{ position:relative; }
.products-soon .dropdown-soon{
  position:absolute; top:calc(100% + 8px); left:0;
  min-width:max-content; max-width:320px;
  background:#fff; border:1px solid rgba(124,37,185,.35);
  border-radius:12px; box-shadow:0 10px 30px rgba(0,0,0,.08);
  padding:10px 14px; text-align:center; z-index:1000;
  opacity:0; visibility:hidden; pointer-events:none; transform:translateY(6px);
  transition:opacity .2s ease, transform .2s ease;
}
.products-soon.is-open .dropdown-soon{ opacity:1; visibility:visible; pointer-events:auto; transform:none; }
:root[dir="rtl"] .products-soon .dropdown-soon{ left:auto; right:0; }
@media (max-width:991.98px){
  .products-soon .dropdown-soon{ position:static !important; width:100%; max-width:none; margin-top:8px; transform:none; }
}

/* ========== Flip Cards ========== */
.flip-card.block-style-twentyFour{ background:transparent !important; border:0 !important; box-shadow:none !important; padding:0 !important; }
.flip-card .flip-inner{
  position:relative; width:100%; border-radius:18px; background:#fff;
  box-shadow:0 14px 40px rgba(0,0,0,.08);
  transform-style:preserve-3d;
  transition:transform .7s cubic-bezier(.2,.7,.2,1), box-shadow .3s ease, height .28s ease;
  height:var(--h-front, auto); will-change:transform,height;
}
.flip-card:hover .flip-inner{ box-shadow:0 18px 50px rgba(0,0,0,.10); }
.flip-card .flip-face{ position:absolute; inset:0; border-radius:18px; backface-visibility:hidden; overflow:hidden; }
.flip-card .flip-front{ background:#fff; }
.flip-card .flip-back{ transform:rotateY(180deg); color:#fff; background:#90BFB2; display:flex; align-items:flex-start; justify-content:flex-start; }
.flip-card:hover .flip-inner,
.flip-card.is-flipped .flip-inner{ transform:rotateY(180deg); height:var(--h-back, auto); }

.flip-card h4{ font-weight:800; font-size:1.15rem; }
.flip-card p,.flip-card li{ line-height:1.65; font-size:.975rem; }
.flip-card ul{ padding-left:18px; margin:0; }
@media (min-width:992px){ .flip-card h4{ font-size:1.25rem; } .flip-card p,.flip-card li{ font-size:1rem; } }
:root[dir="rtl"] .flip-card .me-3{ margin-right:0 !important; margin-left:1rem !important; }
.flip-inner.measure{ transform:none !important; }
.flip-inner.measure .flip-face{ position:relative; inset:auto; transform:none; }
@media (prefers-reduced-motion:reduce){ .flip-card .flip-inner{ transition:none; } }
.flip-back .p-4{ opacity:0; transform:translateY(6px); transition:opacity .24s ease .1s, transform .24s ease .1s; text-align:start; }
.flip-card:hover .flip-back .p-4,
.flip-card.is-flipped .flip-back .p-4{ opacity:1; transform:none; }
.flip-back h4{ margin:0 0 .6rem; font-weight:800; font-size:clamp(1.05rem,.9rem + .4vw,1.25rem); letter-spacing:.2px; }
.flip-back p{ margin:0 0 .85rem; line-height:1.75; font-size:clamp(.95rem,.9rem + .2vw,1rem); color:rgba(255,255,255,.92); }
.flip-back ul{ margin:0 0 .6rem; padding:0; list-style:none; }
.flip-back li{ position:relative; margin:.35rem 0; padding-inline-start:1.35rem; line-height:1.65; color:rgba(255,255,255,.95); }
.flip-back li::before{ content:""; position:absolute; inset-inline-start:0; top:.55rem; width:.62rem; height:.62rem; border-radius:50%; background:#699D8E; box-shadow:0 0 0 3px rgba(255,255,255,.18); }
@media (min-width:992px){ .flip-back ul{ columns:2; column-gap:20px; } .flip-back li{ break-inside:avoid; } }
@media (max-width:575.98px){
  .flip-back .p-4{ text-align:start; padding:16px; opacity:1; transform:none; }
  .flip-back ul{ columns:auto; column-gap:0; padding:0; margin:0 0 .6rem; list-style:none; }
  .flip-back li{ margin:.45rem 0; padding-inline-start:1.1rem; line-height:1.7; font-size:.95rem; color:rgba(255,255,255,.95); }
  .flip-back li::before{ content:""; position:absolute; inset-inline-start:0; top:.58rem; width:.5rem; height:.5rem; border-radius:50%; background:#3FE193; box-shadow:0 0 0 2px rgba(255,255,255,.22); display:inline-block; }
  .flip-card .icon{ width:64px !important; height:64px !important; border-radius:14px !important; }
  .flip-card .icon img{ width:32px !important; height:32px !important; }
}
@media (hover:none){ .flip-card:hover .flip-inner{ transform:none; } }

/* ========== Services Mega (Desktop + Mobile Sheet) ========== */
.nav-item.services-mega{ position:static; }
.nav-item.services-mega .services-menu{
  position:fixed;
  top:var(--anchor-bottom, 80px);
  left:var(--anchor-x, 50%);
  transform:translate(calc(-50% + var(--shift, 0px)), 4px) scale(.95);
  transform-origin:top center;
  width:min(1100px, calc(100vw - 32px));
  max-height:min(70vh, calc(100dvh - var(--anchor-bottom, 80px) - 40px));
  overflow:auto; overscroll-behavior:contain;
  padding:24px; background:#fff; border:1px solid rgba(124,37,185,.15);
  border-radius:16px; box-shadow:0 20px 60px rgba(0,0,0,.12);
  z-index:2100; opacity:0; visibility:hidden; pointer-events:none;
  transition:transform .25s cubic-bezier(.4,0,.2,1), opacity .2s ease;
}
.nav-item.services-mega .services-menu:before{ content:""; position:absolute; top:-14px; left:0; right:0; height:18px; background:transparent; z-index:1; }
.nav-item.services-mega .services-menu::before{
  content:""; position:absolute; top:-10px; left:calc(50% - var(--shift, 0px) - 10px);
  width:0; height:0; border-left:10px solid transparent; border-right:10px solid transparent; border-bottom:10px solid #fff; z-index:2;
}
.nav-item.services-mega .services-menu::after{
  content:""; position:absolute; top:-11px; left:calc(50% - var(--shift, 0px) - 10px);
  width:0; height:0; border-left:10px solid transparent; border-right:10px solid transparent; border-bottom:10px solid rgba(124,37,185,.15); z-index:1;
}
.nav-item.services-mega.is-open .services-menu{ opacity:1; visibility:visible; pointer-events:auto; transform:translate(calc(-50% + var(--shift, 0px)), 0) scale(1); }

/* بطاقات الخدمات */
.services-grid{ display:grid; grid-template-columns:repeat(auto-fit, minmax(260px,1fr)); gap:20px; }
.svc-card{ background:#fff; border:1px solid rgba(124,37,185,.1); border-radius:12px; padding:20px; transition:all .3s ease; scroll-margin-block-end:24px; }
.svc-card:hover{ border-color:rgba(124,37,185,.3); box-shadow:0 8px 25px rgba(124,37,185,.1); transform:translateY(-2px); }
.svc-head{ display:flex; align-items:center; gap:12px; margin-bottom:12px; }
.svc-chip{ width:40px; height:40px; background:linear-gradient(135deg,#7C25B9,#9333EA); color:#fff; border-radius:10px; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:12px; letter-spacing:.5px; }
.svc-title{ margin:0; font-weight:700; font-size:1.1rem; color:#1a1d21; }
.svc-desc{ margin:0 0 16px 0; color:#5e6573; line-height:1.6; font-size:.95rem; }
.svc-sub{ font-weight:700; font-size:.8rem; text-transform:uppercase; letter-spacing:.5px; color:#7C25B9; margin-bottom:8px; }
.svc-list{ margin:0; padding:0; list-style:none; }
.svc-list li{ position:relative; margin:6px 0; padding-left:20px; line-height:1.5; color:#333; font-size:.9rem; }
.svc-list li::before{ content:""; position:absolute; left:0; top:8px; width:6px; height:6px; background:#3FE193; border-radius:50%; box-shadow:0 0 0 2px rgba(124,37,185,.1); }


.services-backdrop{   inset:0; background:rgba(0,0,0,.25); opacity:0; pointer-events:none; z-index:2099; transition:opacity .2s ease; }
.services-backdrop.is-show{ opacity:1; pointer-events:auto; }
.mobile-close-btn{
  position:sticky; top:10px; right:10px; float:right; clear:both; margin:0 0 20px 0;
  padding:12px 20px; background:#7C25B9; color:#fff; border:none; border-radius:25px; font-size:16px; font-weight:600; cursor:pointer;
  transition:all .3s ease; z-index:100; box-shadow:0 4px 15px rgba(124,37,185,.3); min-width:84px; text-align:center;
}
.mobile-close-btn:hover,.mobile-close-btn:active{ background:#5A1A7F; transform:translateY(-2px); box-shadow:0 6px 20px rgba(124,37,185,.4); }
.mobile-close-btn:focus{ outline:3px solid rgba(124,37,185,.5); outline-offset:2px; }

/* ========== وضع الجوال (Bottom Sheet) ========== */
@media (max-width:991.98px){
  .nav-item.services-mega .services-menu{
    top:var(--sheet-top, 0px); left:0; right:0;
    width:100vw; height:auto;
    max-height:calc(var(--vh, 100dvh) - var(--sheet-top, 0px));
    border-radius:0; padding:20px 20px max(24px, env(safe-area-inset-bottom, 16px));
    transform:translateY(100%); box-shadow:none; opacity:0; visibility:hidden; pointer-events:none;
    transition:transform .32s cubic-bezier(.2,.7,.2,1), opacity .2s ease;
    -webkit-overflow-scrolling:touch; overscroll-behavior:contain;
  }
  .nav-item.services-mega.is-open .services-menu{ transform:translateY(0); opacity:1; visibility:visible; pointer-events:auto; }
  .nav-item.services-mega.is-closing .services-menu{ transform:translateY(100%); opacity:0; visibility:hidden; pointer-events:none; }

  .nav-item.services-mega .services-menu::before,
  .nav-item.services-mega .services-menu::after{ display:none !important; }

  /* أكورديون */
  .services-grid{ display:block; margin-top:10px; }
  .svc-card{ cursor:pointer; border-radius:12px; border:1px solid rgba(124,37,185,.1); background:#fff; overflow:hidden; padding:0; }
  .svc-card:last-child{ margin-bottom:20px; }
  .svc-head{ cursor:pointer; padding:16px; margin-bottom:0; background:#fff; border-bottom:1px solid rgba(124,37,185,.05); transition:background-color .2s ease; }
  .svc-head:hover{ background:rgba(124,37,185,.02); }
  .svc-head::after{
    content:"+"; margin-left:auto; font-weight:900; font-size:20px; color:#7C25B9; transition:transform .3s ease;
    background:rgba(124,37,185,.1); width:32px; height:32px; border-radius:8px; display:inline-flex; align-items:center; justify-content:center; flex-shrink:0;
  }
  .svc-card.is-open .svc-head::after{ content:"−"; background:rgba(124,37,185,.15); }

  .svc-desc,.svc-sub,.svc-list{
    max-height:0; overflow:hidden; opacity:0;
    transition:max-height .35s cubic-bezier(.4,0,.2,1), opacity .25s ease;
    padding:0 16px;
  }
  .svc-card.is-open .svc-desc{ margin-bottom:12px; }
  .svc-card.is-open .svc-sub{ margin-bottom:8px; margin-top:8px; }
  .svc-card.is-open .svc-list{ margin-top:4px; }
}

/* دعم RTL */
:root[dir="rtl"] .svc-list li{ padding-left:0; padding-right:20px; }
:root[dir="rtl"] .svc-list li::before{ left:auto; right:0; }
:root[dir="rtl"] .mobile-close-btn{ right:auto; left:10px; float:left; }
:root[dir="rtl"] .svc-head::after{ margin-left:0; margin-right:auto; }

/* وصولية */
.svc-card:focus-within{ outline:2px solid #7C25B9; outline-offset:2px; }

/* === Services sheet: وسّع طول السكروول على الجوال === */
@media (max-width: 991.98px){
  .nav-item.services-mega .services-menu{
    /* نثبت ارتفاع الشيت على كل الشاشة (ناقص الهيدر) */
    top: 0 !important;
    height: var(--vh, 100dvh) !important;  /* أكبر مساحة ممكنة */
    max-height: none !important;

    /* تمرير سلس ومساحة إضافية بالأسفل */
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: max(200px, env(safe-area-inset-bottom, 24px)) !important;

    /* لما نستدعي scrollIntoView تبقى آخر بطاقة واضحة وما تنقص */
    scroll-padding-bottom: 300px;
  }

  /* خلّي آخر بطاقة دومًا قابلة للظهور بالكامل */
  .svc-card{ scroll-margin-bottom: 24px; }
}

/* ========== Products Mega Menu ========== */
.products-mega-menu{ position: static; }
.products-dropdown{
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  min-width: 900px; max-width: 1200px; width: max-content;
  max-height: 70vh;
  background: #fff; border: 1px solid rgba(124,37,185,.15);
  border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.12);
  padding: 24px; z-index: 2000; margin-top: 8px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Show dropdown on hover for desktop */
@media (min-width: 992px){
  .products-mega-menu:hover .products-dropdown{
    display: block;
  }

  /* Responsive desktop sizing */
  .products-dropdown{
    min-width: 850px;
    max-width: 95vw;
  }
}

@media (min-width: 992px) and (max-width: 1200px){
  .products-grid{
    grid-template-columns: 1fr !important;
    max-width: 400px;
    margin: 0 auto;
  }

  .products-dropdown{
    min-width: 420px;
    max-width: 450px;
    max-height: 80vh;
  }
}

/* Bootstrap dropdown behavior */
.products-mega-menu .dropdown-menu{
  display: none;
}

.products-mega-menu .dropdown-menu.show{
  display: block;
}

.products-grid{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  width: 100%;
  padding-bottom: 16px;
  min-height: min-content;
}

.product-card{
  background: #fff; border: 1px solid rgba(124,37,185,.1);
  border-radius: 12px; padding: 18px; transition: all .3s ease;
  cursor: pointer; min-height: 240px; display: flex; flex-direction: column;
  height: fit-content;
}

.product-card:hover{
  border-color: rgba(124,37,185,.3);
  box-shadow: 0 8px 25px rgba(124,37,185,.15);
  transform: translateY(-2px);
}

.product-header{
  display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px;
}

.product-icon{
  width: 48px; height: 48px; border-radius: 12px;
  background: linear-gradient(135deg, #7C25B9, #9333EA);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px; flex-shrink: 0;
}

.product-title h6{
  margin: 0 0 4px 0; font-weight: 700; font-size: 1.1rem;
  color: #1a1d21; line-height: 1.3;
}

.product-subtitle{
  font-size: 0.85rem; color: #7C25B9; font-weight: 600;
  line-height: 1.3; display: block;
}

.product-description{
  margin: 0 0 12px 0; color: #5e6573; line-height: 1.5;
  font-size: 0.85rem; flex-grow: 1;
}

.product-features{
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto;
}

.feature-tag{
  background: rgba(124,37,185,.1); color: #7C25B9;
  padding: 4px 8px; border-radius: 6px; font-size: 0.75rem;
  font-weight: 600; letter-spacing: 0.5px;
}

/* Custom Scrollbar for Products Dropdown */
.products-dropdown::-webkit-scrollbar{
  width: 8px;
}

.products-dropdown::-webkit-scrollbar-track{
  background: rgba(124,37,185,.05);
  border-radius: 4px;
}

.products-dropdown::-webkit-scrollbar-thumb{
  background: rgba(124,37,185,.3);
  border-radius: 4px;
  transition: background .3s ease;
}

.products-dropdown::-webkit-scrollbar-thumb:hover{
  background: rgba(124,37,185,.5);
}

/* Firefox scrollbar */
.products-dropdown{
  scrollbar-width: thin;
  scrollbar-color: rgba(124,37,185,.3) rgba(124,37,185,.05);
}

/* Mobile Responsive */
@media (max-width: 991.98px){
  .products-mega-menu .dropdown-menu{
    position: static !important;
    transform: none !important;
    min-width: auto !important;
    width: 100% !important;
    margin-top: 8px !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,.1) !important;
    border: 1px solid rgba(124,37,185,.1) !important;
    padding: 0 !important;
    background: #fff !important;
    display: none !important;
  }

  .products-mega-menu .dropdown-menu.show{
    display: block !important;
  }

  /* Ensure mobile nav can close properly */
  .navbar-collapse{
    overflow: visible !important;
  }

  /* Fix z-index and positioning issues on mobile */
  .products-mega-menu{
    position: relative !important;
    z-index: 1 !important;
  }

  /* Prevent dropdown from blocking navbar toggle */
  .navbar-toggler{
    z-index: 9999 !important;
    position: relative !important;
  }

  /* Ensure proper stacking order */
  .navbar{
    z-index: 1050 !important;
  }

  .products-dropdown{
    position: static !important;
    transform: none !important;
    min-width: auto !important;
    width: 100% !important;
    margin-top: 0 !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    border: none !important;
    padding: 12px !important;
    background: #fff !important;
    display: block !important;
    max-height: 60vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
  }

  .products-grid{
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    padding-bottom: 12px !important;
  }

  .product-card{
    min-height: auto !important;
    padding: 16px !important;
    margin-bottom: 8px;
    border: 1px solid rgba(124,37,185,.1) !important;
    border-radius: 8px !important;
    background: #fff !important;
  }

  .product-header{
    gap: 10px !important;
    margin-bottom: 8px !important;
  }

  .product-icon{
    width: 40px !important;
    height: 40px !important;
    font-size: 16px !important;
  }

  .product-title h6{
    font-size: 1rem !important;
    margin-bottom: 2px !important;
  }

  .product-subtitle{
    font-size: 0.8rem !important;
  }

  .product-description{
    font-size: 0.85rem !important;
    margin-bottom: 12px !important;
  }

  .feature-tag{
    font-size: 0.7rem !important;
    padding: 3px 6px !important;
  }
}