/* ==========================================================================
   2CLICK AMC V20 — Mobile-First Shell, Safe Areas & Bottom Navigation
   Tested across 320px, 360px, 375px, 390px, Tablet & Desktop
   ========================================================================== */
html {
  scroll-padding-top: 88px;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: clip;
}

.mobile-back,
.mobile-page-label {
  display: none;
}

.mobile-nav {
  display: none;
}

.mobile-nav img,
.mobile-nav svg {
  width: 22px;
  height: 22px;
  display: block;
}

.pwa-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 20px;
  z-index: 35;
  max-width: 560px;
  margin: auto;
  padding: 12px 16px;
  background: var(--color-surface, #FFFFFF);
  border: 1px solid var(--color-border, #E2E8E3);
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(16, 76, 56, 0.16);
  display: flex;
  align-items: center;
  gap: 12px;
}

.pwa-banner[hidden] {
  display: none !important;
}

.pwa-banner > span {
  flex: 1;
  font-size: 0.8125rem;
}

.mobile-connection {
  background: #FEF6E7;
  color: #6B440B;
  border-bottom: 1px solid #F3D9A4;
  padding: 9px 16px;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 600;
}

.mobile-connection[hidden] {
  display: none !important;
}

@media (max-width: 960px) {
  html {
    scroll-padding-top: 76px;
    scroll-padding-bottom: 96px;
  }

  header.poster-header nav {
    display: none;
  }

  header.poster-header {
    padding: max(8px, env(safe-area-inset-top)) 14px 8px;
    height: auto;
    min-height: 64px;
    gap: 8px;
  }

  .poster-header .brand {
    margin-right: auto;
  }

  .mobile-back:not([hidden]) {
    display: grid;
    place-items: center;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 6px;
    background: var(--color-bg-soft, #E8F2EC);
    border: 1px solid var(--color-border, #E2E8E3);
    border-radius: 10px;
  }

  .mobile-back[hidden] {
    display: none !important;
  }

  .mobile-back img {
    width: 22px;
    height: 22px;
  }

  /* 5-Item Persistent Mobile Bottom Navigation: Home | Services | Request | Track | Account */
  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed;
    inset: auto 0 0;
    background: var(--color-surface, #FFFFFF);
    border-top: 1px solid var(--color-border, #E2E8E3);
    padding: 6px max(6px, env(safe-area-inset-left)) max(6px, env(safe-area-inset-bottom));
    gap: 4px;
    z-index: 35;
    box-shadow: 0 -4px 18px rgba(16, 76, 56, 0.06);
  }

  .mobile-nav button {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    min-height: 52px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--color-text-secondary, #68756D);
    padding: 5px 2px;
    font-size: 0.72rem;
    font-weight: 600;
  }

  .mobile-nav button span {
    font-size: 0.6875rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .mobile-nav button.active {
    background: var(--color-bg-soft, #E8F2EC);
    color: var(--color-primary, #176B4D);
    font-weight: 700;
  }

  .pwa-banner {
    bottom: calc(78px + env(safe-area-inset-bottom));
    left: 10px;
    right: 10px;
    gap: 8px;
  }

  .keyboard-open .mobile-nav {
    visibility: hidden;
    pointer-events: none;
  }

  .keyboard-open .pwa-banner {
    display: none;
  }

  input, select, textarea {
    font-size: 16px;
    min-height: 46px;
  }

  dialog {
    width: calc(100vw - 16px);
    max-width: 720px;
    max-height: calc(100dvh - 24px - env(safe-area-inset-top));
    padding: 18px 16px;
    border-radius: 16px;
  }
}

@media (max-width: 420px) {
  header.poster-header {
    padding-left: 10px;
    padding-right: 10px;
    gap: 6px;
  }
  .poster-header .brand img {
    width: 84px;
    height: 36px;
  }
  .poster-header .brand span {
    display: none;
  }
  .poster-header .header-actions {
    gap: 4px;
  }
  .poster-header .header-actions button {
    font-size: 0.75rem;
    padding: 7px 9px;
    min-height: 38px;
  }
  .poster-header .header-actions .account-action {
    display: none;
  }
}
