/* Extracted from assets/js/navigation-guard.js
   Purpose: keep layout/mobile and service CTA styling in static CSS,
   so JavaScript does less work during initial page load. */

html, body {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
      }

      @supports (overflow-x: clip) {
        html { overflow-x: clip !important; }
      }

      body { overscroll-behavior-x: none; }

      *, *::before, *::after { box-sizing: border-box; }

      img, video, canvas, svg, iframe {
        max-width: 100% !important;
        height: auto;
      }

      .topbar,
      .topbar.yl-header-ready,
      .main-nav,
      .yl-header-shortcuts,
      .page-shell,
      .section-card,
      .hero,
      .seo-internal-links,
      .seo-internal-links-grid,
      .google-compliance-notice,
      .google-compliance-free-notice,
      .google-compliance-intro,
      .site-footer,
      .about-page,
      .contact-page,
      .trust-page,
      .book-shell,
      .law-shell,
      .service-grid,
      .case-grid,
      .posts-grid,
      .contact-grid,
      .contact-grid-page,
      .library-grid,
      .books-grid,
      .services-grid,
      .contract-studio,
      .workspace-header,
      .workspace-body,
      .form-panel,
      .preview-panel,
      .paper-wrap,
      .entry-paper-wrap,
      .contracts-latin-links,
      .contracts-latin-links-head,
      .contracts-latin-grid,
      .contracts-latin-card,
      .service-item,
      .case-card,
      .library-item,
      .contact-link,
      .contact-card-page,
      .about-card,
      .trust-card,
      .modal-card {
        max-width: 100% !important;
        min-width: 0 !important;
      }

      .topbar,
      .topbar.yl-header-ready,
      .page-shell,
      .section-card,
      .hero,
      .seo-internal-links,
      .google-compliance-notice,
      .google-compliance-free-notice,
      .google-compliance-intro,
      .site-footer,
      .contracts-latin-links,
      .contracts-latin-grid,
      .paper-wrap,
      .entry-paper-wrap {
        overflow-x: hidden !important;
      }

      .service-grid,
      .case-grid,
      .posts-grid,
      .contact-grid,
      .contact-grid-page,
      .library-grid,
      .books-grid,
      .services-grid,
      .seo-internal-links-grid,
      .contract-pickers-grid,
      .manual-sections-grid,
      .workspace-status-row {
        grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)) !important;
      }

      .main-nav a,
      .yl-header-link,
      .yl-header-menu-btn,
      #navToggle,
      .nav-toggle,
      .action-btn,
      .quick-btn,
      .service-item,
      .case-card,
      .library-item,
      .contact-link,
      .contact-card-page,
      .seo-internal-link,
      .contracts-latin-card,
      .contracts-modern-content,
      .contracts-modern-title,
      .about-card,
      .trust-card,
      .book-item,
      .service-item-about {
        max-width: 100% !important;
        min-width: 0 !important;
        overflow-wrap: anywhere;
        word-break: normal;
      }

      .paper,
      .entry-paper,
      .contract-entry-paper { max-width: 100% !important; }

      @media (max-width: 900px) {
        html, body { position: relative; }
        body > * { max-width: 100% !important; }

        .topbar,
        .topbar.yl-header-ready {
          right: 0 !important;
          left: 0 !important;
          width: 100% !important;
          max-width: 100% !important;
          overflow-x: hidden !important;
        }

        .page-shell,
        .about-page,
        .contact-page,
        .trust-page {
          padding-inline: min(16px, 4vw) !important;
        }

        .section-card,
        .hero,
        .about-card,
        .contact-hero,
        .contact-info article,
        .google-compliance-notice,
        .google-compliance-free-notice,
        .google-compliance-intro,
        .seo-internal-links {
          margin-inline: auto !important;
          width: 100% !important;
        }
      }

/* Global page loading indicator */
.yl-page-wait-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, .42);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .18s ease, visibility .18s ease;
}

