/* ===== IranNetwork mobile/RTL & UX fix layer (v1.2.0) =====
   Loaded AFTER irn.css to override the original minified rules.
   ---------------------------------------------------------- */

/* 1) Mobile panel opens from the RIGHT in RTL (was opening on the left).
   Use logical properties so it stays correct in both directions. */
.irn-mobile-panel-inner{
  margin-inline-start: auto !important;
  margin-inline-end: 14px !important;
  margin-top: calc(14px + env(safe-area-inset-top)) !important;
  margin-bottom: 14px !important;
}

/* 2) Slide-in animation from the right edge */
.irn-mobile-panel-inner{
  transform: translateX(20px);
  opacity: 0;
  transition: transform .28s ease, opacity .2s ease;
}
.irn-mobile-panel.open .irn-mobile-panel-inner{
  transform: translateX(0);
  opacity: 1;
}

/* 3) Keep header CTA buttons visible on tablets (720–1100px) so users
   between mobile and desktop still see "تماس" / "مشاوره". */
@media (max-width: 1100px) and (min-width: 721px){
  .irn-header-actions .irn-btn{ display: inline-flex !important; }
  .irn-header-actions .irn-btn{ padding: 10px 14px; font-size: 13px; }
}

/* 4) Mobile (<=720px): show only the primary CTA and the hamburger.
   The phone-call button moves into the floating bottom CTA. */
@media (max-width: 720px){
  .irn-header-actions .irn-btn-glass{ display: none !important; }
  .irn-header-actions .irn-btn-primary{
    display: inline-flex !important;
    padding: 9px 14px; font-size: 13px; box-shadow: none;
  }
  .irn-menu-toggle{ display: grid; place-items: center; }
  .irn-header-inner{ gap: 8px; }
}

/* 5) Touch / tablet mega-menu: open on tap (JS adds .open) */
.irn-nav-dd.open > .irn-mega,
.irn-nav-dd:focus-within > .irn-mega{
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
}

/* 6) Mobile accordion submenu: indent from the START (right in RTL) */
.irn-mobile-submenu{
  margin: 8px 0 4px !important;
  padding-inline-start: 16px;
}

/* 7) Floating bottom CTA: always visible on phones, safe-area aware */
.irn-floating-cta{
  display: none;
  position: fixed;
  inset-inline: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 60;
  gap: 8px;
}
.irn-floating-cta a{
  flex: 1;
  text-align: center;
  padding: 14px 12px;
  border-radius: 16px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  color: #fff;
  box-shadow: 0 14px 40px rgba(0,0,0,.35);
}
.irn-floating-cta a:first-child{
  background: rgba(15,23,42,.92);
  border: 1px solid var(--border);
  color: #e0f2fe;
}
@media (max-width: 720px){
  .irn-floating-cta{ display: flex !important; }
  /* leave space so floating bar doesn't cover footer content */
  .irn-footer{ padding-bottom: calc(90px + env(safe-area-inset-bottom)) !important; }
}

/* 8) Accessibility: bigger touch targets on mobile */
@media (max-width: 720px){
  .irn-mobile-panel a,
  .irn-mobile-row{ min-height: 48px; }
  .irn-mobile-accordion-toggle{ width: 44px; height: 44px; min-width: 44px; }
  .irn-menu-toggle{ width: 48px; height: 48px; }
}

/* 9) Prevent the hidden-header sliding bug when the mobile panel is open */
body.irn-menu-open .irn-header{ transform: none !important; }

/* 10) Reduce-motion users get no slide/transform animations */
@media (prefers-reduced-motion: reduce){
  .irn-header, .irn-mobile-panel, .irn-mobile-panel-inner, .irn-mega{ transition: none !important; }
}

/* 11) Focus-visible ring for keyboard users */
.irn-btn:focus-visible,
.irn-nav a:focus-visible,
.irn-mobile-panel a:focus-visible,
.irn-menu-toggle:focus-visible,
.irn-mobile-accordion-toggle:focus-visible{
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}


/* ===== IranNetwork final responsive header/CTA fix (v1.2.1) =====
   Goal: On mobile/tablet, keep the header clean. Hide header CTA buttons and
   use the compact floating CTA bar at the bottom instead. */

/* Tablets and phones: prevent CTA buttons from going to a corner or breaking the header */
@media (max-width: 1100px){
  .irn-header-actions{
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 8px !important;
    flex: 0 0 auto !important;
  }
  .irn-header-actions .irn-btn{
    display: none !important;
  }
  .irn-menu-toggle{
    display: grid !important;
    place-items: center !important;
    flex: 0 0 46px !important;
    width: 46px !important;
    height: 46px !important;
    margin: 0 !important;
    position: static !important;
  }
  .irn-header-inner{
    grid-template-columns: auto 1fr auto !important;
  }
  .irn-floating-cta{
    display: flex !important;
    width: min(360px, calc(100% - 24px)) !important;
    inset-inline: auto !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    bottom: calc(12px + env(safe-area-inset-bottom)) !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 6px !important;
    border-radius: 20px !important;
    background: rgba(2,6,23,.88) !important;
    border: 1px solid rgba(103,232,249,.20) !important;
    backdrop-filter: blur(14px) !important;
    box-shadow: 0 18px 48px rgba(0,0,0,.34) !important;
  }
  .irn-floating-cta a{
    flex: 1 1 0 !important;
    min-width: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 11px 12px !important;
    border-radius: 15px !important;
    font-size: 13px !important;
    line-height: 1.2 !important;
    font-weight: 900 !important;
    white-space: nowrap !important;
    box-shadow: none !important;
  }
}

/* Phones: even tighter header spacing */
@media (max-width: 720px){
  .irn-header-inner{
    height: 66px !important;
    gap: 8px !important;
  }
  .irn-logo{
    min-width: 0 !important;
  }
  .irn-logo strong{
    font-size: 15px !important;
  }
  .irn-logo small{
    display: none !important;
  }
  .irn-logo-img{
    max-height: 42px !important;
  }
  .irn-menu-toggle{
    flex-basis: 44px !important;
    width: 44px !important;
    height: 44px !important;
  }
  .irn-floating-cta{
    width: min(340px, calc(100% - 22px)) !important;
  }
  .irn-footer{
    padding-bottom: calc(86px + env(safe-area-inset-bottom)) !important;
  }
}

/* Small phones */
@media (max-width: 380px){
  .irn-floating-cta{
    width: calc(100% - 18px) !important;
    gap: 6px !important;
  }
  .irn-floating-cta a{
    font-size: 12px !important;
    padding: 10px 8px !important;
  }
  .irn-logo strong{
    font-size: 14px !important;
  }
}


/* SEO Pro content readability */
.irn-single-post .irn-content-card{
  max-width: 920px;
  margin-inline: auto;
  padding: clamp(24px, 4vw, 44px);
}
.irn-single-post h1{
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1.25;
  margin: 16px 0 12px;
}
.irn-post-meta{
  color: var(--muted);
  margin-bottom: 24px;
}
.irn-post-thumb img{
  width: 100%;
  max-height: 520px;
  object-fit: cover;
  border-radius: 24px;
  border: 1px solid rgba(148,163,184,.14);
  margin-bottom: 28px;
}
.irn-post-content{
  color: #dbeafe;
  font-size: 17px;
  line-height: 2.15;
}
.irn-post-content h2,
.irn-post-content h3{
  color: #fff;
  margin-top: 34px;
  line-height: 1.5;
}
.irn-post-content a{
  color: var(--cyan);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.irn-post-content img{
  border-radius: 20px;
}
