/**
 * ManaFresh — Premium corporate mobile UI
 */
:root {
  --mobile-nav-height: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0);
  --corp-ink: #0f172a;
  --corp-slate: #334155;
  --corp-muted: #64748b;
  --corp-line: rgba(15, 23, 42, 0.08);
  --corp-accent: #c91828;
  --corp-accent-soft: rgba(227, 29, 54, 0.08);
  --corp-surface: #ffffff;
  --corp-font: 'Manrope', 'Poppins', 'Inter', system-ui, sans-serif;
}

.mobile-header-tools,
.mobile-header-search-row,
.mobile-nav-drawer {
  display: none;
}

.nav-search-wrap--mobile {
  display: none;
}

@media (max-width: 768px) {
  .desktop-nav,
  .nav-search-wrap--desktop {
    display: none !important;
  }

  .nav-search-wrap--mobile {
    display: block !important;
  }

  .mobile-header-tools,
  .mobile-header-search-row {
    display: flex;
  }

  .main-header {
    position: sticky;
    top: 0;
    z-index: 1100;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(18px) saturate(1.2);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
    border-bottom: 1px solid var(--corp-line);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8), 0 8px 30px rgba(15, 23, 42, 0.05);
  }

  .main-header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #E31D36 0%, #f25c6d 50%, #1a1f2e 100%);
  }

  .main-nav {
    padding: 14px 0 14px;
  }

  .main-nav .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .nav-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "logo tools"
      "search search";
    align-items: center;
    gap: 12px;
  }

  .logo {
    grid-area: logo;
    min-width: 0;
  }

  .logo a {
    gap: 0 !important;
  }

  .logo img {
    height: 36px !important;
    margin-right: 0 !important;
    filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.8));
  }

  .mobile-header-tools {
    grid-area: tools;
    align-items: center;
    gap: 10px;
    margin-left: auto;
  }

  .mobile-header-search-row {
    grid-area: search;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
  }

  .mobile-city-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    max-width: 100%;
    padding: 7px 12px 7px 10px;
    border: 1px solid var(--corp-line);
    border-radius: 999px;
    background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
    color: var(--corp-ink);
    font-family: var(--corp-font);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  }

  .mobile-city-chip__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: var(--corp-accent-soft);
    color: var(--corp-accent);
    flex-shrink: 0;
  }

  .mobile-city-chip__text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav-search-wrap--mobile {
    width: 100%;
    max-width: none;
    margin: 0;
  }

  .nav-search-wrap--mobile .nav-search-form {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0;
    min-height: 48px;
    padding: 0 6px 0 14px;
    background: #f8fafc;
    border: 1px solid var(--corp-line);
    border-radius: 14px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95);
  }

  .nav-search-wrap--mobile .nav-search-form:focus-within {
    background: #fff;
    border-color: rgba(227, 29, 54, 0.22);
    box-shadow: 0 0 0 4px rgba(227, 29, 54, 0.08);
  }

  .nav-search-form__leading {
    display: inline-flex;
    align-items: center;
    color: var(--corp-muted);
    margin-right: 8px;
  }

  .nav-search-wrap--mobile .nav-search-form input {
    width: 100%;
    min-width: 0;
    padding: 12px 8px 12px 0;
    font-family: var(--corp-font);
    font-size: 14px;
    font-weight: 500;
    color: var(--corp-ink);
  }

  .nav-search-wrap--mobile .nav-search-btn {
    width: auto;
    min-width: 52px;
    height: 36px;
    margin: 0 2px;
    padding: 0 14px;
    border-radius: 10px;
    background: var(--corp-ink);
    color: #fff;
    font-family: var(--corp-font);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    box-shadow: none;
  }

  .nav-search-wrap--mobile .nav-search-btn:hover {
    transform: none;
    background: #1a1f2e;
    box-shadow: none;
  }

  .mobile-header-cart {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: transparent;
    border: 1px solid var(--corp-line);
    color: var(--corp-ink);
    text-decoration: none;
  }

  .mobile-header-cart .glass-icon {
    color: var(--corp-ink);
  }

  .mobile-header-cart .cart-badge {
    top: -2px;
    right: -2px;
    min-width: 17px;
    height: 17px;
    font-size: 9px;
    border-width: 2px;
  }

  .mobile-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--corp-line);
    border-radius: 999px;
    background: var(--corp-ink);
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
  }

  .mobile-menu-toggle__lines {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 16px;
  }

  .mobile-menu-toggle__lines span {
    display: block;
    height: 2px;
    border-radius: 2px;
    background: #fff;
    transition: transform 0.25s ease, opacity 0.25s ease, width 0.25s ease;
  }

  .mobile-menu-toggle__lines span:nth-child(2) {
    width: 70%;
    margin-left: auto;
  }

  .mobile-menu-toggle.is-open .mobile-menu-toggle__lines span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }

  .mobile-menu-toggle.is-open .mobile-menu-toggle__lines span:nth-child(2) {
    opacity: 0;
    width: 0;
  }

  .mobile-menu-toggle.is-open .mobile-menu-toggle__lines span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  /* Drawer — portal to body; full viewport overlay */
  .mobile-nav-drawer {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 10070;
    visibility: hidden;
    pointer-events: none;
  }

  .mobile-nav-drawer.is-open {
    visibility: visible;
    pointer-events: auto;
  }

  .mobile-nav-drawer__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    opacity: 0;
    transition: opacity 0.28s ease;
    z-index: 0;
  }

  .mobile-nav-drawer.is-open .mobile-nav-drawer__backdrop {
    opacity: 1;
  }

  .mobile-nav-drawer__panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(340px, 100vw);
    max-width: 100%;
    height: 100%;
    height: 100dvh;
    max-height: 100dvh;
    background: #fff;
    box-shadow: -16px 0 48px rgba(15, 23, 42, 0.18);
    transform: translate3d(100%, 0, 0);
    transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1;
    isolation: isolate;
  }

  .mobile-nav-drawer.is-open .mobile-nav-drawer__panel {
    transform: translate3d(0, 0, 0);
  }

  .mobile-nav-drawer__hero {
    flex-shrink: 0;
    padding: calc(18px + env(safe-area-inset-top, 0)) 18px 18px;
    background: linear-gradient(165deg, #121826 0%, #1a2234 100%);
    color: #fff;
  }

  .mobile-nav-drawer__hero-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
  }

  .mobile-nav-drawer__eyebrow {
    display: block;
    font-family: var(--corp-font);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 6px;
  }

  .mobile-nav-drawer__title {
    display: block;
    font-family: var(--corp-font);
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #fff;
  }

  .mobile-nav-drawer__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
  }

  .mobile-nav-drawer__city {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font: inherit;
    text-align: left;
    cursor: pointer;
  }

  .mobile-nav-drawer__city-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: rgba(227, 29, 54, 0.18);
    color: #ff8a98;
    flex-shrink: 0;
  }

  .mobile-nav-drawer__city-text {
    flex: 1;
    min-width: 0;
    font-family: var(--corp-font);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
  }

  .mobile-nav-drawer__city-text small {
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 2px;
  }

  .mobile-nav-drawer__city-arrow {
    color: rgba(255, 255, 255, 0.45);
    font-size: 22px;
    line-height: 1;
  }

  .mobile-nav-drawer__links {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 10px 12px;
    background: #fff;
  }

  .mobile-nav-drawer__link {
    display: grid;
    grid-template-columns: 42px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 13px 10px;
    margin-bottom: 2px;
    border-radius: 14px;
    text-decoration: none;
    color: var(--corp-ink);
    transition: background 0.2s ease, transform 0.2s ease;
  }

  .mobile-nav-drawer__link-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid var(--corp-line);
    color: var(--corp-accent);
  }

  .mobile-nav-drawer__link-text {
    font-family: var(--corp-font);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
  }

  .mobile-nav-drawer__link-arrow {
    color: #cbd5e1;
    font-size: 22px;
    line-height: 1;
  }

  .mobile-nav-drawer__link:active {
    transform: scale(0.99);
    background: #f8fafc;
  }

  .mobile-nav-drawer__foot {
    display: grid;
    gap: 10px;
    flex-shrink: 0;
    padding: 16px 18px calc(18px + var(--safe-bottom));
    border-top: 1px solid var(--corp-line);
    background: #fff;
  }

  .mobile-nav-drawer__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 18px;
    border-radius: 14px;
    background: var(--corp-ink);
    color: #fff !important;
    font-family: var(--corp-font);
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-decoration: none;
  }

  .mobile-nav-drawer__cta--outline {
    background: #fff;
    color: var(--corp-ink) !important;
    border: 1px solid var(--corp-line);
  }

  body.mobile-nav-open {
    overflow: hidden;
    touch-action: none;
  }

  body.mobile-nav-open main,
  body.mobile-nav-open .profile-page,
  body.mobile-nav-open .main-footer {
    pointer-events: none;
    user-select: none;
  }
}

