/* Mobile sizing shared by public, customer and admin layouts. */
@media (max-width: 767.98px) {
  :is(.glass-customer:not(.hs-addfunds-page), .glass-admin) {
    --mobile-gutter: clamp(10px, 3.5vw, 18px);
  }

  #body.glass-customer-app:not(.hs-addfunds-page) #main_container .content {
    min-width: 0;
    padding-inline: var(--mobile-gutter);
  }

  #body.glass-customer-app:not(.hs-addfunds-page) #main_container .content > .container-fluid,
  #body.glass-customer-app:not(.hs-addfunds-page) #main_container #accountpage > .container-fluid {
    padding-inline: 0;
  }

  .glass-customer:not(.hs-addfunds-page) .order-page-heading {
    gap: 12px;
  }

  .glass-customer:not(.hs-addfunds-page) .order-heading-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .glass-customer:not(.hs-addfunds-page) .order-heading-actions .btn {
    display: grid;
    place-items: center;
    white-space: normal;
  }

  .glass-customer:not(.hs-addfunds-page) .order-entry-layout > .container-fluid {
    padding-inline: 0;
  }

  .glass-customer-guest .api-docs.api-public {
    padding-inline: var(--mobile-gutter);
  }

  :is(.glass-customer:not(.hs-addfunds-page), .glass-admin) :is(input:not([type]), input[type="text"], input[type="email"], input[type="tel"], input[type="url"], input[type="password"], input[type="search"], input[type="number"], select, textarea).form-control {
    font-size: 16px !important;
    min-width: 0;
  }

  :is(.glass-customer:not(.hs-addfunds-page), .glass-admin) :is(.table-responsive, .api-table-scroll, .uc-table-scroll, .pm-scroll, .payments-scroll, .admin-scroll-region) {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }

  :is(.glass-customer:not(.hs-addfunds-page), .glass-admin) .modal-dialog {
    width: auto;
    max-width: calc(100% - 2 * var(--mobile-gutter));
    margin-inline: auto;
  }

  .glass-admin #ahContent :is(.uc-hero-actions, .uc-search-wrap, .pm-head, .pm-head-right) {
    min-width: 0;
    flex-wrap: wrap;
  }

  .glass-admin #ahContent :is(.pm-head-right, .pm-search) {
    width: 100%;
    max-width: 100%;
  }

  :is(.glass-customer:not(.hs-addfunds-page), .glass-admin) :is(.order-heading-actions .btn, #hsSidebar .menu_item, .ah-sidebar-nav .nav-link) {
    min-height: 44px;
  }
}

