/* ==========================================================================
   Mobile "Account" panel redesign
   (design ref: MSP Mobile Account Menu / "Drawer — Alternative")

   Standalone stylesheet, loaded on every page via
   Magento_Theme::layout/default_head_blocks.xml (same mechanism as
   custom.css), independent of Emizen\Filterbrand's per-page-type critical
   CSS switch (critical.css / critical_product.css / critical_category.css /
   etc.) — so this one file governs the mobile account menu everywhere,
   with no duplication across those files.

   Additive and scoped to <=1023px only. Does not touch the "Menu" tab,
   does not change any PHP/JS — reuses the existing real `.header.panel >
   .header.links` list (Help / Owner Resources / My Account / My Wish List /
   Sign Out / Sign In / Create an Account / rewards balance) as the panel's
   content instead of the empty `#store.links` tab slot, and drives
   open/close off the same `.active` class core Magento's tabs widget
   already toggles on the Account tab.

   NOTE: header.css is inlined on every page (via CriticalCss, after
   whichever critical_*.css variant matches the current page type) and
   carries higher-specificity, later-position rules for the same elements
   (e.g. `.page-header.page-header-top .header.panel > .header.links > li
   { display: none; }`), so every rule below matches or exceeds that
   `.page-header.page-header-top` prefix AND uses !important on the
   properties that rule chain actually fights over.
   ========================================================================== */