html.yl-page-waiting .yl-page-wait-overlay,
body.yl-page-waiting .yl-page-wait-overlay {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.yl-page-wait-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: min(260px, 92vw);
  padding: 16px 20px;
  border-radius: 22px;
  border: 1px solid rgba(245, 158, 11, .42);
  background: linear-gradient(135deg, rgba(255, 251, 235, .98), rgba(255, 247, 237, .96));
  color: #78350f;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .32), inset 0 1px 0 rgba(255, 255, 255, .75);
  font-weight: 900;
  line-height: 1.7;
  text-align: center;
}

.yl-page-wait-spinner {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 999px;
  border: 4px solid rgba(146, 64, 14, .18);
  border-top-color: #b45309;
  border-inline-start-color: #f59e0b;
  animation: ylPageWaitSpin .78s linear infinite;
}

.yl-page-wait-text {
  font-size: .98rem;
  white-space: nowrap;
}

@keyframes ylPageWaitSpin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .yl-page-wait-spinner {
    animation-duration: 1.4s;
  }
}

@media (max-width: 600px) {
  .yl-page-wait-box {
    flex-direction: column;
    gap: 10px;
    min-width: min(220px, 88vw);
    padding: 16px;
  }

  .yl-page-wait-text {
    white-space: normal;
  }
}

/* Service WhatsApp CTA styles */
body.service-page .hero.hero-modern,
      body.yl-service-cta-page .hero.hero-modern {
        display: block !important;
      }

      body.service-page .seo-internal-link,
      body.yl-service-cta-page .seo-internal-link {
        border-radius: 20px;
        font-weight: 900;
        transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
      }

      body.service-page .seo-internal-link:hover,
      body.yl-service-cta-page .seo-internal-link:hover {
        transform: translateY(-2px);
        box-shadow: 0 18px 38px rgba(0, 0, 0, .22);
      }

      .service-whatsapp-button,
      .yl-global-hero-whatsapp {
        position: relative;
        isolation: isolate;
        min-height: 58px;
        padding: 14px 22px !important;
        border: 1px solid rgba(34, 197, 94, .55) !important;
        background: linear-gradient(135deg, #16a34a 0%, #22c55e 48%, #bbf7d0 100%) !important;
        color: #052e16 !important;
        box-shadow: 0 14px 34px rgba(22, 163, 74, .34), inset 0 1px 0 rgba(255, 255, 255, .55) !important;
        overflow: hidden;
        text-decoration: none !important;
      }

      .service-whatsapp-button::before,
      .yl-global-hero-whatsapp::before {
        content: "";
        position: absolute;
        inset: -40% auto -40% -55%;
        width: 44%;
        transform: rotate(18deg);
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
        animation: serviceCtaShine 3.8s ease-in-out infinite;
        z-index: -1;
      }

      .service-whatsapp-button::after,
      .yl-global-hero-whatsapp::after {
        content: "اطلب الآن";
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-inline-start: 8px;
        padding: 3px 9px;
        border-radius: 999px;
        background: rgba(255, 255, 255, .76);
        color: #14532d;
        font-size: .76rem;
        font-weight: 1000;
      }

      .yl-global-hero-actions {
        display: flex !important;
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px !important;
        margin-top: 18px !important;
      }

      .yl-global-hero-whatsapp {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        gap: 10px;
      }

      .yl-global-hero-whatsapp i {
        font-size: 1.16rem;
      }

      .service-ad-banner {
        position: relative;
        overflow: hidden;
        margin-top: 18px;
        padding: 22px;
        border-radius: 28px;
        border: 1px solid rgba(34, 197, 94, .32);
        background: radial-gradient(circle at top right, rgba(34, 197, 94, .26), transparent 34%), linear-gradient(135deg, rgba(15, 23, 42, .92), rgba(20, 83, 45, .82));
        box-shadow: 0 22px 54px rgba(0, 0, 0, .26);
      }

      .service-ad-banner h2 {
        margin: 0 0 8px;
        color: #fff;
        font-size: clamp(1.22rem, 3vw, 1.7rem);
        line-height: 1.8;
      }

      .service-ad-banner p {
        margin: 0;
        color: #dcfce7;
        line-height: 2;
        font-weight: 800;
      }

      .service-ad-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 12px;
        margin-top: 14px;
      }

      .service-ad-actions .service-whatsapp-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
      }

      .service-ad-note {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        color: #fef9c3;
        font-weight: 900;
        line-height: 1.9;
      }

      @keyframes serviceCtaShine {
        0% { left: -55%; opacity: 0; }
        18% { opacity: .8; }
        42% { left: 120%; opacity: 0; }
        100% { left: 120%; opacity: 0; }
      }

      @media (max-width: 700px) {
        .service-ad-banner { padding: 18px; }
        .service-ad-actions .service-whatsapp-button,
        body.service-page .hero-content .service-whatsapp-button,
        body.yl-service-cta-page .hero-content .service-whatsapp-button,
        .yl-global-hero-whatsapp {
          width: 100%;
        }
      }

