/* User Menu Styling */
.user-menu-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: 20px; /* Add space between cart and user menu */
}

/* User Menu Trigger Button */
.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 10px;
  transition: all 0.2s ease;
  color: #6c757d;
}

.user-menu-trigger:hover {
  background: rgba(118, 167, 19, 0.06);
  color: #495057;
}

.user-menu-trigger:hover .user-name {
  color: #495057;
}

.user-menu-trigger:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(118, 167, 19, 0.2);
}

/* User Avatar */
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #76a713 0%, #5d850f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-initials {
  color: white;
  font-weight: 600;
  font-size: 13px;
  line-height: 1;
}

/* User Info */
.user-info {
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-name {
  font-weight: 400;
  font-size: 13px;
  color: #6c757d;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Dark mode support for user name visibility */
@media (prefers-color-scheme: dark) {
  .user-name {
    color: #e9ecef;
  }
  
  .user-menu-trigger {
    color: #f8f9fa;
  }
  
  .user-chevron {
    color: #adb5bd;
  }
}

/* Ensure visibility on dark header backgrounds */
.header-dark .user-name,
.main-header .user-name {
  color: #6c757d;
  text-shadow: none;
}

.user-chevron {
  font-size: 10px;
  color: #666;
  transition: transform 0.2s ease;
}

/* User Dropdown */
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border: 1px solid #e1e5e9;
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  min-width: 280px;
  overflow: hidden;
  animation: userDropdownFadeIn 0.2s ease;
}

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

/* Dropdown Arrow */
.user-dropdown::before {
  content: '';
  position: absolute;
  top: -8px;
  right: 20px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid #e1e5e9;
}

.user-dropdown::after {
  content: '';
  position: absolute;
  top: -7px;
  right: 20px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid white;
}

/* Dropdown Header */
.user-dropdown-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.user-avatar-large {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #76a713 0%, #5d850f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-initials-large {
  color: white;
  font-weight: 600;
  font-size: 18px;
  line-height: 1;
}

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

.user-name-large {
  font-weight: 600;
  font-size: 16px;
  color: #333;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-email {
  font-size: 13px;
  color: #666;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Dropdown Divider */
.user-dropdown-divider {
  height: 1px;
  background: #e9ecef;
  margin: 0;
}

/* Dropdown Menu */
.user-dropdown-menu {
  list-style: none;
  margin: 0;
  padding: 8px 0;
}

.user-dropdown-item {
  display: flex !important;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #333 !important;
  text-decoration: none !important;
  transition: all 0.2s ease;
  border: none;
  background: none;
  width: 100%;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}

.user-dropdown-item:hover {
  background: #f8f9fa !important;
  color: #76a713 !important;
}

.user-dropdown-item i {
  width: 16px;
  text-align: center;
  font-size: 14px;
  color: inherit;
}

.user-logout-btn:hover {
  background: #fff5f5 !important;
  color: #dc3545 !important;
}

/* Mobile Responsive */
@media only screen and (max-width: 768px) {
  .user-name {
    display: none;
  }
  
  .user-dropdown {
    min-width: 260px;
    right: -10px;
  }
  
  .user-menu-trigger {
    padding: 4px 6px;
  }
  
  .menu-icons {
    gap: 10px !important;
  }
  
  .user-menu-wrapper {
    margin-left: 15px;
  }
  
  /* Adjust Google button size on mobile */
  .google-signin-button iframe {
    max-width: 180px !important;
  }
}

@media only screen and (max-width: 480px) {
  .user-dropdown {
    min-width: 240px;
    right: -20px;
  }
  
  .user-dropdown-header {
    padding: 12px;
  }
  
  .user-avatar-large {
    width: 40px;
    height: 40px;
  }
  
  .user-initials-large {
    font-size: 16px;
  }
  
  /* Further mobile adjustments for small screens */
  .google-signin-button iframe {
    max-width: 140px !important;
    transform: scale(0.9);
  }
  
  .menu-icons {
    gap: 8px !important;
  }
}

/* Header Menu Icons Layout Fixes */
.menu-icons {
  display: flex !important;
  align-items: center !important;
  gap: 15px !important;
  position: relative !important;
}

.menu-icons .nav-search {
  margin-right: 0 !important; /* Remove inline margin */
}

.menu-icons .cart {
  position: relative;
  padding: 8px 12px;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.menu-icons .cart:hover {
  background-color: rgba(118, 167, 19, 0.1);
}

/* Cart badge positioning fix */
.menu-icons .cart span {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #dc3545;
  color: white;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Google Sign-in Button styling */
.google-signin-button {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Override Google's default button styling to fit our layout */
.google-signin-button > div {
  margin: 0 !important;
}

.google-signin-button iframe {
  margin: 0 !important;
}