/* YuanChu product shell owner for the collection surface.
   This file owns global navigation, the account trigger, mobile navigation,
   and the flow toolbar. Legacy floating account/back selectors do not match
   the product-shell class names and therefore cannot reposition these controls. */

@view-transition {
  navigation: auto;
}

:root {
  --product-header-height: 72px;
  --product-mobile-nav-height: 64px;
}

html {
  scrollbar-gutter: stable;
}

.product-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 80;
  height: var(--product-header-height);
  border-bottom: 1px solid rgba(255, 255, 255, .6);
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(20px);
  view-transition-name: product-header;
}

::view-transition-group(product-header) {
  animation-duration: 180ms;
  animation-timing-function: ease-out;
}

::view-transition-old(product-header),
::view-transition-new(product-header) {
  mix-blend-mode: normal;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(product-header) {
    animation-duration: 1ms;
  }
}

.product-header-inner {
  box-sizing: border-box;
  width: min(100%, 1280px);
  height: 100%;
  margin: 0 auto;
  padding: 0 40px;
  display: flex;
  align-items: center;
  gap: 24px;
  font-family: var(--web-product-font, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif);
}

.product-brand {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 36px;
  border-radius: 12px;
  color: #222;
  text-decoration: none;
}

.product-brand-logo {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 1px 3px rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);
}

.product-brand-name {
  font-size: 18px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: -.03em;
}

