@import url('./username-effects.css');

/* ========================================
   USER PROFILE WIDGET - Navbar Component
   ======================================== */

/* Animations */
@keyframes dropdownSlide {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes profilePop {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes menuItemSlide {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* User Profile Container */
.user-profile {
  position: relative;
  display: none;
  animation: profilePop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.user-profile.active {
  display: flex;
}

/* Profile Trigger Button */
.user-profile-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px 6px 6px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.user-profile-trigger:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-light);
  transform: translateY(-1px);
}

.user-profile.open .user-profile-trigger {
  border-color: var(--accent-primary);
  box-shadow: 0 0 20px var(--accent-glow);
}

/* Avatar */
.user-profile-avatar {
  width: 36px;
  height: 36px;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  border-radius: 50%;
  background-color: var(--bg-card);
  border: 2px solid var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-primary);
  overflow: hidden;
  transition: all var(--transition-fast);
}

.user-profile-trigger:hover .user-profile-avatar {
  border-color: var(--accent-secondary);
  transform: scale(1.05);
}

.user-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Info Section */
.user-profile-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 5px;
  min-width: 0;
}

.user-profile-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.15;
}

.user-profile-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: max-content;
  max-width: 100%;
  box-sizing: border-box;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--accent-primary);
  background-color: rgba(0, 212, 170, 0.15);
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.user-profile-status.owner {
  color: #ff6b6b;
  background-color: rgba(255, 0, 0, 0.16);
}

.user-profile-status.admin {
  color: #e74c3c;
  background-color: rgba(231, 76, 60, 0.16);
}

.user-profile-status.moderator {
  color: #f39c12;
  background-color: rgba(243, 156, 18, 0.16);
}

.user-profile-status.verified_creator {
  color: #00d4aa;
  background-color: rgba(0, 212, 170, 0.16);
}

.user-profile-status.trusted {
  color: #7dd3fc;
  background-color: rgba(56, 189, 248, 0.16);
}

.user-profile-status.member {
  color: #94a3b8;
  background-color: rgba(148, 163, 184, 0.14);
}

/* Dropdown Arrow */
.user-profile-arrow {
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: transform var(--transition-normal);
}

.user-profile.open .user-profile-arrow {
  transform: rotate(180deg);
}

/* Dropdown Menu */
.user-profile-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 240px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.95);
  transition: all var(--transition-normal);
  z-index: 1000;
  overflow: hidden;
}

.user-profile.open .user-profile-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  animation: dropdownSlide 0.3s ease forwards;
}

/* Dropdown Header */
.user-profile-dropdown-header {
  padding: 20px;
  background-color: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  text-align: center;
}

.user-profile-dropdown-avatar {
  width: 56px;
  height: 56px;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  border-radius: 50%;
  background-color: var(--bg-card);
  border: 3px solid var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin: 0 auto 12px;
  transition: transform 0.3s ease, border-color 0.3s ease;
  overflow: hidden;
}

.user-profile-dropdown-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-profile-dropdown-avatar:hover {
  transform: scale(1.05);
  border-color: var(--accent-secondary);
}

.user-profile-dropdown-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.user-profile-dropdown-role {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.user-profile-dropdown-role.owner {
  color: #ff0000;
}

.user-profile-dropdown-role.admin {
  color: #e74c3c;
}

.user-profile-dropdown-role.moderator {
  color: #f39c12;
}

.user-profile-dropdown-role.creator {
  color: #9b59b6;
}

.user-profile-dropdown-role.member {
  color: #94a3b8;
}

.user-profile-dropdown-robux {
  margin-top: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.user-profile-dropdown-role.trusted {
  color: #7dd3fc;
}

.user-profile-dropdown-role.verified_creator {
  color: #00d4aa;
}

/* Menu Items */
.user-profile-menu {
  padding: 8px;
}

.user-profile-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  cursor: pointer;
  opacity: 0;
  animation: menuItemSlide 0.3s ease forwards;
}

.user-profile.open .user-profile-menu-item:nth-child(1) { animation-delay: 0.1s; }
.user-profile.open .user-profile-menu-item:nth-child(2) { animation-delay: 0.15s; }
.user-profile.open .user-profile-menu-item:nth-child(3) { animation-delay: 0.2s; }
.user-profile.open .user-profile-menu-item:nth-child(4) { animation-delay: 0.25s; }
.user-profile.open .user-profile-menu-item:nth-child(5) { animation-delay: 0.3s; }
.user-profile.open .user-profile-menu-item:nth-child(6) { animation-delay: 0.35s; }

.user-profile-menu-item:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  transform: translateX(4px);
}

