/* Unified square account icon used in every navigation bar. */
.header-account-icon,
.header-profile-btn {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  padding: 0 !important;
  border: 1px solid rgba(218, 111, 13, 0.24) !important;
  border-radius: 12px !important;
  background: #fff7ed !important;
  color: #001830 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0 !important;
  line-height: 1 !important;
  text-decoration: none !important;
  box-shadow: 0 6px 18px rgba(0, 24, 48, 0.08);
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease !important;
}

.header-profile-btn:empty {
  display: none !important;
}

.header-account-icon:hover,
.header-account-icon:focus-visible,
.header-profile-btn:hover,
.header-profile-btn:focus-visible,
.header-profile-btn.active {
  background: #da6f0d !important;
  border-color: #da6f0d !important;
  color: #fff !important;
  box-shadow: 0 10px 24px rgba(218, 111, 13, 0.24);
  transform: translateY(-1px);
}

.header-account-icon i,
.header-profile-btn i {
  width: 24px !important;
  height: 24px !important;
  margin: 0 !important;
  font-size: 1.15rem !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.header-account-icon i.wafrica-user-icon-hidden,
.header-profile-btn i.wafrica-user-icon-hidden {
  display: none !important;
}

.header-account-icon.wafrica-has-user-avatar,
.header-profile-btn.wafrica-has-user-avatar {
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: hidden !important;
}

.header-account-icon.wafrica-has-user-avatar:hover,
.header-account-icon.wafrica-has-user-avatar:focus-visible,
.header-profile-btn.wafrica-has-user-avatar:hover,
.header-profile-btn.wafrica-has-user-avatar:focus-visible,
.header-profile-btn.wafrica-has-user-avatar.active {
  border-color: rgba(218, 111, 13, 0.28) !important;
  background: transparent !important;
  box-shadow: 0 8px 18px rgba(0, 24, 48, 0.12) !important;
}

.header-account-icon .header-icon-text,
.header-profile-btn .header-icon-text {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.header-account-icon .wafrica-user-avatar-icon,
.header-profile-btn .wafrica-user-avatar-icon {
  width: 30px !important;
  height: 30px !important;
  border-radius: 8px !important;
  border: 1px solid rgba(218, 111, 13, 0.22) !important;
  object-fit: cover !important;
  background: #fff !important;
  box-shadow: none !important;
}

.header-account-icon.wafrica-has-user-avatar .wafrica-user-avatar-icon,
.header-profile-btn.wafrica-has-user-avatar .wafrica-user-avatar-icon {
  width: 42px !important;
  height: 42px !important;
  border: 0 !important;
  border-radius: 12px !important;
  background: transparent !important;
}

@media (max-width: 1023px) {
  .header-profile-dropdown {
    display: none !important;
  }
}

@media (max-width: 480px) {
  header .max-w-7xl {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }

  header .h-16 {
    gap: 0.5rem !important;
    min-width: 0 !important;
  }

  header .h-16 > a:first-child,
  #homeLink {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    gap: 0.5rem !important;
    margin-left: 0 !important;
  }

  header .h-16 > a:first-child img,
  #homeLink img {
    width: 2rem !important;
    height: 2rem !important;
    border-radius: 0.75rem !important;
    flex-shrink: 0 !important;
  }

  header .h-16 > a:first-child span,
  #homeLink span {
    min-width: 0 !important;
    max-width: 9.5rem !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 0.95rem !important;
  }

  header .h-16 > .flex.items-center:last-child {
    gap: 0.35rem !important;
    flex-shrink: 0 !important;
  }

  .header-cart-icon,
  .hamburger-btn,
  .header-account-icon,
  .header-profile-btn {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    padding: 0 !important;
    border-radius: 10px !important;
  }

  .header-cart-icon i,
  .hamburger-btn i,
  .header-account-icon i,
  .header-profile-btn i {
    font-size: 1.15rem !important;
  }

  header #backBtn {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 38px !important;
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 10px !important;
    font-size: 0 !important;
    line-height: 1 !important;
  }

  header #backBtn::before {
    content: "\f060";
    position: absolute;
    top: 50%;
    left: 50%;
    display: block;
    font-family: "Font Awesome 6 Free";
    font-size: 1rem;
    font-weight: 900;
    line-height: 1;
    transform: translate(-50%, -50%);
  }

  #cart-count-badge {
    top: -3px !important;
    right: -3px !important;
  }

  .header-account-icon .wafrica-user-avatar-icon,
  .header-profile-btn .wafrica-user-avatar-icon {
    width: 28px !important;
    height: 28px !important;
    border-radius: 8px !important;
  }

  .header-account-icon.wafrica-has-user-avatar .wafrica-user-avatar-icon,
  .header-profile-btn.wafrica-has-user-avatar .wafrica-user-avatar-icon {
    width: 38px !important;
    height: 38px !important;
    border-radius: 10px !important;
  }
}