/* Bottom navigation */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100vw;
  height: calc(var(--mobile-nav-height) + var(--safe-bottom));
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  border-top: 1px solid var(--corp-line);
  z-index: 1000;
  padding-bottom: var(--safe-bottom);
  box-shadow: 0 -10px 40px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  box-sizing: border-box;
}

.mobile-bottom-nav-inner {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: stretch;
  width: 100%;
  max-width: 100%;
  height: var(--mobile-nav-height);
  margin: 0 auto;
  padding: 0 clamp(2px, 1vw, 8px);
  box-sizing: border-box;
}

.mobile-bottom-nav a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  width: 100%;
  text-decoration: none;
  color: var(--corp-muted);
  font-family: var(--corp-font);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 6px 2px;
  box-sizing: border-box;
}

.mobile-bottom-nav a .nav-label {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.1;
  text-align: center;
}

.mobile-bottom-nav a .nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 10px;
  font-size: 0;
  line-height: 0;
  margin-bottom: 0;
  background: transparent;
  flex-shrink: 0;
  transition: background 0.2s ease, color 0.2s ease;
}

.mobile-bottom-nav a .nav-icon .glass-icon {
  width: 17px;
  height: 17px;
  color: var(--corp-muted);
}

.mobile-bottom-nav a.active,
.mobile-bottom-nav a:hover {
  color: var(--corp-accent);
}