/* Keep the order form within reach on phones and in short landscape viewports. */
@media (max-width: 767.98px), (max-width: 991.98px) and (max-height: 550px) and (orientation: landscape) {
  #body.dashboard.glass-customer.glass-customer-app #main_container #new-order-cats {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 6px !important;
    padding: 7px !important;
  }

  #body.dashboard.glass-customer.glass-customer-app #main_container #new-order-cats > .nwo-cat-btn {
    display: grid !important;
    justify-items: center;
    align-content: center;
    gap: 3px;
    min-width: 0;
    width: 100% !important;
    min-height: 46px;
    height: auto;
    padding: 5px 4px !important;
    margin: 0;
    text-align: center;
    white-space: normal !important;
    line-height: 1.15;
  }

  .glass-customer-app #new-order-cats > .nwo-cat-btn i {
    font-size: 16px;
    margin: 0;
  }

  .glass-customer-app #new-order-cats > .nwo-cat-btn .filter_txt {
    display: block !important;
    min-width: 0;
    max-width: 100%;
    font-size: 11px;
    line-height: 1.2;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }

  #body.glass-customer-app:not(.hs-addfunds-page) #main_container .top_head_wrap {
    gap: 5px;
    padding-inline: 8px !important;
  }

  #body.glass-customer-app:not(.hs-addfunds-page) #main_container .top_head_wrap > .item {
    display: flex;
    min-width: 0;
    gap: 5px !important;
    align-items: center;
  }

  #body.glass-customer-app:not(.hs-addfunds-page) #main_container .top_header .logo_off_nav {
    min-width: 0;
    margin: 0;
  }

  #body.glass-customer-app:not(.hs-addfunds-page) #main_container .top_header .logo_off_nav img {
    width: clamp(84px, 29vw, 148px) !important;
    max-width: 100% !important;
    height: auto;
    object-fit: contain;
  }

  #body.glass-customer-app:not(.hs-addfunds-page) #main_container .top_header .day_night_btn {
    display: grid !important;
    place-items: center;
    flex: 0 0 42px;
    width: 42px !important;
    height: 42px !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  #body.glass-customer-app:not(.hs-addfunds-page) #main_container .top_header .day_night_btn .active_circle,
  #body.glass-customer-app:not(.nightmode):not(.hs-addfunds-page) #main_container .top_header .day_night_btn .day_mode,
  #body.glass-customer-app.nightmode:not(.hs-addfunds-page) #main_container .top_header .day_night_btn .night_mode {
    display: none !important;
  }

  #body.glass-customer-app:not(.hs-addfunds-page) #main_container .top_header .day_night_btn :is(.night_mode, .day_mode) {
    position: static !important;
    transform: none !important;
    padding: 0 !important;
    margin: 0 !important;
    color: var(--workspace-accent, #184bc2) !important;
  }

  #body.glass-customer-app:not(.hs-addfunds-page) #main_container .top_header :is(.sidebar_menu_icon, #dropdownMenuButton1) {
    flex-shrink: 0;
    width: 42px !important;
    min-width: 42px !important;
  }

  html:has(#adminBody.glass-admin),
  #adminBody.glass-admin,
  body.glass-customer:not(.hs-addfunds-page) {
    background-attachment: scroll !important;
  }

  #adminBody.glass-admin :is(.navbar, .panel, .card, .glass-admin-card, .dropdown-menu, .modal-content, .glass-modal-content),
  body.glass-customer:not(.hs-addfunds-page) :is(#main_container .top_header, .card_v2, .matrix-stat-card, .modal-content) {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  #adminBody.glass-admin .ah-sidebar-nav,
  body.glass-customer:not(.hs-addfunds-page) .sidebar_bottom {
    overscroll-behavior-y: contain;
  }
}

@media (min-width: 560px) and (max-width: 767.98px), (min-width: 560px) and (max-width: 991.98px) and (max-height: 550px) and (orientation: landscape) {
  #body.dashboard.glass-customer.glass-customer-app #main_container #new-order-cats {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  }
}

/* Leave room beside the floating support button without a blank footer tail. */
@media (max-width: 767.98px), (max-width: 991.98px) and (max-height: 550px) and (orientation: landscape) {
  #body.dashboard.glass-customer:not(.hs-addfunds-page) #main_container .content_area .content:has(> .glass-site-footer) {
    padding-bottom: 0 !important;
  }

  #body.dashboard.glass-customer:not(.hs-addfunds-page) #main_container .content_area .content > .glass-site-footer {
    margin-inline: -14px;
  }

  body.glass-customer:not(.hs-addfunds-page) :is(.glass-site-footer, .footer__v2) {
    box-sizing: border-box;
    margin-bottom: 0;
    padding: 16px max(70px, env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)) !important;
  }

  body.glass-customer .glass-site-footer {
    align-items: center;
    justify-content: flex-start;
    column-gap: 18px;
  }

  body.glass-customer .glass-site-footer nav {
    gap: 6px 14px;
  }

  body.glass-customer .glass-site-footer nav a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
  }

  #adminBody.glass-admin #ahContent:has(> .glass-admin-footer) {
    padding-bottom: env(safe-area-inset-bottom) !important;
  }

  #adminBody.glass-admin .glass-admin-footer {
    margin-bottom: 12px !important;
    flex-wrap: wrap;
    row-gap: 8px;
  }
}

/* Use opaque theme surfaces so navigation and text stay clear while scrolling. */
#body.dashboard.glass-customer:not(.hs-addfunds-page) #main_container :is(#hsSidebar .user_data, .content_area .top_header),
#body.dashboard.glass-customer:not(.hs-addfunds-page) :is(.hs-sidebar-overlay, .card, .card_v2, .panel, .statistic__item, .box, .matrix-stat-card, .matrix-panel),
body.glass-customer-guest :is(.navbar, .card, .card_v2, .modal-content),
#adminBody.glass-admin :is(#ahSidebar, .navbar, .ah-methods-topbar, .panel, .card, .glass-admin-card, .db-card, .db-panel, .db-notif, .dropdown-menu, .modal-content, .glass-modal-content) {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

#body.dashboard.glass-customer:not(.hs-addfunds-page) #main_container :is(#hsSidebar, .content_area .top_header),
#adminBody.glass-admin :is(#ahSidebar, .navbar, .ah-methods-topbar) {
  background: var(--workspace-panel) !important;
  border-color: var(--workspace-border) !important;
  box-shadow: none !important;
  text-shadow: none;
}

#body.dashboard.glass-customer:not(.hs-addfunds-page) #main_container #hsSidebar .user_data {
  background: var(--workspace-field) !important;
}

#body.dashboard.glass-customer:not(.hs-addfunds-page) #main_container #hsSidebar :is(.menu_item, #showMore),
#adminBody.glass-admin #ahSidebar .nav-link {
  color: var(--workspace-ink) !important;
  text-shadow: none !important;
  box-shadow: none !important;
}

#body.dashboard.glass-customer:not(.hs-addfunds-page) #main_container #hsSidebar .menu_item:is(.active, [aria-current="page"]),
#adminBody.glass-admin #ahSidebar .nav-link:is(.active, [aria-current="page"]) {
  background: var(--workspace-selected) !important;
  color: var(--workspace-accent) !important;
  font-weight: 650;
}

#body.dashboard.glass-customer:not(.hs-addfunds-page) #main_container #hsSidebar .menu_item .menu_icon i,
#adminBody.glass-admin #ahSidebar .nav-link i {
  color: inherit !important;
  text-shadow: none !important;
}