/* ===== USER DROPDOWN CONTAINER ===== */
.user-dropdown-container {
  position: relative;
  display: inline-flex;
}

.user-dropdown-trigger {
  cursor: pointer;
  user-select: none;
}

/* ===== USER DROPDOWN MENU ===== */
.user-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 220px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 24, 48, 0.16), 0 2px 8px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(218, 111, 13, 0.12);
  z-index: 10020;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px) scale(0.96);
  transform-origin: top right;
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  padding: 6px;
  overflow: hidden;
}

.user-dropdown-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.user-dropdown-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-dropdown-content[data-auth] {
  display: none;
}

.user-dropdown-content[data-auth].active {
  display: flex;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-family: 'Poppins', ui-sans-serif, system-ui, sans-serif;
  font-weight: 500;
  color: #001830;
  background: transparent;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
  text-align: left;
  line-height: 1.3;
}

.user-dropdown-item i {
  width: 20px;
  height: 20px;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #da6f0d;
  flex-shrink: 0;
}

.user-dropdown-item:hover,
.user-dropdown-item:focus-visible {
  background: #fff7ed;
  color: #da6f0d;
  outline: none;
}

.user-dropdown-logout {
  border-top: 1px solid rgba(0, 24, 48, 0.08);
  margin-top: 2px;
  padding-top: 12px;
}

.user-dropdown-logout i {
  color: #dc2626;
}

.user-dropdown-logout:hover,
.user-dropdown-logout:focus-visible {
  background: #fef2f2;
  color: #dc2626;
}

/* ===== LOGIN POPUP (logged out state) ===== */
.user-login-popup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  text-align: center;
}

.user-login-popup-text {
  font-size: 0.85rem;
  color: #64748b;
  font-family: 'Poppins', ui-sans-serif, system-ui, sans-serif;
  line-height: 1.4;
  margin: 0;
}

.user-login-popup-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 22px;
  font-size: 0.85rem;
  font-family: 'Poppins', ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
  color: #fff;
  background: #da6f0d;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.user-login-popup-btn:hover {
  background: #c25f0a;
  transform: translateY(-1px);
}

.user-dropdown-loading-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(218, 111, 13, 0.25);
  border-top-color: #da6f0d;
  border-radius: 50%;
  animation: user-dropdown-spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 2px;
}

@keyframes user-dropdown-spin {
  to { transform: rotate(360deg); }
}

/* ===== MOBILE DROPDOWN (full overlay) ===== */
@media (max-width: 1023px) {
  body.user-dropdown-menu-open .user-dropdown-menu {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    min-width: 0;
    max-width: calc(100vw - 32px);
    width: calc(100vw - 32px);
    border-radius: 18px;
    z-index: 10040 !important;
    transform: translate(-50%, calc(-50% + 20px)) scale(0.95);
    transform-origin: center center;
  }

  body.user-dropdown-menu-open .user-dropdown-menu.open {
    transform: translate(-50%, -50%) scale(1);
  }

  .user-dropdown-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 24, 48, 0.35);
    backdrop-filter: blur(3px);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
  }

  .user-dropdown-backdrop.show {
    opacity: 1;
    visibility: visible;
  }
}

@media (max-width: 480px) {
  body.user-dropdown-menu-open .user-dropdown-menu {
    max-width: calc(100vw - 16px);
    width: calc(100vw - 16px);
    border-radius: 16px;
  }
}

@media (max-width: 360px) {
  header .h-16 > a:first-child,
  #homeLink {
    flex: 0 0 auto !important;
  }

  header .h-16 > a:first-child span,
  #homeLink span {
    display: none !important;
  }

  header .h-16 > .flex.items-center:last-child {
    gap: 0.25rem !important;
  }

  .header-cart-icon,
  .hamburger-btn,
  .header-account-icon,
  .header-profile-btn {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
  }

  .header-account-icon.wafrica-has-user-avatar .wafrica-user-avatar-icon,
  .header-profile-btn.wafrica-has-user-avatar .wafrica-user-avatar-icon {
    width: 36px !important;
    height: 36px !important;
  }
}