/* Modern service pages fallback applied through the shared CSS loaded on every service page */
body:has(.yl-service-breadcrumb),
body.service-page,
body.yl-services-modern {
  background:
    radial-gradient(circle at 12% 8%, rgba(245, 158, 11, .16), transparent 30%),
    radial-gradient(circle at 88% 4%, rgba(34, 197, 94, .14), transparent 28%),
    linear-gradient(180deg, #fffaf0 0%, #f8fafc 42%, #fff 100%) !important;
}

.page-shell:has(.yl-service-breadcrumb) .breadcrumb,
body.service-page .breadcrumb {
  border: 1px solid rgba(146, 64, 14, .14) !important;
  background: rgba(255, 255, 255, .78) !important;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .08) !important;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.page-shell:has(.yl-service-breadcrumb) .hero.hero-modern,
body.service-page .hero.hero-modern {
  position: relative !important;
  overflow: hidden !important;
  border: 1px solid rgba(245, 158, 11, .24) !important;
  background:
    radial-gradient(circle at top right, rgba(34, 197, 94, .24), transparent 34%),
    radial-gradient(circle at left 18%, rgba(245, 158, 11, .22), transparent 32%),
    linear-gradient(135deg, rgba(15, 23, 42, .98), rgba(30, 41, 59, .94) 46%, rgba(120, 53, 15, .9)) !important;
  box-shadow: 0 26px 70px rgba(15, 23, 42, .28) !important;
}

.page-shell:has(.yl-service-breadcrumb) .hero.hero-modern::after,
body.service-page .hero.hero-modern::after {
  content: "طلب خدمة قانونية";
  position: absolute;
  top: 22px;
  left: 22px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .28);
  background: rgba(255, 255, 255, .12);
  color: #fef3c7;
  font-weight: 1000;
  font-size: .82rem;
}

.page-shell:has(.yl-service-breadcrumb) .hero h1,
body.service-page .hero h1 {
  color: #fff !important;
  text-shadow: 0 10px 28px rgba(0, 0, 0, .25);
}

.page-shell:has(.yl-service-breadcrumb) .hero p,
body.service-page .hero p {
  color: #f8fafc !important;
  font-size: clamp(1.02rem, 2.4vw, 1.22rem);
  line-height: 2.05;
}

.page-shell:has(.yl-service-breadcrumb) .hero-badge,
body.service-page .hero-badge {
  background: linear-gradient(135deg, #fef3c7, #fde68a) !important;
  color: #78350f !important;
  border: 1px solid rgba(245, 158, 11, .35) !important;
  box-shadow: 0 12px 28px rgba(245, 158, 11, .18);
}

.page-shell:has(.yl-service-breadcrumb) .hero-motto,
body.service-page .hero-motto {
  color: #fef3c7 !important;
  background: rgba(255, 255, 255, .10) !important;
  border: 1px solid rgba(255, 255, 255, .18) !important;
}

.page-shell:has(.yl-service-breadcrumb) .section-card,
body.service-page .section-card {
  border: 1px solid rgba(146, 64, 14, .12) !important;
  background: rgba(255, 255, 255, .92) !important;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .09) !important;
}

.page-shell:has(.yl-service-breadcrumb) .case-card,
body.service-page .case-card,
.page-shell:has(.yl-service-breadcrumb) .service-related-card,
body.service-page .service-related-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(146, 64, 14, .14) !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(255, 251, 235, .82)) !important;
  box-shadow: 0 16px 36px rgba(15, 23, 42, .09) !important;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.page-shell:has(.yl-service-breadcrumb) .case-card::before,
body.service-page .case-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 5px;
  background: linear-gradient(90deg, #f59e0b, #22c55e, #0ea5e9);
}

