/**
 * @file web/themes/custom/awtur/css/components/account-navigation.css
 * UP-02: Account navigation, isolated from page and payment form styling.
 */

.account-navigation {
  --account-nav-accent: #80530a;
  --account-nav-selected: #fbf3e2;
  color: #292d32;
  text-align: start;
}

.account-navigation .account-navigation__group + .account-navigation__group {
  margin-block-start: 8px;
  padding-block-start: 8px;
  border-block-start: 1px solid #e8e2d7;
}

.account-navigation .account-navigation__heading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  box-sizing: border-box;
  margin: 0;
  padding: 10px 9px;
  border: 0;
  color: #504a42;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.5;
  text-align: start;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  list-style: none;
  text-transform: none;
}

.account-navigation details.account-navigation__group {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.account-navigation details.account-navigation__group + .account-navigation__group {
  margin-block-start: 8px;
  padding-block-start: 8px;
  border-block-start: 1px solid #e8e2d7;
}

.account-navigation__heading::-webkit-details-marker {
  display: none;
}

.account-navigation .account-navigation__heading::before {
  content: none;
}

.account-navigation .account-navigation__heading::after {
  content: '';
  flex: 0 0 6px;
  height: 6px;
  margin-inline-start: auto;
  border-inline-end: 1.5px solid currentColor;
  border-block-end: 1.5px solid currentColor;
  transform: rotate(45deg);
}

.account-navigation__group[open] > .account-navigation__heading::after {
  transform: rotate(225deg);
}

.account-navigation .account-navigation__heading:hover {
  background: #f7f5ef;
}

.account-navigation__icon {
  display: block;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
}

.account-navigation__group-icon {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 9px;
  color: #80530a;
  background: #f3e8cf;
}

.account-navigation__group--account > summary .account-navigation__group-icon {
  color: #355c78;
  background: #e9f0f6;
}

.account-navigation__group--personal > summary .account-navigation__group-icon {
  color: #416345;
  background: #eaf2e9;
}

.account-navigation__group-icon .account-navigation__icon {
  width: 23px;
  height: 23px;
  stroke-width: 1.9;
}

.account-navigation__item > a > .account-navigation__icon {
  color: #77716a;
  flex-basis: 18px;
  width: 18px;
  height: 18px;
}

.account-navigation__item > a[aria-current="page"] > .account-navigation__icon,
.account-navigation__group--logout .account-navigation__icon {
  color: inherit;
}

.account-navigation .account-navigation__list {
  display: block;
  position: static;
  width: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.account-navigation .account-navigation__item {
  margin: 2px 0;
  padding: 0;
  list-style: none;
}

.account-navigation .account-navigation__item > a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  box-sizing: border-box;
  padding: 9px 11px;
  border: 0;
  border-radius: 6px;
  color: #292d32;
  background: transparent;
  font-size: 0.9rem;
  line-height: 1.45;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.account-navigation .account-navigation__item > a:hover {
  color: var(--account-nav-accent);
  background: #f7f5ef;
}

.account-navigation .account-navigation__item > a[aria-current="page"] {
  color: var(--account-nav-accent);
  background: var(--account-nav-selected);
  font-weight: 700;
}

.account-navigation a:focus-visible,
.account-navigation summary:focus-visible,
.account-menu-switcher > summary:focus-visible {
  outline: 3px solid #126b9b;
  outline-offset: 2px;
}

.account-navigation__list .account-navigation__list {
  padding-inline-start: 12px;
}

.account-navigation .account-navigation__group--logout a {
  color: #9b3636;
}

.account-navigation .account-navigation__group--logout a:hover {
  color: #802727;
  background: #fcf0ef;
}

/* Bridge the gap so moving from the trigger into the panel stays safe. */
.account-menu-switcher[open]::after {
  content: '';
  position: absolute;
  inset-inline-end: 0;
  top: 100%;
  width: min(300px, calc(100vw - 32px));
  height: 8px;
}

.account-menu-switcher {
  position: relative;
  border: 0;
  margin: 0;
  padding: 0;
  background: transparent;
}

.account-menu-switcher > .account-menu-switcher__toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 4px;
  color: #292d32;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  list-style: none;
}

.account-menu-switcher__toggle::-webkit-details-marker {
  display: none;
}

.account-menu-switcher__toggle .profile-picture {
  display: block;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.account-menu-switcher__name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-switcher__chevron {
  width: 7px;
  height: 7px;
  margin: 0 4px 4px;
  border-inline-end: 2px solid currentColor;
  border-block-end: 2px solid currentColor;
  transform: rotate(45deg);
}

.account-menu-switcher[open] .account-menu-switcher__chevron {
  margin-block-start: 5px;
  transform: rotate(225deg);
}

.account-menu-switcher__panel {
  position: absolute;
  z-index: 250;
  inset-inline-end: 0;
  top: calc(100% + 8px);
  box-sizing: border-box;
  width: min(300px, calc(100vw - 32px));
  max-height: min(640px, 70vh, var(--account-menu-available-height, 70vh));
  overflow-y: auto;
  padding: 18px;
  border: 1px solid #e2d8c7;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 32px rgb(35 29 17 / 16%);
}

@media (max-width: 751px) {
  .account-menu-switcher__name {
    display: none;
  }
}

/* UP-10K: guest entry uses the same disclosure and navigation as accounts. */
.account-menu-switcher--guest .account-guest-menu__avatar {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  inline-size: 40px;
  block-size: 40px;
  border: 1px solid #e7dcc4;
  border-radius: 50%;
  color: #80530a;
  background: #fbf3e2;
}

.account-menu-switcher--guest .account-menu-switcher__panel {
  inline-size: min(clamp(16rem, 28vw, 19rem), calc(100vw - 2rem));
  padding: clamp(0.75rem, 2vw, 1rem);
}

.account-menu-switcher--guest .account-guest-menu__welcome {
  margin-block-end: 0.625rem;
  padding: 0.875rem;
  border-radius: 8px;
  background: linear-gradient(135deg, #fbf3e2, #fffdf8);
  text-align: start;
}

.account-guest-menu__welcome strong {
  color: #443d30;
  font-size: 1.0625rem;
  font-weight: 600;
}

.account-menu-switcher--guest .account-guest-menu__welcome p {
  margin: 0.25rem 0 0;
  color: #686156;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.account-menu-switcher--guest .account-navigation__item > a {
  min-block-size: 44px;
}
