/* =====================================================
   ROBOTIMALL HEADER V1.6K START
   Single native Sunnytoo customer account control
   ===================================================== */

@media (min-width: 768px) {

  /* Main four-column layout */

  body #st_header #header_primary_row {
    display: grid !important;
    grid-template-columns:
      clamp(140px, 14vw, 185px)
      minmax(220px, 1fr)
      max-content
      clamp(95px, 9vw, 120px);
    direction: rtl !important;
    align-items: center;
    column-gap: clamp(8px, 1.2vw, 18px);
    min-height: 94px;
  }

  /* Logo */

  body #st_header #header_left {
    grid-column: 1;
    width: auto !important;
    min-width: 0 !important;
    margin: 0 !important;
  }

  body #st_header #header_left .header_box {
    justify-content: flex-start;
  }

  /* Dedicated search column */

  body #st_header #rm_header_search {
    grid-column: 2;
    position: relative;
    width: 100%;
    min-width: 0;
  }

  body #st_header #rm_header_search > .ets_search_block_top {
    display: block !important;
    float: none !important;
    flex: none !important;
    position: relative;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;
  }

  body #st_header #rm_header_search .ybc_searchbox {
    position: relative;
    width: 100% !important;
    max-width: 100% !important;
  }

  body #st_header #rm_header_search .search_query_top {
    direction: rtl;
    text-align: right;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
    padding-right: 12px;
    padding-left: 65px;
  }

  body #st_header #rm_header_search .button-search {
    left: 0 !important;
    right: auto !important;
  }

  /* Action column */

  body #st_header #header_center {
    grid-column: 3;
    width: max-content !important;
    min-width: 0 !important;
    margin: 0 !important;
    flex: none !important;
  }

  body #st_header #header_center > .header_box {
    display: block !important;
    width: auto !important;
    min-width: 0 !important;
  }

  body #st_header .rm-header-actions {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    direction: rtl !important;
    align-items: center !important;
    gap: 0 !important;
    width: max-content;
  }

  /* Disable duplicate Panda search */

  body #st_header .rm-header-actions > .search_widget_block {
    display: none !important;
  }

  /* Native guest/login control and logged-in account control */

  body #st_header
  .rm-header-actions > .quick_login,
  body #st_header
  .rm-header-actions > .userinfo_mod_top {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    flex: 0 0 140px !important;
    width: 140px !important;
    height: 72px !important;
    min-height: 72px !important;
    margin: 0 !important;
    padding: 0 8px !important;
    box-sizing: border-box;
    overflow: visible !important;
  }

  /* Entire icon + label remains one clickable trigger */

  body #st_header
  .rm-header-actions > .quick_login > a.dropdown_tri,
  body #st_header
  .rm-header-actions > .userinfo_mod_top > a.dropdown_tri {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    width: 100% !important;
    min-height: 72px !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 5px !important;
    text-align: center !important;
    white-space: nowrap;
  }

  /* Native Sunnytoo icon: no absolute positioning */

  body #st_header
  .rm-header-actions > .quick_login .header_icon_btn_icon,
  body #st_header
  .rm-header-actions > .userinfo_mod_top .header_icon_btn_icon {
    position: static !important;
    display: block !important;
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
    line-height: 1 !important;
  }

  body #st_header
  .rm-header-actions > .quick_login .header_icon_btn_icon i,
  body #st_header
  .rm-header-actions > .userinfo_mod_top .header_icon_btn_icon i {
    margin: 0 !important;
  }

  /* Guest label */

  body #st_header
  .rm-header-actions > .quick_login .header_icon_btn_text {
    display: block !important;
    font-size: 0 !important;
    line-height: 18px !important;
    margin: 0 !important;
    white-space: nowrap;
  }

  body #st_header
  .rm-header-actions > .quick_login .header_icon_btn_text::after {
    content: "ورود / ثبت‌نام";
    display: block;
    font-size: 12px;
    line-height: 18px;
  }

  /* Logged-in customer: real name supplied by module */

  body #st_header
  .rm-header-actions > .userinfo_mod_top .header_icon_btn_text {
    display: block !important;
    font-size: 12px !important;
    line-height: 18px !important;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0 !important;
  }

  /* Hide only decorative arrows, not dropdown behavior */

  body #st_header
  .rm-header-actions > .quick_login > a > .arrow,
  body #st_header
  .rm-header-actions > .userinfo_mod_top > a > .arrow {
    display: none !important;
  }

  /* Compare and wishlist */

  body #st_header
  .rm-header-actions > .stcompare_link,
  body #st_header
  .rm-header-actions > .loved_link {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative;
    flex: 0 0 88px !important;
    width: 88px !important;
    height: 72px !important;
    margin: 0 !important;
    padding: 0 8px !important;
    box-sizing: border-box;
    border-right: 1px solid #e6e9ee;
    white-space: nowrap;
  }

  body #st_header
  .rm-header-actions > .loved_link {
    flex-basis: 96px !important;
    width: 96px !important;
  }

  body #st_header
  .rm-header-actions > .stcompare_link .header_item,
  body #st_header
  .rm-header-actions > .loved_link .header_item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center;
    gap: 4px;
  }

  body #st_header
  .rm-header-actions > .stcompare_link .header_icon_btn_icon,
  body #st_header
  .rm-header-actions > .loved_link .header_icon_btn_icon {
    margin: 0 !important;
  }

  /* Wishlist display label only */

  body #st_header
  .rm-header-actions > .loved_link .header_icon_btn_text {
    font-size: 0 !important;
  }

  body #st_header
  .rm-header-actions > .loved_link .header_icon_btn_text::after {
    content: "علاقه‌مندی‌ها";
    font-size: 11px;
    line-height: 1.4;
  }

  /* Cart column: preserve working Panda badge */

  body #st_header #header_right {
    grid-column: 4;
    width: auto !important;
    min-width: 0 !important;
    flex: none !important;
    margin: 0 18px 0 0 !important;
  }

  body #st_header #header_right_top {
    justify-content: center;
  }

  body #st_header #header_right_top > .ets_search_block_top {
    display: none !important;
  }

  body #st_header #header_right_top > .blockcart {
    border-right: 1px solid #e6e9ee;
    padding-right: 16px;
    padding-left: 10px;
  }

  body #st_header #header_right .st_shopping_cart {
    position: relative;
    display: block;
  }

  body #st_header #header_right .st_shopping_cart > .flex_container {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px;
    position: relative;
  }

  body #st_header #header_right .st_shopping_cart .ajax_cart_bag {
    margin: 0 !important;
  }

  body #st_header #header_right .st_shopping_cart .cart_text {
    display: block !important;
    margin: 0 !important;
    line-height: 1.5;
    text-align: center;
    white-space: nowrap !important;
  }

  body #st_header #header_right .st_shopping_cart .ajax_cart_product_txt,
  body #st_header #header_right
  .st_shopping_cart > .flex_container > .ajax_cart_quantity {
    display: none !important;
  }

  body #st_header #header_right
  .st_shopping_cart .ajax_cart_bag > .ajax_cart_quantity.amount_circle {
    display: inline-block !important;
    position: absolute;
    top: -6px;
    right: 10px;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 999px;
    background: #d63031;
    color: #fff;
    font-size: 11px;
    padding: 0 4px;
    margin: 0 !important;
  }
}