.user-profile-menu-item-icon {
  font-size: 1.1rem;
  width: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
}

.user-profile-menu-item-icon svg {
  width: 18px;
  height: 18px;
}

.user-profile-menu-item:hover .user-profile-menu-item-icon {
  color: var(--accent-primary);
}

.user-profile-menu-item.danger .user-profile-menu-item-icon {
  color: inherit;
}

.user-profile-menu-item.danger {
  color: var(--danger);
}

.user-profile-menu-item.danger:hover {
  background-color: rgba(255, 71, 87, 0.1);
}

.user-profile-menu-item.admin-link {
  color: #e74c3c;
}

.user-profile-menu-item.admin-link:hover {
  background-color: rgba(231, 76, 60, 0.1);
}

/* Divider */
.user-profile-menu-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 8px 0;
}

/* Notification Badge */
.user-profile-menu-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background-color: var(--danger);
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  color: white;
  display: none;
  align-items: center;
  justify-content: center;
}

.user-profile-menu-badge.active {
  display: flex;
}

/* NexBux — navbar chip (beside profile dropdown) */
.navbar-nexbux-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 48px;
  padding: 0 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  color: var(--accent-primary);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.navbar-nexbux-chip:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
  transform: translateY(-1px);
  color: var(--accent-primary);
}

.navbar-nexbux-amount {
  font-variant-numeric: tabular-nums;
}

.navbar-nexbux-label {
  font-weight: 600;
  color: var(--text-secondary);
}

.navbar-nexbux-chip:hover .navbar-nexbux-label {
  color: var(--text-primary);
}

.user-profile-dropdown-nexbux {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(0, 212, 170, 0.08);
  border: 1px solid rgba(0, 212, 170, 0.22);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: background var(--transition-fast);
}

.user-profile-dropdown-nexbux:hover {
  background: rgba(0, 212, 170, 0.14);
  color: inherit;
}

.user-profile-dropdown-nexbux-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.user-profile-dropdown-nexbux-value {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--accent-primary);
  text-align: right;
}

.user-profile-dropdown-nexbux-value small {
  display: block;
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 2px;
}

.mobile-user-profile-nexbux {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-primary);
  text-decoration: none;
}

@media (max-width: 768px) {
  .navbar-nexbux-chip {
    display: none;
  }
}

/* Login Button (when logged out) */
.navbar-login-btn {
  display: flex;
}

.navbar-login-btn.hidden {
  display: none;
}

/* Responsive */
@media (max-width: 992px) {
  .user-profile {
    display: none !important;
  }
  
  .user-profile.active {
    display: none !important;
  }
  
  /* Show in mobile menu instead */
  .mobile-user-profile {
    display: none;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
  }
  
  .mobile-user-profile.active {
    display: block;
    animation: fadeInDown 0.3s ease forwards;
  }
  
  .mobile-user-profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
  }
  
  .mobile-user-profile-avatar {
    width: 48px;
    height: 48px;
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
    border-radius: 50%;
    background-color: var(--bg-tertiary);
    border: 2px solid var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-primary);
    overflow: hidden;
  }
  
  .mobile-user-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  
  .mobile-user-profile-info {
    flex: 1;
  }
  
  .mobile-user-profile-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
  }
  
  .mobile-user-profile-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: max-content;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1;
    text-transform: uppercase;
    color: var(--accent-primary);
    background-color: rgba(0, 212, 170, 0.15);
    padding: 3px 8px;
    border-radius: 999px;
  }

  .mobile-user-profile-status.owner {
    color: #ff6b6b;
    background-color: rgba(255, 0, 0, 0.16);
  }

  .mobile-user-profile-status.admin {
    color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.16);
  }

  .mobile-user-profile-status.moderator {
    color: #f39c12;
    background-color: rgba(243, 156, 18, 0.16);
  }

  .mobile-user-profile-status.verified_creator {
    color: #00d4aa;
    background-color: rgba(0, 212, 170, 0.16);
  }

  .mobile-user-profile-status.trusted {
    color: #7dd3fc;
    background-color: rgba(56, 189, 248, 0.16);
  }

  .mobile-user-profile-status.member {
    color: #94a3b8;
    background-color: rgba(148, 163, 184, 0.14);
  }

  .mobile-user-profile-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 14px;
  }

  .mobile-menu-auth-guest.hidden,
  .mobile-menu-cta.hidden,
  .mobile-menu-link.hidden,
  #mobile-dashboard-link.hidden {
    display: none !important;
  }

  .mobile-menu-signout {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    font: inherit;
    cursor: pointer;
    color: var(--text-secondary);
  }

  .mobile-menu-signout:hover {
    color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.04);
  }
}

