/* User Menu Styles - Industry Best Practice */

/* User Menu Container - Positioned in Header */
.user-menu-container {
  position: relative;
  display: flex;
  align-items: center;
  z-index: 1000;
}

.user-menu {
  position: relative;
}

.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.user-menu-trigger:hover {
  border-color: var(--brand);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transform: translateY(-1px);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand, #059669) 0%, var(--brand-hover, #047857) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
  /* Ensure visibility in all themes */
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.user-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-arrow {
  opacity: 0.7;
  transition: transform 0.2s ease;
}

.user-menu-trigger:hover .dropdown-arrow {
  opacity: 1;
}

/* Dropdown Menu */
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 280px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.95);
  transition: all 0.2s ease;
  z-index: 1001;
  /* Ensure content is visible */
  overflow: visible;
}

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

.user-dropdown-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  /* Ensure header is visible */
  min-height: 60px;
}

.user-dropdown-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand, #059669) 0%, var(--brand-hover, #047857) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 18px;
  flex-shrink: 0;
  /* Ensure visibility in all themes */
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.user-dropdown-info {
  flex: 1;
  min-width: 0;
}

.user-dropdown-name {
  font-weight: 600;
  font-size: 16px;
  margin: 0 0 4px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-dropdown-email {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-dropdown-menu {
  list-style: none;
  padding: 8px;
  margin: 0;
  /* Ensure menu is visible */
  min-height: 120px;
}

.user-dropdown-menu li {
  margin: 0;
}

.user-dropdown-menu li.divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

.user-dropdown-menu a {
  display: block;
  padding: 12px 16px;
  color: var(--ink);
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 14px;
  transition: all 0.2s ease;
  /* Ensure links are clickable */
  position: relative;
  z-index: 1;
}

.user-dropdown-menu a:hover {
  background: var(--brand-light);
  color: var(--brand);
}

.user-dropdown-menu a.sign-out {
  color: #dc2626;
}

.user-dropdown-menu a.sign-out:hover {
  background: #fee;
}

/* Desktop - User menu appears after nav */
@media (min-width: 1025px) {
  .user-menu-container {
    position: absolute;
    right: 48px;
    top: 50%;
    transform: translateY(-50%);
  }
}

/* Tablet - User menu appears between burger and nav */
@media (max-width: 1199px) and (min-width: 769px) {
  .user-menu-container {
    order: 2;
    margin-left: auto;
    margin-right: 16px;
  }
  
  .burger-menu {
    order: 3;
  }
  
  .user-name {
    max-width: 80px;
    font-size: 13px;
  }
  
  .user-menu-trigger {
    padding: 8px 10px;
    font-size: 13px;
  }
  
  .user-dropdown {
    right: -10px;
    min-width: 260px;
  }
}

/* Mobile - User menu appears before burger menu */
@media (max-width: 768px) {
  .user-menu-container {
    order: 2;
    margin-left: auto;
    margin-right: 16px;
  }
  
  .burger-menu {
    order: 3;
  }
  
  .user-name {
    display: none;
  }
  
  .user-menu-trigger {
    padding: 8px;
  }
  
  .user-dropdown {
    right: 0;
    left: auto;
    min-width: 280px;
    width: 280px;
    max-width: calc(100vw - 32px);
  }
}

/* Extra small mobile screens */
@media (max-width: 480px) {
  .user-menu-container {
    margin-right: 12px;
  }
  
  .user-dropdown {
    right: 0;
    left: auto;
    min-width: 260px;
    width: 260px;
    max-width: calc(100vw - 24px);
  }
}

