/* ===========================================================================
   Account menu

   The username control used in the dashboard topbars and in the site header.
   Self-contained on purpose: it loads on every page, including ones that never
   pull in dashboard-v2.css, so every token carries a literal fallback and the
   avatar is styled here rather than inherited from `.tl-dash`.
   =========================================================================== */

.dash-user-menu {
  position: relative;
  display: inline-block;
}

.dash-user-menu > .topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 5px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--tl-ink, #16181d);
  font: inherit;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.dash-user-menu > .topbar-user:hover,
.dash-user-menu.is-open > .topbar-user {
  background: #fff;
  border-color: var(--tl-line, #e8eaee);
}

.dash-user-menu .user-name {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 600;
  color: var(--tl-ink, #16181d);
}

/* `caret` alone is a Bootstrap 3 CSS-triangle class; ours is a glyph only */
.dash-user-menu .dash-caret {
  border: 0;
  width: auto;
  height: auto;
  font-size: 11px;
  color: var(--tl-ink-mute, #8b919c);
  transition: transform 0.18s ease;
}

.dash-user-menu.is-open .dash-caret {
  transform: rotate(180deg);
}

/* avatar — defined here so the control works outside the dashboard shell */
.dash-user-menu .avatar-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--tl-orange, #ff851b);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

.dash-user-menu .avatar-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dash-user-menu .avatar-lg {
  width: 44px;
  height: 44px;
  font-size: 17px;
}

/* panel */
.dash-menu-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 1200;
  width: 296px;
  max-height: min(78vh, 620px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #fff;
  border: 1px solid var(--tl-line, #e8eaee);
  border-radius: 14px;
  box-shadow: 0 18px 44px -16px rgba(22, 24, 29, 0.28), 0 2px 6px rgba(22, 24, 29, 0.06);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  text-align: left;
}

.dash-menu-panel[hidden] {
  display: none;
}

.dash-user-menu.is-open .dash-menu-panel {
  opacity: 1;
  transform: translateY(0);
}

/* identity */
.dash-menu-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--tl-line, #e8eaee);
  background: linear-gradient(180deg, #fbfcfd 0%, #fff 100%);
  border-radius: 14px 14px 0 0;
}

.dash-menu-identity {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-menu-name {
  color: var(--tl-ink, #16181d);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-menu-email {
  color: var(--tl-ink-mute, #8b919c);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-menu-panel .role-pill {
  align-self: flex-start;
  margin-top: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dash-menu-panel .role-pill.is-customer {
  background: #eaf3ff;
  color: #1c5fb0;
}

.dash-menu-panel .role-pill.is-vendor {
  background: #fdf1e6;
  color: var(--tl-orange-dark, #e8730d);
}

/* items */
.dash-menu-list {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: 0;
  border-radius: 9px;
  color: var(--tl-ink, #16181d);
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.3;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.dash-menu-item > i {
  flex: 0 0 18px;
  font-size: 15px;
  color: var(--tl-ink-mute, #8b919c);
  text-align: center;
  transition: color 0.16s ease;
}

.dash-menu-item:hover,
.dash-menu-item:focus {
  background: #f6f8fa;
  color: var(--tl-orange, #ff851b);
  text-decoration: none;
}

.dash-menu-item:hover > i {
  color: var(--tl-orange, #ff851b);
}

.dash-menu-item.active {
  background: #fdf1e6;
  color: var(--tl-orange, #ff851b);
  font-weight: 600;
}

.dash-menu-item.active > i {
  color: var(--tl-orange, #ff851b);
}

/* footer: switch + sign out */
.dash-menu-foot {
  padding: 8px;
  border-top: 1px solid var(--tl-line, #e8eaee);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-menu-foot form {
  margin: 0;
}

.dash-menu-item.is-switch {
  background: #f6f8fa;
  font-weight: 600;
}

.dash-menu-item.is-switch:hover {
  background: #fdf1e6;
}

.dash-menu-item.is-pending {
  color: var(--tl-ink-mute, #8b919c);
  cursor: default;
}

.dash-menu-item.is-pending:hover {
  background: transparent;
  color: var(--tl-ink-mute, #8b919c);
}

.dash-menu-item.is-logout,
.dash-menu-item.is-logout > i {
  color: var(--tl-red, #e03131);
}

.dash-menu-item.is-logout:hover,
.dash-menu-item.is-logout:hover > i {
  background: #fdecec;
  color: var(--tl-red, #e03131);
}

.dash-user-menu :focus-visible {
  outline: 2px solid var(--tl-orange, #ff851b);
  outline-offset: 2px;
}

/* the mobile bar has no room for the name */
.dash-mobilebar .dash-user-menu .user-name,
.dash-mobilebar .dash-user-menu .dash-caret {
  display: none;
}

@media (max-width: 575.98px) {
  .dash-menu-panel {
    width: min(88vw, 296px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .dash-menu-panel,
  .dash-user-menu .dash-caret,
  .dash-menu-item {
    transition: none;
  }
}
