/* Madhuma mobile app shell — bottom tab bar, install banner, standalone polish */

:root {
  --mh-tabbar-h: 0px;
  --mh-tabbar-content-h: 3.4rem;
}

@media (max-width: 767.98px) {
  body.mh-has-tabbar {
    --mh-tabbar-h: calc(var(--mh-tabbar-content-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: var(--mh-tabbar-h);
    scroll-padding-bottom: calc(var(--mh-tabbar-h) + 0.5rem);
  }

  /* Duplicates of bottom tab items — keep wishlist / theme / lang in the header */
  body.mh-has-tabbar #navbar-main .mh-header-search,
  body.mh-has-tabbar #navbar-main .mh-header-cart,
  body.mh-has-tabbar #navbar-main .mh-account-switcher--header {
    display: none !important;
  }
}

/* ---------- Bottom tab bar ---------- */

.mh-tabbar {
  display: none;
}

@media (max-width: 767.98px) {
  body.mh-has-tabbar .mh-tabbar {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10015;
    min-height: var(--mh-tabbar-content-h);
    padding: 0.2rem 0.15rem calc(0.2rem + env(safe-area-inset-bottom, 0px));
    margin: 0;
    background: color-mix(in srgb, var(--mh-nav-bg, #fcfaf6) 96%, transparent);
    backdrop-filter: saturate(1.2) blur(12px);
    -webkit-backdrop-filter: saturate(1.2) blur(12px);
    border-top: 1px solid var(--mh-line, #d9cfc0);
    box-shadow: 0 -6px 24px rgba(26, 18, 14, 0.06);
  }

  body.mh-cart-drawer-open .mh-tabbar,
  body.mh-search-open .mh-tabbar,
  body:has(.mh-cookie-prefs:not([hidden])) .mh-tabbar {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
  }

  .mh-tabbar-item {
    appearance: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    min-width: 0;
    min-height: 2.9rem;
    padding: 0.35rem 0.2rem;
    margin: 0;
    border: 0;
    border-radius: 0.55rem;
    background: transparent;
    color: var(--mh-muted, #4a3c32);
    text-decoration: none !important;
    font-family: var(--mh-body);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.1;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .mh-tabbar-item:hover,
  .mh-tabbar-item:focus {
    color: var(--mh-ink, #1a120e);
    text-decoration: none !important;
  }

  .mh-tabbar-item:focus-visible {
    outline: 2px solid var(--mh-lotus, #6f2f22);
    outline-offset: -2px;
  }

  .mh-tabbar-item.is-active {
    color: var(--mh-rosewood, #3f241c);
  }

  .mh-tabbar-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.55rem;
    height: 1.55rem;
    font-size: 1.15rem;
    line-height: 1;
  }

  .mh-tabbar-label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mh-tabbar-badge {
    position: absolute;
    top: -0.35rem;
    right: -0.55rem;
    min-width: 1.05rem;
    height: 1.05rem;
    padding: 0 0.28rem;
    border-radius: 999px;
    background: var(--mh-lotus, #6f2f22);
    color: var(--mh-on-accent, #fff8ef);
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1.05rem;
    text-align: center;
  }

  .mh-tabbar-badge.is-empty {
    display: none;
  }

  body.mh-cart-drawer-open .mh-tabbar,
  body.mh-search-open .mh-tabbar,
  body:has(.mh-cookie-prefs:not([hidden])) .mh-tabbar {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
  }

  /* Lift sticky commerce chrome above the tab bar */
  body.mh-has-tabbar .mh-sticky-product.sticky-strip {
    bottom: var(--mh-tabbar-h);
    padding-bottom: 0.7rem;
  }

  body.mh-has-tabbar .mh-festival-shop-bar {
    bottom: var(--mh-tabbar-h);
  }

  body.mh-has-tabbar .mh-festival-shop-bar-inner,
  body.mh-has-tabbar .mh-festival-shop-bar.is-collapsed .mh-festival-shop-bar-inner {
    padding-bottom: 0.7rem;
  }

  body.mh-has-tabbar .mh-wa-float {
    bottom: calc(var(--mh-tabbar-h) + 1rem);
  }

  body.mh-has-tabbar:has(.mh-sticky-product.sticky-strip.is-visible) .mh-wa-float {
    bottom: calc(var(--mh-tabbar-h) + 4.35rem);
  }

  body.mh-has-tabbar.mh-festival-shop-bar-open .mh-wa-float {
    bottom: calc(var(--mh-tabbar-h) + 5.35rem);
  }

  body.mh-has-tabbar.mh-festival-shop-bar-collapsed .mh-wa-float {
    bottom: calc(var(--mh-tabbar-h) + 4rem);
  }

  html.mh-cookie-banner-open body.mh-has-tabbar .mh-wa-float {
    bottom: calc(var(--mh-tabbar-h) + 5.5rem);
  }

  html.mh-cookie-banner-open body.mh-has-tabbar:has(.mh-sticky-product.sticky-strip.is-visible) .mh-wa-float {
    bottom: calc(var(--mh-tabbar-h) + 12.75rem);
  }

  html.mh-cookie-banner-open body.mh-has-tabbar .mh-sticky-product.sticky-strip.is-visible,
  html.mh-cookie-banner-open body.mh-has-tabbar .mh-festival-shop-bar.is-visible {
    bottom: calc(var(--mh-tabbar-h) + 8.5rem);
  }

  /* Festival bar open: reserve tab bar + bar height */
  body.mh-has-tabbar.mh-festival-shop-bar-open {
    padding-bottom: calc(var(--mh-tabbar-h) + 4.75rem);
  }

  body.mh-has-tabbar.mh-festival-shop-bar-collapsed {
    padding-bottom: calc(var(--mh-tabbar-h) + 3.5rem);
  }
}

/* ---------- Install banner ---------- */

.mh-install-banner {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  z-index: 10040;
  max-width: 28rem;
  margin: 0 auto;
  opacity: 0;
  transform: translateY(0.75rem);
  pointer-events: none;
  transition: opacity 0.28s var(--mh-ease, ease), transform 0.28s var(--mh-ease, ease);
}

.mh-install-banner.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

@media (max-width: 767.98px) {
  body.mh-has-tabbar .mh-install-banner {
    bottom: calc(var(--mh-tabbar-h) + 0.65rem);
  }
}

.mh-install-banner-inner {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1rem 1.1rem;
  border-radius: 1rem;
  background: var(--mh-white, #fcfaf6);
  border: 1px solid var(--mh-line, #d9cfc0);
  box-shadow: 0 14px 36px rgba(26, 18, 14, 0.16);
}

.mh-install-banner-title {
  margin: 0 0 0.25rem;
  font-family: var(--mh-display);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--mh-ink, #1a120e);
  line-height: 1.25;
}

.mh-install-banner-body {
  margin: 0;
  font-size: var(--mh-fs-small, 0.9375rem);
  color: var(--mh-muted, #4a3c32);
  line-height: 1.45;
}

.mh-install-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.mh-install-banner-actions .mh-btn-primary,
.mh-install-banner-actions .mh-btn-ghost {
  min-height: 2.5rem;
  padding: 0.45rem 1rem;
  font-size: 0.9rem;
}

.mh-install-ios-title {
  font-family: var(--mh-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--mh-ink, #1a120e);
}

.mh-install-ios-steps {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--mh-text, #2b211a);
  line-height: 1.55;
}

.mh-install-ios-steps li + li {
  margin-top: 0.55rem;
}

html[data-theme="dark"] .mh-install-banner-inner {
  background: var(--mh-paper-2, #1e1712);
  border-color: var(--mh-line, #3c3229);
}

html[data-theme="dark"] .mh-tabbar {
  background: color-mix(in srgb, var(--mh-nav-bg, #16110e) 96%, transparent);
  border-top-color: var(--mh-line, #3c3229);
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.28);
}

/* ---------- Standalone (installed) polish ---------- */

html.mh-standalone .mh-announce {
  display: none;
}

html.mh-standalone body.mh-site {
  padding-top: env(safe-area-inset-top, 0px);
}

@media (max-width: 767.98px) {
  html.mh-standalone #navbar-main {
    padding-top: 0.15rem;
  }

  html.mh-standalone .mh-hnav-bar {
    top: auto;
  }
}

/* ---------- My Madhuma — mobile app account menu ---------- */

.mh-account-nav-back {
  display: none;
}

.mh-account-nav-summary {
  display: none;
  list-style: none;
}

.mh-account-nav-summary::-webkit-details-marker {
  display: none;
}

.mh-account-nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.mh-account-nav-link-icon {
  display: none;
  flex: 0 0 auto;
  width: 1.35rem;
  text-align: center;
  color: var(--mh-muted, #4a3c32);
  font-size: 0.95rem;
}

.mh-account-nav-link-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
}

.mh-account-nav-link-label {
  min-width: 0;
  line-height: 1.25;
}

.mh-account-nav-link-chevron {
  display: none;
  flex: 0 0 auto;
  color: var(--mh-muted, #4a3c32);
  font-size: 0.7rem;
  opacity: 0.7;
}

.mh-account-nav a.is-active .mh-account-nav-link-icon,
.mh-account-nav-link.is-active .mh-account-nav-link-icon {
  color: var(--mh-rosewood, #3f241c);
}

@media (min-width: 768px) {
  .mh-account-nav-link-icon {
    display: inline-block;
  }

  .mh-account-nav-details > .mh-account-nav-list {
    display: flex !important;
  }
}

@media (max-width: 767.98px) {
  /* App hub: no website crumbs / chip quick actions */
  .mh-account .mh-breadcrumbs,
  .mh-account-quick {
    display: none !important;
  }

  .mh-account {
    padding-top: 0.35rem;
    padding-bottom: 1.25rem;
  }

  .mh-account-nav {
    margin: 0 0 1rem;
  }

  .mh-account-nav-label {
    display: none;
  }

  .mh-account-nav-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0 0 0.65rem;
    padding: 0.35rem 0.15rem;
    color: var(--mh-rosewood, #3f241c);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    touch-action: manipulation;
  }

  .mh-account-nav-back:hover,
  .mh-account-nav-back:focus {
    color: var(--mh-ink, #1a120e);
    text-decoration: none;
  }

  .mh-account-nav-back-icon {
    font-size: 0.75rem;
    line-height: 1;
  }

  .mh-account-nav-details {
    margin: 0;
    border: 1px solid var(--mh-line, #d9cfc0);
    border-radius: 0.85rem;
    background: var(--mh-white, #fcfaf6);
    overflow: hidden;
  }

  .mh-account-nav-summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 3rem;
    padding: 0.7rem 0.9rem;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .mh-account-nav--hub .mh-account-nav-summary {
    display: none;
  }

  .mh-account-nav-summary-label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--mh-muted, #4a3c32);
  }

  .mh-account-nav-summary-current {
    flex: 1 1 auto;
    min-width: 0;
    text-align: right;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--mh-ink, #1a120e);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mh-account-nav-summary-chevron {
    flex: 0 0 auto;
    font-size: 0.7rem;
    color: var(--mh-muted, #4a3c32);
    transition: transform 0.2s var(--mh-ease, ease);
  }

  .mh-account-nav-details[open] .mh-account-nav-summary-chevron {
    transform: rotate(180deg);
  }

  .mh-account-nav-list {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    overflow: visible !important;
    gap: 0 !important;
    padding: 0 !important;
    margin: 0;
  }

  .mh-account-nav--section .mh-account-nav-details:not([open]) .mh-account-nav-list {
    display: none !important;
  }

  .mh-account-nav--hub .mh-account-nav-details {
    border-radius: 0.95rem;
  }

  .mh-account-nav--section .mh-account-nav-details[open] .mh-account-nav-summary {
    border-bottom: 1px solid var(--mh-line, #d9cfc0);
  }

  .mh-account-nav-link,
  .mh-account-nav a.mh-account-nav-link {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    min-height: 3.15rem;
    padding: 0.75rem 0.95rem;
    margin: 0;
    border-radius: 0;
    border-bottom: 1px solid color-mix(in srgb, var(--mh-line, #d9cfc0) 70%, transparent);
    background: transparent;
    color: var(--mh-ink, #1a120e);
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    touch-action: manipulation;
  }

  .mh-account-nav-link:last-child,
  .mh-account-nav a.mh-account-nav-link:last-child {
    border-bottom: 0;
  }

  .mh-account-nav-link:hover,
  .mh-account-nav-link:focus {
    background: color-mix(in srgb, var(--mh-paper-2, #efe7da) 55%, transparent);
    text-decoration: none;
    color: var(--mh-ink, #1a120e);
  }

  .mh-account-nav-link.is-active {
    background: color-mix(in srgb, var(--mh-lotus, #6f2f22) 10%, transparent);
    font-weight: 650;
  }

  .mh-account-nav-link-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.45rem;
    background: color-mix(in srgb, var(--mh-paper-2, #efe7da) 80%, transparent);
    font-size: 0.92rem;
  }

  .mh-account-nav-link-chevron {
    display: inline-flex;
  }

  .mh-account-nav-badge {
    margin-left: 0;
  }

  .mh-account-nav-link-chevron {
    margin-left: 0.15rem;
  }

  .mh-account-nav-logout {
    margin-top: 0 !important;
    color: var(--mh-muted, #4a3c32) !important;
    font-size: 1rem !important;
  }

  .mh-account-nav-logout .mh-account-nav-link-icon {
    color: var(--mh-muted, #4a3c32);
  }

  /* Hub: menu is the primary screen; tighten page head above content cards */
  .mh-account-layout--hub .mh-account-head {
    margin-top: 0.35rem;
  }

  .mh-account-layout--section .mh-account-nav {
    margin-bottom: 0.85rem;
  }
}

html[data-theme="dark"] .mh-account-nav-details {
  background: var(--mh-paper-2, #1e1712);
  border-color: var(--mh-line, #3c3229);
}

html[data-theme="dark"] .mh-account-nav-link-icon {
  background: color-mix(in srgb, var(--mh-soft, #2c241d) 90%, transparent);
}