.mobile-bottom-nav a.active .nav-icon,
.mobile-bottom-nav a:hover .nav-icon {
  background: var(--corp-accent-soft);
}

.mobile-bottom-nav a.active .nav-icon .glass-icon,
.mobile-bottom-nav a:hover .nav-icon .glass-icon {
  color: var(--corp-accent);
}

.mobile-bottom-nav .cart-badge {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(6px);
  background: var(--corp-accent);
  color: #fff;
  font-size: 8px;
  font-weight: 800;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  box-sizing: border-box;
}

body.has-mobile-nav {
  padding-bottom: calc(var(--mobile-nav-height) + var(--safe-bottom) + 12px);
  overflow-x: hidden;
}

@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: block;
  }

  html,
  body.has-mobile-nav {
    max-width: 100%;
    overflow-x: hidden;
  }

  .profile-page,
  .profile-main,
  .profile-sidebar,
  main.profile-page {
    max-width: 100%;
    overflow-x: hidden;
  }

  .profile-table-wrap,
  .table-responsive {
    max-width: 100%;
  }
}

@media (max-width: 360px) {
  :root {
    --mobile-nav-height: 58px;
  }

  .mobile-bottom-nav a {
    font-size: 8px;
    padding: 5px 1px;
    gap: 2px;
  }

  .mobile-bottom-nav a .nav-icon {
    width: 24px;
    height: 24px;
  }

  .mobile-bottom-nav a .nav-icon .glass-icon {
    width: 16px;
    height: 16px;
  }
}

@media (max-width: 320px) {
  .mobile-bottom-nav a .nav-label {
    font-size: 0;
    height: 0;
    overflow: hidden;
  }

  .mobile-bottom-nav a {
    gap: 0;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .mobile-bottom-nav a .nav-icon {
    width: 28px;
    height: 28px;
  }
}

@media (max-width: 768px) {
  body {
    font-family: var(--corp-font);
  }
}