@media (max-width: 1023px) {

  /* Give the Account tab a visible active state (previously erased by
     `.nav-sections-item-title.active { border-bottom: transparent }`). */
  .nav-sections-item-title:has(> a[href="#store.links"]).active {
    background: #fdf3ea !important;
  }
  .nav-sections-item-title:has(> a[href="#store.links"]).active > a {
    color: #ad5700 !important;
    font-weight: 700 !important;
  }

  /* #store.links renders empty in this theme; collapse that slot and drive
     a dedicated panel off the same active state instead. */
  #store\.links {
    display: none !important;
  }

  /* The overridden minicart.phtml prepends an empty, label-less "My
     Account" icon-link (.acount-link) ahead of the cart icon. It's a
     redundant duplicate of the real "My Account" row below, so hide just
     that icon — not the cart icon next to it, which is the only way to
     reach the cart on mobile. (A <div> isn't valid directly inside the
     <ul class="header links"> it's moved into, so browsers hoist it out
     as a sibling rather than a flex child — hence the broad .header.panel
     scope here instead of a `.header.links >` child selector.) */
  .page-header.page-header-top .header.panel .acount-link {
    display: none !important;
  }

  .page-header.page-header-top .header.panel > .header.links {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 56px 0 24px !important;
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: auto !important;
    width: 320px !important;
    max-width: 85vw !important;
    height: 100% !important;
    height: 100dvh !important;
    background: #fff !important;
    box-shadow: -8px 0 24px rgba(0, 0, 0, .18) !important;
    overflow-y: auto !important;
    z-index: 1000 !important;
    transform: translateX(100%) !important;
    transition: transform .3s ease !important;
  }

  body:has(.nav-sections-item-title.active > a[href="#store.links"])
  .page-header.page-header-top .header.panel > .header.links {
    transform: translateX(0) !important;
  }

  .page-header.page-header-top .header.panel > .header.links::before {
    content: "Your Account";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 18px 20px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #6b6b6b;
    background: #fff;
    border-bottom: 1px solid #eee;
  }

  /* Row reset for the rows this redesign actually touches. Other rows in
     this list (minicart, etc.) are intentionally left to whatever
     header.css already does with them. */
  .page-header.page-header-top .header.panel > .header.links > li.greet.welcome,
  .page-header.page-header-top .header.panel > .header.links > li:has(> #mini-login-mobile),
  .page-header.page-header-top .header.panel > .header.links > li:has(> #mini-register-mobile),
  .page-header.page-header-top .header.panel > .header.links > li.top-menu-owner,
  .page-header.page-header-top .header.panel > .header.links > li:has(nav[aria-label="Help"]),
  .page-header.page-header-top .header.panel > .header.links > li:has(nav[aria-label="Owner resources"]) {
    display: block !important;
    order: 10;
    border-top: 1px solid #f0f0f0 !important;
    border-right: none !important;
    border-left: none !important;
    border-bottom: none !important;
    padding: 0 20px !important;
    margin: 0 !important;
    list-style: none !important;
    position: static !important;
    width: auto !important;
  }
  .page-header.page-header-top .header.panel > .header.links > li.greet.welcome {
    order: 0;
    border-top: none !important;
    font-size: 13px !important;
    color: #6b6b6b !important;
    padding: 14px 20px 0 !important;
  }

  /* CTA rows: Sign In / Create an Account */
  .page-header.page-header-top .header.panel > .header.links > li:has(> #mini-login-mobile),
  .page-header.page-header-top .header.panel > .header.links > li:has(> #mini-register-mobile) {
    border-top: none !important;
    padding: 8px 20px 0 !important;
  }
  .page-header.page-header-top .header.panel > .header.links > li:has(> #mini-login-mobile) {
    order: 1;
  }
  .page-header.page-header-top .header.panel > .header.links > li:has(> #mini-register-mobile) {
    order: 2;
    padding-top: 10px !important;
  }

  .page-header.page-header-top .header.panel > .header.links > li:has(> #mini-login-mobile) > a,
  .page-header.page-header-top .header.panel > .header.links > li:has(> #mini-register-mobile) > a {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 48px !important;
    border-radius: 4px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    text-decoration: none !important;
  }
  .page-header.page-header-top .header.panel > .header.links > li:has(> #mini-login-mobile) > a {
    background: #ad5700 !important;
    color: #fff !important;
  }
  .page-header.page-header-top .header.panel > .header.links > li:has(> #mini-register-mobile) > a {
    background: #fff !important;
    border: 2px solid #ad5700 !important;
    color: #ad5700 !important;
  }

  /* Quick-link rows: My Account (guest) / Help / Owner Resources.
     Reset the desktop-oriented `.top-indexing{float:left;width:130px}`
     box so the row can use the panel's full width. */
  .page-header.page-header-top .header.panel > .header.links > li.top-menu-owner {
    order: 3;
  }
  .page-header.page-header-top .header.panel > .header.links > li:has(nav[aria-label="Help"]) {
    order: 7;
  }
  .page-header.page-header-top .header.panel > .header.links > li:has(nav[aria-label="Owner resources"]) {
    order: 8;
  }

  .page-header.page-header-top .header.panel > .header.links > li.top-menu-owner .top-indexing,
  .page-header.page-header-top .header.panel > .header.links > li:has(nav[aria-label="Help"]) .top-indexing,
  .page-header.page-header-top .header.panel > .header.links > li:has(nav[aria-label="Owner resources"]) .top-indexing {
    float: none !important;
    width: 100% !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    min-height: 48px !important;
  }
  .page-header.page-header-top .header.panel > .header.links > li.top-menu-owner .top-indexing nav,
  .page-header.page-header-top .header.panel > .header.links > li.top-menu-owner .top-indexing nav > ul,
  .page-header.page-header-top .header.panel > .header.links > li:has(nav[aria-label="Help"]) .top-indexing nav,
  .page-header.page-header-top .header.panel > .header.links > li:has(nav[aria-label="Help"]) .top-indexing nav > ul,
  .page-header.page-header-top .header.panel > .header.links > li:has(nav[aria-label="Owner resources"]) .top-indexing nav,
  .page-header.page-header-top .header.panel > .header.links > li:has(nav[aria-label="Owner resources"]) .top-indexing nav > ul {
    width: 100% !important;
  }
  .page-header.page-header-top .header.panel > .header.links > li.top-menu-owner .top-indexing .toggle_index,
  .page-header.page-header-top .header.panel > .header.links > li:has(nav[aria-label="Help"]) .top-indexing .toggle_index,
  .page-header.page-header-top .header.panel > .header.links > li:has(nav[aria-label="Owner resources"]) .top-indexing .toggle_index {
    width: 100% !important;
    padding: 0 !important;
    background: none !important;
  }

  .page-header.page-header-top .header.panel > .header.links .custom-myacc,
  .page-header.page-header-top .header.panel > .header.links .custom-help,
  .page-header.page-header-top .header.panel > .header.links .ownr_res {
    display: block !important;
    width: 100% !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #2f2f2f !important;
    cursor: pointer;
    background: none !important;
    padding: 2px 0 !important;
  }
  .page-header.page-header-top .header.panel > .header.links .custom-myacc::before,
  .page-header.page-header-top .header.panel > .header.links .custom-help::before,
  .page-header.page-header-top .header.panel > .header.links .ownr_res::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 10px;
    vertical-align: middle;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 20px;
  }
  .page-header.page-header-top .header.panel > .header.links .custom-myacc::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ad5700' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 20c0-4 3.6-6.5 8-6.5s8 2.5 8 6.5'/%3E%3C/svg%3E");
  }
  .page-header.page-header-top .header.panel > .header.links .custom-help::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ad5700' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M9.5 9.2a2.5 2.5 0 1 1 3.7 2.2c-.8.5-1.2 1-1.2 2'/%3E%3Cline x1='12' y1='16.8' x2='12' y2='16.9'/%3E%3C/svg%3E");
  }
  .page-header.page-header-top .header.panel > .header.links .ownr_res::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ad5700' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 5.5A2.5 2.5 0 0 1 6.5 3H20v15H6.5A2.5 2.5 0 0 0 4 20.5Z'/%3E%3Cpath d='M4 5.5v15'/%3E%3C/svg%3E");
  }

  .page-header.page-header-top .header.panel > .header.links .custom-myacc::after,
  .page-header.page-header-top .header.panel > .header.links .custom-help::after,
  .page-header.page-header-top .header.panel > .header.links .ownr_res::after {
    content: "";
    float: right;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b0b0b0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'/%3E%3C/svg%3E") center / 16px no-repeat;
  }
}