.page-shell:has(.yl-service-breadcrumb) .case-card:hover,
body.service-page .case-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 26px 58px rgba(15, 23, 42, .14) !important;
  border-color: rgba(245, 158, 11, .34) !important;
}

.page-shell:has(.yl-service-breadcrumb) .section-head h2,
body.service-page .section-head h2 {
  position: relative;
  display: inline-block;
}

.page-shell:has(.yl-service-breadcrumb) .section-head h2::after,
body.service-page .section-head h2::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -8px;
  width: 68px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f59e0b, #22c55e);
}

.yl-service-trust-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: -8px auto 22px;
}

.yl-service-trust-strip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 12px 14px;
  border-radius: 20px;
  border: 1px solid rgba(245, 158, 11, .22);
  background: rgba(255, 255, 255, .88);
  color: #78350f;
  font-weight: 900;
  line-height: 1.8;
  text-align: center;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .08);
}

.yl-service-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.yl-service-open-link {
  background: linear-gradient(135deg, #0f172a, #334155) !important;
  color: #fff !important;
  border-color: rgba(15, 23, 42, .22) !important;
}

.yl-service-sticky-whatsapp {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 2147482000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 54px;
  padding: 13px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .55);
  background: linear-gradient(135deg, #16a34a, #22c55e, #bbf7d0);
  color: #052e16;
  text-decoration: none;
  font-weight: 1000;
  box-shadow: 0 18px 44px rgba(22, 163, 74, .42), 0 0 0 6px rgba(34, 197, 94, .12);
  animation: ylServicePulse 2.4s ease-in-out infinite;
}

@keyframes ylServicePulse {
  0%, 100% { transform: translateY(0); box-shadow: 0 18px 44px rgba(22, 163, 74, .42), 0 0 0 6px rgba(34, 197, 94, .12); }
  50% { transform: translateY(-3px); box-shadow: 0 22px 54px rgba(22, 163, 74, .52), 0 0 0 10px rgba(34, 197, 94, .08); }
}

@media (max-width: 900px) {
  .yl-service-trust-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .page-shell:has(.yl-service-breadcrumb) .hero.hero-modern::after,
  body.service-page .hero.hero-modern::after {
    position: relative;
    top: auto;
    left: auto;
    display: inline-flex;
    margin-top: 12px;
  }

  .yl-service-trust-strip,
  .yl-service-card-actions { grid-template-columns: 1fr; }

  .yl-service-sticky-whatsapp {
    right: 12px;
    left: 12px;
    bottom: 12px;
    width: auto;
    min-height: 56px;
  }

  body:has(.yl-service-breadcrumb) .site-footer,
  body.service-page .site-footer { padding-bottom: 82px; }
}

/* Fix: restore official contact buttons layout and style */
.contact-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
  gap: 14px !important;
  align-items: stretch !important;
}

.contact-link {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  min-height: 58px !important;
  padding: 14px 18px !important;
  border-radius: 18px !important;
  text-decoration: none !important;
  font-weight: 900 !important;
  line-height: 1.6 !important;
  white-space: normal !important;
  overflow-wrap: normal !important;
  word-break: normal !important;
  box-shadow: 0 12px 26px rgba(0,0,0,.16) !important;
}

.contact-link.whatsapp {
  background: linear-gradient(135deg, #16a34a, #22c55e) !important;
  color: #052e16 !important;
}

.contact-link.phone {
  background: linear-gradient(135deg, #0f172a, #334155) !important;
  color: #fff !important;
}

.contact-link.facebook {
  background: linear-gradient(135deg, #1d4ed8, #60a5fa) !important;
  color: #fff !important;
}

.contact-link.telegram {
  background: linear-gradient(135deg, #0284c7, #38bdf8) !important;
  color: #fff !important;
}

.contact-link i {
  font-size: 1.25rem !important;
  flex: 0 0 auto !important;
}

.contact-link span {
  display: inline-block !important;
}

@media (max-width: 700px) {
  .contact-grid {
    grid-template-columns: 1fr !important;
  }

  .contact-link {
    width: 100% !important;
    min-height: 54px !important;
    padding: 13px 14px !important;
  }
}
