/* =============================================================
 * Hero Story — User Nav Widget  (v2.6.0)
 * Circular avatar + dropdown: Dashboard · My Orders · Downloads · Log out
 * Works on both light and dark nav backgrounds (inherits color).
 * ============================================================= */

/* ── Widget container ─────────────────────────────────────── */
.hwdt-unav-menu-item {
  margin-left: auto !important;  /* push to right edge in flex navbars */
  display: flex !important;
  align-items: center !important;
}

.hwdt-unav {
  position: relative;
  display: inline-flex;
  align-items: center;
  font-family: 'Open Sans', sans-serif;
}

/* ── Trigger button ───────────────────────────────────────── */
.hwdt-unav-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px 5px 5px;
  background: transparent;
  border: none;
  border-radius: 40px;
  cursor: pointer;
  transition: background 0.18s ease;
  color: inherit;
  line-height: 1;
}

.hwdt-unav-trigger:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* on light navbars */
.hwdt-unav-trigger:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* ── Avatar circle ────────────────────────────────────────── */
.hwdt-unav-av {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  background: #FFF4E6;
  border: 2px solid rgba(240, 131, 37, 0.35);
}

/* Initial letter fallback (shown via CSS attribute) */
.hwdt-unav-av::before {
  content: attr(data-init);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Caveat', cursive, sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  color: #F08325;
  z-index: 0;
}

/* Gravatar image overlays the initial */
.hwdt-unav-av img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  z-index: 1;
}

/* ── Name + role text ─────────────────────────────────────── */
.hwdt-unav-info {
  display: flex;
  flex-direction: column;
  text-align: left;
  min-width: 0;
}

.hwdt-unav-name {
  font-size: 13px;
  font-weight: 700;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
  line-height: 1.2;
}

.hwdt-unav-role {
  font-size: 10px;
  opacity: 0.6;
  white-space: nowrap;
  line-height: 1.3;
  margin-top: 1px;
}

/* ── Chevron ──────────────────────────────────────────────── */
.hwdt-unav-chev {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
  opacity: 0.7;
}

.hwdt-unav.is-open .hwdt-unav-chev {
  transform: rotate(180deg);
}

/* ── Dropdown panel ───────────────────────────────────────── */
.hwdt-unav-dd {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: 210px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.08),
    0 12px 36px rgba(0, 0, 0, 0.13);
  border: 1px solid rgba(0, 0, 0, 0.07);
  overflow: hidden;
  z-index: 99999;
  animation: hwdt-unav-in 0.18s ease;
  padding: 6px 0;
}

@keyframes hwdt-unav-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* ── Dropdown items ───────────────────────────────────────── */
.hwdt-unav-item {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 11px 20px !important;
  font-size: 13px;
  font-weight: 600;
  color: #1C1917;
  text-decoration: none;
  transition: background 0.14s ease, color 0.14s ease;
  white-space: nowrap;
  line-height: 1.2;
}

.hwdt-unav-item:hover {
  background: #FFF4E6;
  color: #F08325;
  text-decoration: none;
}

.hwdt-unav-item:focus-visible {
  outline: 2px solid #F08325;
  outline-offset: -2px;
  background: #FFF4E6;
}

.hwdt-unav-item svg {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 1.75;
  opacity: 0.6;
  display: block;
}

.hwdt-unav-item:hover svg {
  opacity: 1;
}

/* ── Separator ────────────────────────────────────────────── */
.hwdt-unav-sep {
  height: 1px;
  background: rgba(0, 0, 0, 0.07);
  margin: 5px 0;
}

/* ── Logout item ──────────────────────────────────────────── */
.hwdt-unav-logout {
  color: #DC2626;
}

.hwdt-unav-logout:hover {
  background: #FFF8F8;
  color: #DC2626;
}

/* ── Login button (guest state) ──────────────────────────── */
.hwdt-unav-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  background: transparent;
  color: inherit;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  border-radius: 30px;
  font-family: 'Open Sans', sans-serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  white-space: nowrap;
  line-height: 1;
}

.hwdt-unav-login-btn:hover {
  background: rgba(240, 131, 37, 0.1);
  border-color: #F08325;
  color: #F08325;
}

/* On light navbars */
.hwdt-unav-login-btn {
  border-color: rgba(0, 0, 0, 0.18);
}

.hwdt-unav-login-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  stroke: currentColor;
}

/* ── Divi-specific overrides ──────────────────────────────── */

/* Push the nav item to the far right in Divi's flex header */
#et-main-nav .hwdt-unav-menu-item,
#top-menu > .hwdt-unav-menu-item {
  margin-left: auto !important;
  float: right; /* fallback for non-flex Divi headers */
  padding: 0 !important;
}

/* Ensure dropdown renders above Divi's sticky header (z-index: 99999) */
#et-main-nav .hwdt-unav-dd,
#top-menu .hwdt-unav-dd {
  z-index: 100000 !important;
}

/* Suppress Divi's default link hover colour / underline on dropdown items */
#top-menu .hwdt-unav-item,
#top-menu .hwdt-unav-item:visited {
  color: #1C1917 !important;
  text-decoration: none !important;
  border: none !important;
  background: transparent;
}

#top-menu .hwdt-unav-item:hover,
#top-menu .hwdt-unav-item:focus-visible {
  background: #FFF4E6 !important;
  color: #F08325 !important;
  text-decoration: none !important;
}

#top-menu .hwdt-unav-logout,
#top-menu .hwdt-unav-logout:visited {
  color: #DC2626 !important;
}