/* Accordion, not overlay: the shared .toggle_index ul.dropdown styling
   (used elsewhere for a desktop hover flyout) is position:absolute,
   which floats the opened submenu over the next row instead of pushing
   it down. In the panel it should expand in place like a real accordion. */
@media (max-width: 1023px) {
  .page-header.page-header-top .header.panel > .header.links .top-indexing ul.dropdown {
    position: static !important;
    width: 100% !important;
    max-width: none !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    margin: 4px 0 0 !important;
    box-shadow: none !important;
    border-top: 1px solid #f0f0f0 !important;
  }
  .page-header.page-header-top .header.panel > .header.links .top-indexing ul.dropdown li {
    background: none !important;
  }
  .page-header.page-header-top .header.panel > .header.links .top-indexing ul.dropdown li a {
    display: block;
    padding: 10px 0 10px 30px !important;
    color: #2f2f2f !important;
    font-size: 14px;
    text-decoration: none !important;
  }
  .page-header.page-header-top .header.panel > .header.links .top-indexing ul.dropdown li:hover a {
    color: #ad5700 !important;
  }
}

/* Inline panel that opens directly under the "Menu | Account" tab bar,
   full width, same as how the Menu tab's own content displays — no
   separate side drawer.
   (71px = measured real height of .nav-sections-item-title tabs at
   mobile widths; 54px = the reserved right-edge strip .nav-sections
   itself already uses so the two stay visually aligned.) */
@media (max-width: 1023px) {
  .page-header.page-header-top .header.panel > .header.links {
    display: none !important;
    position: fixed !important;
    top: 71px !important;
    left: 0 !important;
    right: 54px !important;
    bottom: 0 !important;
    width: auto !important;
    max-width: none !important;
    height: auto !important;
    padding: 0 0 24px !important;
    box-shadow: none !important;
    border-top: 1px solid #e0e0e0 !important;
    transform: none !important;
    transition: none !important;
  }

  body:has(.nav-sections-item-title.active > a[href="#store.links"])
  .page-header.page-header-top .header.panel > .header.links {
    display: flex !important;
  }

  /* No separate "Your Account" heading needed — the Account tab above
     is already the label. */
  .page-header.page-header-top .header.panel > .header.links::before {
    content: none !important;
  }

  .page-header.page-header-top .header.panel > .header.links > li.greet.welcome {
    padding-top: 16px !important;
  }
  .page-header.page-header-top .header.panel > .header.links > li:has(> #mini-login-mobile) {
    padding-top: 16px !important;
  }
}

/* ==========================================================================
   My Account / My Wish List / Sign Out + Amasty rewards-balance link.

   my_account_link.phtml (li.top-menu-owner) now renders its own nested
   dropdown for logged-in users too (My Account / My Wish List / Sign Out),
   reusing the exact same toggle_index/.active accordion already working
   for Help / Owner Resources — see that template. That makes the whole
   customer-welcome block (Magento core's separate "Change" dropdown
   widget, with My Account / My Wish List / Sign Out duplicated again)
   entirely redundant, so it's just hidden outright below rather than
   unwrapped/restyled.
   ========================================================================== */
@media (max-width: 1023px) {
  .page-header.page-header-top .header.panel > .header.links > li.customer-welcome {
    display: none !important;
  }

  .page-header.page-header-top .header.panel > .header.links > li.amrewards-balance-container {
    display: block !important;
    order: 9;
    border-top: 1px solid #f0f0f0 !important;
    border-right: none !important;
    border-left: none !important;
    border-bottom: none !important;
    padding: 14px 20px !important;
    margin: 0 !important;
    list-style: none !important;
    position: static !important;
    width: auto !important;
  }
  .page-header.page-header-top .header.panel > .header.links > li.amrewards-balance-container a {
    display: flex !important;
    align-items: center !important;
    min-height: 48px !important;
    text-decoration: none !important;
  }
  .page-header.page-header-top .header.panel > .header.links > li.amrewards-balance-container .amrewards-amount {
    margin-left: auto !important;
    float: none !important;
  }
}
