/* ============================================================
   css/auth.css
   Styles for the login button, user pill, and tier badges.
   Matches DeFade's cyan/purple cyberpunk aesthetic.
   ============================================================ */

.defade-auth-slot {
  display: flex;
  align-items: center;
  position: relative;
}

/* Force the auth slot to always be the LAST item visually in the topbar,
   regardless of where it sits in DOM order. This handles the case where
   .hide-on-native hides items between the auth slot and the wallet button
   (iOS app), pushing the auth slot to the middle of the row. */
.defade-auth-slot.topbar {
  order: 999;
}

/* --- Logged out: "Log in" link --- */
.defade-login-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent, #00b4d8);
  text-decoration: none;
  border: 1px solid var(--accent, #00b4d8);
  border-radius: 6px;
  background: transparent;
  transition: all 0.15s ease;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.defade-login-link:hover {
  background: rgba(0, 180, 216, 0.12);
  box-shadow: 0 0 0 1px rgba(0, 180, 216, 0.4);
}

/* On sub-page nav, blend in with the other text links */
.defade-auth-slot.navlinks .defade-login-link {
  border: 1px solid var(--accent, #00b4d8);
  padding: 4px 10px;
  font-size: 13px;
}

/* --- Logged in: user pill --- */
.defade-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text, #e0e0e0);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  user-select: none;
  outline: none;
}

.defade-user-pill:hover,
.defade-user-pill:focus {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(0, 180, 216, 0.4);
}

.defade-user-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #00ff88;
  box-shadow: 0 0 6px rgba(0, 255, 136, 0.6);
  flex-shrink: 0;
}

.defade-user-email {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text2, #a0a0a0);
  font-size: 11px;
}

.defade-user-chevron {
  opacity: 0.6;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.defade-user-menu.open ~ .defade-user-chevron,
.defade-user-pill .defade-user-menu.open ~ * .defade-user-chevron {
  transform: rotate(180deg);
}

/* --- Tier badges --- */
.defade-tier-badge {
  display: inline-block;
  padding: 1px 6px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}

.defade-tier-pro {
  background: linear-gradient(135deg, #00b4d8, #a855f7);
  color: #fff;
}

.defade-tier-founding {
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  color: #1a1a1a;
}

/* --- Dropdown menu --- */
.defade-user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  max-width: calc(100vw - 24px);
  background: #0f0f15;
  border: 1px solid rgba(0, 180, 216, 0.25);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 180, 216, 0.1);
  padding: 6px;
  display: none;
  flex-direction: column;
  z-index: 9999;
}

.defade-user-menu.open {
  display: flex;
}

.defade-user-menu-email {
  padding: 8px 10px 10px;
  font-size: 11px;
  color: var(--text2, #a0a0a0);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 4px;
  word-break: break-all;
  font-family: 'JetBrains Mono', monospace;
}

.defade-user-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text, #e0e0e0);
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.1s ease;
}

.defade-user-menu-item:hover {
  background: rgba(0, 180, 216, 0.1);
  color: var(--accent, #00b4d8);
}

.defade-user-menu-item.defade-logout {
  color: #ff6b6b;
}

.defade-user-menu-item.defade-logout:hover {
  background: rgba(255, 107, 107, 0.1);
  color: #ff6b6b;
}

/* --- Mobile: shrink the email but keep everything visible --- */
@media (max-width: 640px) {
  .defade-user-email {
    max-width: 90px;
    font-size: 10px;
  }
  .defade-user-pill {
    padding: 5px 8px;
    font-size: 11px;
  }
  .defade-tier-badge {
    font-size: 8px;
    padding: 1px 4px;
  }
  .defade-login-link {
    padding: 5px 10px;
    font-size: 11px;
  }
  /* On mobile, anchor the dropdown to the LEFT edge of the pill so it
     opens to the right and stays in the visible area. */
  .defade-user-menu {
    right: auto;
    left: 0;
    min-width: 220px;
  }
}