/* Compact desktop and tablet */

@media (min-width: 768px) and (max-width: 1199px) {
  body #st_header #header_primary_row {
    grid-template-columns: 125px minmax(160px, 1fr) max-content 80px;
    column-gap: 8px;
  }

  body #st_header .rm-header-actions > .quick_login,
  body #st_header .rm-header-actions > .userinfo_mod_top {
    flex-basis: 116px !important;
    width: 116px !important;
  }

  body #st_header .rm-header-actions > .stcompare_link {
    flex-basis: 70px !important;
    width: 70px !important;
  }

  body #st_header .rm-header-actions > .loved_link {
    flex-basis: 76px !important;
    width: 76px !important;
  }

  body #st_header #header_right {
    margin-right: 0 !important;
  }
}

/* Keep Panda mobile layout intact */

@media (max-width: 767px) {
  body #st_header #rm_header_search {
    display: none !important;
  }
}

/* ROBOTIMALL HEADER V1.6K END */
/* ROBOTIMALL TABLET HEADER FLEX FIX V1 */
@media (min-width: 768px) and (max-width: 1199px) {
  body #st_header #header_primary_row {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 12px !important;
  }

  #header_left {
    flex: 0 0 220px !important;
    width: 220px !important;
  }

  #header_center {
    flex: 0 0 262px !important;
  }

  #rm_header_search {
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    transform: none !important;
  }
}
/* END ROBOTIMALL TABLET HEADER FLEX FIX V1 */