#top-menu .hwdt-unav-logout:hover {
  background: #FFF8F8 !important;
  color: #DC2626 !important;
}

/* Remove Divi's arrow pseudo-elements from the trigger button */
#top-menu .hwdt-unav-menu-item > a::after,
#top-menu .hwdt-unav-menu-item > button::after,
#et-main-nav .hwdt-unav-trigger::after {
  display: none !important;
  content: none !important;
}

/* ── Responsive ───────────────────────────────────────────── */

/* On tablet — hide the text, show avatar only */
@media (max-width: 900px) {
  .hwdt-unav-info,
  .hwdt-unav-chev {
    display: none;
  }
  .hwdt-unav-trigger {
    padding: 4px;
  }
  /* keep dropdown to the right side of viewport */
  .hwdt-unav-dd {
    right: 0;
    left: auto;
    min-width: 200px;
  }
}

/* On small mobile — align dropdown to right edge of screen */
@media (max-width: 480px) {
  .hwdt-unav-dd {
    right: -8px;
    width: 195px;
  }
}

/* =============================================================
 * Auth Modal  (login + register popup)
 * ============================================================= */

.hwdt-auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 6, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: hwdt-overlay-in 0.2s ease;
}

.hwdt-auth-overlay[hidden] {
  display: none !important;
}

@keyframes hwdt-overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Card — clean white, no gradient */
.hwdt-auth-card {
  position: relative;
  background: #ffffff;
  border-radius: 24px;
  width: 100%;
  max-width: 420px;
  padding: 36px 32px 28px;
  z-index: 1;
  box-shadow:
    0 2px 0 rgba(0,0,0,0.04),
    0 8px 32px rgba(0,0,0,0.14),
    0 32px 64px rgba(0,0,0,0.1);
  animation: hwdt-card-in 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hwdt-auth-card::before,
.hwdt-auth-card::after {
  display: none;
}

@keyframes hwdt-card-in {
  from { opacity: 0; transform: scale(0.92) translateY(10px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

/* Close button */
.hwdt-auth-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border: none;
  background: rgba(0, 0, 0, 0.07);
  border-radius: 50%;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  color: #555;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  padding: 0;
}
.hwdt-auth-close:hover { background: rgba(0, 0, 0, 0.13); color: #1C1917; }

/* Logo / branding — hidden */
.hwdt-auth-logo {
  display: none;
}

/* Titles */
.hwdt-auth-title {
  font-family: 'Caveat', cursive, sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: #1C1917;
  text-align: center;
  margin: 0 0 4px;
  line-height: 1.2;
}

.hwdt-auth-sub {
  font-family: 'Open Sans', sans-serif;
  font-size: 13px;
  color: #2d2d2d;
  text-align: center;
  margin: 0 0 22px;
}

/* Form fields */
.hwdt-auth-field {
  margin-bottom: 14px;
}

.hwdt-auth-field label {
  display: block;
  font-family: 'Open Sans', sans-serif;
  font-size: 11.5px;
  font-weight: 700;
  color: #555;
  margin-bottom: 5px;
  letter-spacing: 0.01em;
}

.hwdt-auth-opt {
  font-weight: 400;
  opacity: 0.6;
}

/* Password field with toggle eye */
.hwdt-auth-pw-wrap {
  position: relative;
}

.hwdt-auth-pw-wrap input {
  padding-right: 42px !important;
}

.hwdt-auth-pw-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: #999;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.hwdt-auth-pw-toggle:hover { color: #F08325; }

.hwdt-auth-field input {
  width: 100%;
  box-sizing: border-box;
  padding: 13px 16px !important;
  border: 1.5px solid rgba(0, 0, 0, 0.11) !important;
  border-radius: 10px !important;
  font-family: 'Open Sans', sans-serif;
  font-size: 14px;
  color: #1C1917;
  background: #FAFAFA !important;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  outline: none !important;
  box-shadow: none !important;
  -webkit-appearance: none;
}

.hwdt-auth-field input:focus {
  border-color: #F08325 !important;
  box-shadow: 0 0 0 3px rgba(240, 131, 37, 0.13) !important;
  background: #fff !important;
}

.hwdt-auth-field input::placeholder { color: #bbb; }

/* Submit button */
.hwdt-auth-btn {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, #F08325, #e07520);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-family: 'Open Sans', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 6px;
  transition: opacity 0.18s, transform 0.1s;
  letter-spacing: 0.01em;
  box-shadow: 0 4px 14px rgba(240, 131, 37, 0.35);
}
.hwdt-auth-btn:hover  { opacity: 0.9; }
.hwdt-auth-btn:active { transform: scale(0.98); }
.hwdt-auth-btn:disabled { opacity: 0.55; cursor: wait; }

/* Error message */
.hwdt-auth-error {
  background: #FFF5F5;
  border: 1px solid #FECACA;
  border-radius: 8px;
  padding: 9px 12px;
  font-family: 'Open Sans', sans-serif;
  font-size: 12px;
  color: #DC2626;
  margin-bottom: 12px;
  line-height: 1.4;
}

/* Switch panel link */
.hwdt-auth-switch {
  text-align: center;
  font-family: 'Open Sans', sans-serif;
  font-size: 13px;
  color: #2d2d2d;
  margin: 16px 0 0;
}

.hwdt-auth-link {
  background: none;
  border: none;
  color: #F08325;
  font-family: 'Open Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.hwdt-auth-link:hover { color: #D6721A; }

/* Mobile */
@media (max-width: 480px) {
  .hwdt-auth-card {
    padding: 28px 20px 22px;
  }
  .hwdt-auth-title { font-size: 26px; }
}
