html.freshbuy-ios-app {
  --freshbuy-safe-top: env(safe-area-inset-top, 0px);
  --freshbuy-safe-bottom: env(safe-area-inset-bottom, 0px);
  overscroll-behavior-y: none;
}

html.freshbuy-ios-app body {
  min-height: 100dvh;
  padding-bottom: calc(68px + var(--freshbuy-safe-bottom));
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

/* iPhone app header: stay clear of Dynamic Island and avoid crowded controls. */
html.freshbuy-ios-app .top-nav {
  padding-top: 0;
}

html.freshbuy-ios-app .top-nav-inner {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "logo logo"
    "search user";
  gap: 8px 10px;
  padding: 8px 12px 7px;
}

html.freshbuy-ios-app .logo-area {
  grid-area: logo;
  min-width: 0;
  width: 132px;
  min-height: 42px;
  align-self: start;
}

html.freshbuy-ios-app .logo-text-main,
html.freshbuy-ios-app .logo-text-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html.freshbuy-ios-app .logo-text-main { font-size: 17px; letter-spacing: 0.02em; }
html.freshbuy-ios-app .logo-text-sub { font-size: 10px; }

html.freshbuy-ios-app .search-area {
  grid-area: search;
  width: 100%;
}

html.freshbuy-ios-app .user-area {
  grid-area: user;
  gap: 6px;
}

html.freshbuy-ios-app .search-box {
  min-height: 36px;
}

html.freshbuy-ios-app #btnInstallPWA,
html.freshbuy-ios-app #mobileTawkBtn,
html.freshbuy-ios-app .user-profile .user-name {
  display: none !important;
}

html.freshbuy-ios-app .link-btn {
  padding: 6px 10px;
  font-size: 13px;
  white-space: nowrap;
}

html.freshbuy-ios-app .cart-icon {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
}

@media (max-width: 390px) {
  html.freshbuy-ios-app .logo-badge {
    width: 30px;
    height: 30px;
    font-size: 16px;
  }

  html.freshbuy-ios-app .logo-text-main { font-size: 15px; }
  html.freshbuy-ios-app .link-btn { padding: 5px 8px; }
}

html.freshbuy-ios-app input,
html.freshbuy-ios-app textarea,
html.freshbuy-ios-app select {
  font-size: 16px;
}

.freshbuy-app-nav {
  position: fixed;
  z-index: 2147483000;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 8px 6px calc(7px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.freshbuy-app-nav a {
  min-width: 0;
  color: #64748b;
  text-align: center;
  text-decoration: none;
  font: 500 11px/1.15 -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

.freshbuy-app-nav a::before {
  display: block;
  margin-bottom: 4px;
  font-size: 21px;
  line-height: 22px;
}

.freshbuy-app-nav a[data-tab="home"]::before { content: "⌂"; }
.freshbuy-app-nav a[data-tab="category"]::before { content: "▦"; }
.freshbuy-app-nav a[data-tab="cart"]::before { content: "🛒"; font-size: 18px; }
.freshbuy-app-nav a[data-tab="orders"]::before { content: "≡"; }
.freshbuy-app-nav a[data-tab="account"]::before { content: "○"; }
.freshbuy-app-nav a[aria-current="page"] { color: #15803d; font-weight: 700; }

html.freshbuy-keyboard-open .freshbuy-app-nav { display: none; }

@media (min-width: 768px) {
  .freshbuy-app-nav { max-width: 560px; margin: 0 auto; border-radius: 18px 18px 0 0; }
}
