/*
 * Farabi Products Mega V3 (Astra Child only)
 * Compact frosted-glass therapeutic navigation.
 * Does not change UberMenu's global positioning or sibling menus.
 */
@media (min-width: 961px) {
  #ast-desktop-header #menu-item-10146 > .ubermenu-submenu.ubermenu-submenu-drop {
    display: block !important;
    grid-template-columns: none !important;
    box-sizing: border-box !important;
    padding: 12px !important;
    background: rgba(237, 249, 243, .94) !important;
    border: 1px solid rgba(216,236,225,.96) !important;
    border-top: 2px solid #60a786 !important;
    border-radius: 0 0 16px 16px !important;
    box-shadow: 0 28px 58px rgba(13, 62, 45, .16), inset 0 1px 0 rgba(255,255,255,.9) !important;
    -webkit-backdrop-filter: blur(24px) saturate(130%);
    backdrop-filter: blur(24px) saturate(130%);
    overflow: visible !important;
  }
  #ast-desktop-header #menu-item-10146 > .ubermenu-submenu > .farabi-mega-host {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    float: none !important;
    padding: 0 !important;
    margin: 0 !important;
    position: static !important;
  }
  .farabi-mega {
    --fm-green: #0a6a4f;
    --fm-ink: #123e37;
    --fm-muted: #698278;
    direction: rtl;
    display: block;
    box-sizing: border-box;
    font-family: IRANSansWeb, IRANSansFaNum, Tahoma, sans-serif;
    color: var(--fm-ink);
    font-size: 12px;
    text-align: right;
    line-height: 1.7;
  }
  .farabi-mega *, .farabi-mega *::before, .farabi-mega *::after {
    box-sizing: border-box;
  }
  .farabi-mega-main {
    display: grid;
    grid-template-columns: 1.07fr 1fr 1.04fr .90fr;
    gap: 8px;
    height: min(65vh, 625px);
    min-height: 465px;
  }
  .farabi-mega-panel {
    background: rgba(255,255,255,.69);
    border: 1px solid rgba(255,255,255,.96);
    border-radius: 12px;
    box-shadow: inset 0 1px 0 #fff, 0 2px 8px rgba(13,72,43,.035);
    padding: 13px 12px;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    scrollbar-color: #b9d7c6 transparent;
    scrollbar-width: thin;
  }
  .farabi-mega-panel-head {
    font: 600 10px/1.5 IRANSansWeb, Tahoma, sans-serif;
    letter-spacing: .1em;
    direction: ltr;
    color: #788c87;
    text-align: left;
    margin: 1px 11px 11px;
    text-transform: uppercase;
  }
  .farabi-mega-row {
    position: relative;
    display: flex !important;
    align-items: center;
    width: 100%;
    gap: 10px;
    border: 1px solid transparent !important;
    border-radius: 7px !important;
    background: transparent !important;
    box-shadow: none !important;
    margin: 0 0 2px !important;
    padding: 8px 9px !important;
    color: #153d35 !important;
    text-align: right;
    direction: rtl;
    cursor: pointer;
    min-height: 51px;
    text-decoration: none !important;
    font-family: inherit;
    transition: background .16s ease,border-color .16s ease;
  }
  .farabi-mega-row:hover, .farabi-mega-row:focus-visible,
  .farabi-mega-row[aria-pressed="true"] {
    background: linear-gradient(110deg,rgba(222,244,233,.92),rgba(240,250,243,.82)) !important;
    border-color: rgba(178,219,195,.8) !important;
    outline: none;
  }
  .farabi-mega-icon {
    display: inline-flex;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    flex: 0 0 36px;
    color: #147257;
    background: rgba(225,243,232,.65);
    border-radius: 10px;
    font-size: 21px;
    font-weight: 400;
    line-height: 1;
  }
  .farabi-mega-row[aria-pressed="true"] .farabi-mega-icon {
    background: rgba(191,232,211,.7);
  }
  .farabi-mega-row-copy {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .farabi-mega-row-name {
    color: #14382f;
    font-weight: 650;
    font-size: 11.6px;
    line-height: 1.7;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .farabi-mega-row-en {
    color: #6a7d7b;
    direction: ltr;
    text-align: right;
    font: 400 10px/1.4 Arial, sans-serif;
    overflow-wrap: anywhere;
  }
  .farabi-mega-chevron {
    flex: 0 0 auto;
    color: #558577;
    font-size: 17px;
    line-height: 1;
    margin-right: auto;
  }
  .farabi-mega-detail .farabi-mega-row {
    min-height: 58px;
    border-bottom: 1px solid rgba(199,223,211,.37) !important;
    border-radius: 5px !important;
  }
  .farabi-mega-detail .farabi-mega-row[aria-pressed="true"] {border-color: rgba(177,219,192,.66) !important;}
  .farabi-mega-detail .farabi-mega-row-name {font-size: 11.4px;}
  .farabi-mega-subhead {
    margin: 15px 10px 8px;
    color: #2a785c;
    font-size: 11px;
    font-weight: 650;
    padding-bottom: 7px;
    border-bottom: 1px solid rgba(18,112,77,.15);
  }
  .farabi-mega-product {
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin: 1px 2px 3px !important;
    padding: 7px 11px !important;
    border-radius: 7px;
    color: #31594b !important;
    font-weight: 500;
    font-size: 11px;
    text-decoration: none !important;
    transition: background .2s;
  }
  .farabi-mega-product:hover, .farabi-mega-product:focus-visible {
    background: #e5f4e9;
    color: #09674b !important;
  }
  .farabi-mega-product::before {
    content: "";
    width: 5px;
    height: 5px;
    border: 1.5px solid #6aad8a;
    border-radius: 50%;
    flex: 0 0 auto;
  }
  .farabi-mega-promo {
    position: relative;
    padding: 17px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    isolation: isolate;
    border: 1px solid rgba(255,255,255,.94);
    background: linear-gradient(180deg,rgba(209,233,221,.36),rgba(250,255,252,.82) 58%,rgba(217,241,230,.82));
    overflow: hidden;
  }
  .farabi-mega-art {
    position: absolute;
    z-index: -1;
    top: 0;
    right: 0;
    width: 100%;
    height: 58%;
    pointer-events: none;
    overflow: hidden;
  }
  .farabi-mega-art::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 70% 40%,rgba(152,216,184,.5),transparent 62%),linear-gradient(180deg,transparent,rgba(250,255,253,.82));
  }
  .farabi-mega-art svg {
    width: 100%;
    height: 100%;
    display: block;
    opacity: .87;
  }
  .farabi-mega-promo-en {
    font: 500 10px/1.4 Arial, sans-serif;
    direction: ltr;
    color: #68877c;
    letter-spacing: .1em;
    margin-bottom: 10px;
  }
  .farabi-mega-promo h3 {
    color: #0b5944 !important;
    font-size: 17px !important;
    font-weight: 700;
    margin: 0 0 10px !important;
    line-height: 1.8 !important;
  }
  .farabi-mega-accent {width: 36px; height: 2px; background: #268862;border-radius:20px;margin-bottom: 14px;}
  .farabi-mega-promo p {
    color: #537266;
    font-size: 11px;
    line-height: 2.15;
    margin: 0 0 16px !important;
  }
  .farabi-mega-primary-link {
    background: rgba(255,255,255,.58) !important;
    border: 1px solid rgba(255,255,255,.95) !important;
    border-radius: 23px;
    padding: 10px 11px !important;
    display: flex !important;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    color: #155f47 !important;
    font-weight: 650;
    font-size: 10.7px;
    text-decoration: none !important;
  }
  .farabi-mega-primary-link:hover {
    color: #063f32 !important;
    background: #e6f4ec !important;
  }
  .farabi-mega-link-arrow {
    background: #0d7755;
    color: #fff;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    width: 29px;
    height: 29px;
    font-size: 18px;
  }
  .farabi-mega-foot {
    margin-top: 9px;
    padding: 10px 7px;
    min-height: 65px;
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 5px;
    background: rgba(255,255,255,.62);
    border: 1px solid rgba(255,255,255,.96);
    border-radius: 11px;
    box-shadow: inset 0 1px 0 #fff;
  }
  .farabi-mega-foot-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-width: 0;
    border-left: 1px solid rgba(158,192,171,.28);
  }
  .farabi-mega-foot-item:last-child {border-left: 0}
  .farabi-mega-foot-ico {
    flex: 0 0 auto;
    width: 31px;
    height: 31px;
    border-radius: 50%;
    background: rgba(218,240,226,.78);
    display: grid;
    place-items: center;
    color: #0e704e;
    font-size: 17px;
  }
  .farabi-mega-foot-name {color:#1c473a;font-size:10.8px;font-weight:700;line-height:1.5}
  .farabi-mega-foot-desc {color:#7c9286;font-size:9.5px;line-height:1.6}
}
@media (min-width: 961px) and (max-width: 1210px) {
  .farabi-mega-main {grid-template-columns: 1fr 1fr 1.08fr; height: min(67vh,595px);}
  .farabi-mega-promo {display: none !important;}
  .farabi-mega-row {min-height: 49px;}
  .farabi-mega-row-name {font-size: 11px;}
  .farabi-mega-foot-desc {font-size: 9px;}
}
@media (min-width: 961px) and (max-height: 750px) {
  .farabi-mega-main {height: min(67vh,520px);min-height: 365px;}
  .farabi-mega-row {min-height: 44px;padding-top: 6px !important;padding-bottom: 6px !important;}
  .farabi-mega-panel {padding: 9px 8px;}
  .farabi-mega-foot {min-height: 50px;padding:6px}
}
@media (prefers-reduced-motion: reduce) {
  .farabi-mega * {transition: none !important;animation: none !important;}
}
/* Mobile: same WordPress menu content, native collapsible sections.
   Retain existing Astra header/menu layout and Products page hyperlink. */
@media (max-width: 960px) {
  #ast-mobile-header li.page-item-1455 {
    position: relative;
  }
  #ast-mobile-header li.page-item-1455 > a.menu-link {
    padding-left: 46px !important;
  }
  #ast-mobile-header .farabi-mobile-toggle {
    position: absolute;
    top: 5px;
    left: 8px;
    border: 1px solid #d6e8dd;
    border-radius: 6px;
    width: 31px;
    height: 31px;
    line-height: 1;
    padding: 0 !important;
    background: #eaf6ed;
    color: #22694d;
    font-size: 19px;
    cursor: pointer;
    z-index: 2;
  }
  #ast-mobile-header .farabi-mobile-toggle[aria-expanded="true"] {
    background: #d9eee1;
  }
  #ast-mobile-header .farabi-mobile-taxonomy[hidden] {
    display: none !important;
  }
  #ast-mobile-header .farabi-mobile-taxonomy {
    margin: 2px 5px 9px;
    padding: 7px;
    background: rgba(248,253,249,.98);
    border: 1px solid #daeadd;
    border-radius: 7px;
    max-height: 64vh;
    overflow-x: hidden;
    overflow-y: auto;
    direction: rtl;
    box-shadow: 0 9px 20px rgba(22,87,54,.07);
  }
  #ast-mobile-header .farabi-mobile-tier {
    display: block;
    margin: 1px 0;
    border-radius: 6px;
    border-bottom: 1px solid rgba(85,148,109,.13);
    background: transparent;
  }
  #ast-mobile-header .farabi-mobile-tier > summary {
    display: list-item;
    list-style-position: inside;
    cursor: pointer;
    padding: 10px 8px;
    text-align: right;
    font-size: 12px;
    font-weight: 600;
    color: #1b5742;
    line-height: 1.6;
  }
  #ast-mobile-header .farabi-mobile-tier[open] > summary {
    background: #e9f5ed;
    border-radius: 5px;
  }
  #ast-mobile-header .farabi-mobile-tier > .farabi-mobile-tier {
    margin: 0 12px 3px 0;
  }
  #ast-mobile-header a.farabi-mobile-product {
    display: block;
    margin: 2px 25px 4px 2px;
    padding: 8px 10px;
    border-radius: 5px;
    color: #256d51;
    font-size: 11.5px;
    text-decoration: none;
  }
  #ast-mobile-header a.farabi-mobile-product:hover,
  #ast-mobile-header a.farabi-mobile-product:focus-visible {
    background: #e4f1e8;
    color: #075b3d;
  }
}
@media (min-width: 961px) {
  .farabi-mega-icon svg {
    display: block;
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6px;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .farabi-mega-row:focus-visible,
  .farabi-mega-primary-link:focus-visible,
  .farabi-mega-product:focus-visible {
    outline: 2px solid #187a55 !important;
    outline-offset: 2px;
  }
  .farabi-mega-foot-item > span:last-child {
    min-width: 0;
    display: flex;
    flex-direction: column;
  }
}

/* farabi-mega-hover-only: rows switch on click; hover only highlights */
.farabi-mega .farabi-mega-row{cursor:pointer;}
.farabi-mega .farabi-mega-row:hover:not([aria-pressed="true"]){background:rgba(178,224,202,.20) !important;border-color:rgba(177,219,192,.50) !important;}
.farabi-mega .farabi-mega-catlink{font-weight:600;}

/* farabi-mega-product-size: product names in «فرآورده‌های مرتبط» / "Related products" +2px (11px -> 13px) */
@media (min-width: 961px) {
  .farabi-mega .farabi-mega-detail .farabi-mega-product{font-size:13px;line-height:1.45;}
}