.product-brand:hover {
  color: var(--collection-primary-dark, #108957);
}

.product-brand:focus-visible,
.product-primary-nav a:focus-visible,
.product-account-trigger:focus-visible,
.product-account-login:focus-visible,
.flow-back-link:focus-visible {
  outline: 2px solid rgb(var(--collection-primary-rgb, 16 168 102) / .42);
  outline-offset: 3px;
}

.product-primary-nav {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.product-primary-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 16px;
  color: #686873;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease;
}

.product-primary-nav a:hover {
  background: #e3f6f1;
  color: #222;
}

.product-primary-nav a.is-active {
  background: #e3f6f1;
  color: #154c45;
}

.product-report-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: #154c45;
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.product-report-link:focus-visible {
  outline: 2px solid #348f83;
  outline-offset: 3px;
}

/* Match the existing Web LoginDialog and UnifiedLoginPanel dimensions. */
.analysis-login-dialog {
  width: 860px;
  height: 560px;
  max-width: calc(100vw - 32px);
  max-height: calc(100svh - 32px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 32px;
  background: #fff;
  color: #222;
  box-shadow: 0 24px 70px rgb(29 105 96 / 18%);
  overflow: hidden;
}
.analysis-login-dialog::backdrop {
  background: rgb(0 0 0 / 20%);
  backdrop-filter: blur(8px);
}
.analysis-login-dialog iframe { display: block; width: 100%; height: 100%; border: 0; }
.analysis-login-close {
  position: absolute;
  z-index: 1;
  right: 16px;
  top: 16px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #222;
  cursor: pointer;
}
.analysis-login-close svg { width: 16px; height: 16px; }
.analysis-login-close:hover { background: #f4f3f8; }
.analysis-login-close:focus-visible { outline: 2px solid #60bbaf; outline-offset: 2px; }
@media (width < 768px) {
  .analysis-login-dialog {
    width: 100vw;
    height: 100svh;
    max-width: none;
    max-height: none;
    border-radius: 0;
  }
}

.product-primary-nav a.is-active::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: 2px;
  left: 12px;
  height: 2px;
  border-radius: 999px;
  background: #60bbaf;
}

.product-mobile-section {
  display: none;
}

.product-account {
  position: relative;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
}

.product-account-trigger,
.product-account-login {
  box-sizing: border-box;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 1px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .18s ease, transform .18s ease;
}

.product-account-trigger:hover,
.product-account-login:hover {
  background: rgb(var(--collection-primary-rgb, 16 168 102) / .08);
}

.product-account-trigger:active,
.product-account-login:active {
  transform: scale(.98);
}

.product-account-trigger img,
.product-account-trigger > span,
.product-account-login > span {
  box-sizing: border-box;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgb(var(--collection-primary-rgb, 16 168 102) / .2);
  border-radius: 11px;
  background: rgba(255, 255, 255, .92);
  color: var(--collection-step01-text-strong, #1d2b27);
  box-shadow: 0 10px 26px rgb(var(--collection-primary-rgb, 16 168 102) / .1);
  font-size: 18px;
  font-weight: 800;
  object-fit: cover;
}

.product-account-trigger > span,
.product-account-login > span {
  border: 0;
  background: url("/images/avatars/default-avatar.png") center / 118% 118% no-repeat;
  color: transparent;
  filter: saturate(1.3);
  font-size: 0;
  box-shadow: none;
}

.product-account.is-open .account-menu-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  visibility: visible;
}

.flow-toolbar {
  position: absolute;
  top: 86px;
  left: 50%;
  z-index: 30;
  box-sizing: border-box;
  width: min(100%, 1280px);
  min-height: 36px;
  margin: 0;
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 0;
  background: transparent;
  transform: translateX(-50%);
}

.collection-home-link { display: none; }
@media (width < 1024px) {
  .collection-home-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: end;
    grid-column: 3;
    grid-row: 1;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    margin-right: 4px;
    border-radius: 50%;
    color: var(--collection-step01-text-strong, #1d2b27);
  }
  .collection-home-link svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
  .page-form:has(.floorplan-recognizing-mask.is-visible) .flow-toolbar { z-index: 1500; pointer-events: none; }
  .page-form:has(.floorplan-recognizing-mask.is-visible) .flow-toolbar > :not(.collection-home-link) { visibility: hidden; }
  .page-form:has(.floorplan-recognizing-mask.is-visible) .collection-home-link { position: fixed; top: max(8px, env(safe-area-inset-top)); right: 8px; pointer-events: auto; background: white; }
  .collection-home-link:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
}

.flow-back-link {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 0 8px 0 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--collection-step01-text-strong, #1d2b27);
  font: inherit;
  font-size: 15px;
  line-height: 1.2;
  font-weight: 700;
  cursor: pointer;
  transition: color .18s ease, transform .18s ease;
}

.flow-back-link:hover {
  color: var(--collection-primary-dark, #108957);
}

.flow-back-link:active {
  transform: translateX(-1px);
}

.flow-back-link .collection-icon {
  --icon-size: 19px;
  --icon-stroke: 1.8;
}

.product-mobile-nav {
  display: none;
}

/* Step0 is the product-level entry. Step1-4 are a nested collection flow and
   therefore keep their own back/step navigation without the product shell. */
.app-shell:has(.page-form.is-active) .product-header,
.app-shell:has(.page-form.is-active) .product-mobile-nav {
  display: none;
}

@media (width < 1024px) {
  :root {
    --product-header-height: 64px;
  }

  .product-header-inner {
    padding: 0 32px;
  }

  .product-primary-nav,
  .product-report-link,
  .product-account {
    display: none;
  }

  .product-brand {
    margin-right: auto;
  }

  .product-brand-name {
    font-size: 18px;
  }

  .product-brand-logo {
    flex-basis: 32px;
    width: 32px;
    height: 32px;
  }

  .product-mobile-section {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    color: var(--collection-primary-dark, #108957);
    font-size: 14px;
    font-weight: 700;
  }

  .flow-toolbar {
    top: 76px;
    padding: 0 32px;
  }

  .product-mobile-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 75;
    box-sizing: border-box;
    height: calc(var(--product-mobile-nav-height) + env(safe-area-inset-bottom));
    padding: 0 max(0px, env(safe-area-inset-left)) env(safe-area-inset-bottom) max(0px, env(safe-area-inset-right));
    display: block;
    border-top: 1px solid rgba(220, 218, 227, .8);
    background: rgba(255, 255, 255, .95);
    box-shadow: 0 -12px 40px rgb(27 70 65 / .08);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
  }

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

  .product-mobile-nav a {
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-radius: 16px;
    color: #686873;
    font-size: 11px;
    line-height: 1;
    font-weight: 500;
    text-decoration: none;
    transition: color 150ms ease, background-color 150ms ease;
  }

  .product-mobile-nav a:hover {
    color: #222;
    background: rgba(227, 246, 241, .7);
  }

  .product-mobile-nav a.is-active {
    color: #124b43;
    background: transparent;
  }

  .product-mobile-nav a:focus-visible {
    outline: 2px solid #348f83;
    outline-offset: -4px;
  }

  .product-mobile-nav-icon,
  .product-mobile-nav svg {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
  }

  .product-mobile-nav-icon {
    object-fit: contain;
  }

  .product-mobile-nav svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .page-method.is-active {
    padding-bottom: calc(var(--product-mobile-nav-height) + env(safe-area-inset-bottom) + 16px) !important;
  }
}

@media (max-width: 639px) {
  :root {
    --product-header-height: 60px;
  }

  .product-header-inner {
    padding: 0 20px;
  }

  .product-brand-name {
    font-size: 17px;
  }

  .product-brand-logo {
    flex-basis: 30px;
    width: 30px;
    height: 30px;
  }

  .product-mobile-section {
    font-size: 13px;
  }

  .flow-toolbar {
    top: 68px;
    min-height: 34px;
    padding: 0 20px;
  }

  .flow-back-link {
    min-height: 34px;
    font-size: 14px;
  }

  .flow-back-link .collection-icon {
    --icon-size: 18px;
  }

}
