/* ===== BASE HEADER STYLES ===== */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1.5rem;
  background: var(--header-bg);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
  height: 70px;
  box-sizing: border-box;
}

/* Left section - Logo */
.header-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-width: 200px;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.logo img {
  height: 50px;
  width: auto;
  object-fit: contain;
}

.logo-text {
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--accent-color);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 0 2px 4px rgba(139, 92, 246, 0.2);
}

.marketplace-nav ul {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0.75rem;
}

.marketplace-nav a {
  text-decoration: none;
  color: var(--nav-link);
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.95rem;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.marketplace-nav a:hover,
.marketplace-nav a:focus {
  color: var(--nav-link-hover);
  background: rgba(0, 0, 0, 0.05);
}

/* Search container - positioned between logo and profile */
.search-container {
  flex: 1;
  max-width: 650px;
  margin: 0 2rem;
  position: relative;
  display: flex;
  align-items: center;
  order: 2; /* Position between logo and profile */
}

.search-icon-mobile {
  display: none;
  font-size: 1.3rem;
  padding: 0.5rem;
  cursor: pointer;
  color: var(--nav-link);
  background: none;
  border: none;
  transition: color 0.2s ease;
}

.search-icon-mobile:hover {
  color: var(--nav-link-hover);
}

.search-bar {
  width: 100%;
  transition: all 0.3s ease;
}

/* Search input styles */
.search-input-wrapper {
  position: relative;
  width: 100%;
}

.search-input-wrapper input {
  width: 100%;
  padding: 0.7rem 2.5rem 0.7rem 3rem;
  border-radius: 999px;
  border: 1px solid var(--search-border);
  background: var(--search-bg);
  color: var(--text);
  font-size: 1rem;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.search-input-wrapper input:focus {
  outline: none;
  border-color: var(--search-focus-border);
  box-shadow: 0 0 0 3px var(--search-focus-shadow);
}

.search-icon {
  position: absolute;
  left: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--search-icon);
  pointer-events: none;
}

.clear-button {
  position: absolute;
  right: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--search-icon);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0.25rem;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.clear-button:hover {
  opacity: 1;
}

/* Right section - Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-width: 200px;
  justify-content: flex-end;
  flex-shrink: 0;
  order: 3; /* Position after search */
}

/* Auth links */
.auth-links {
  display: flex;
  gap: 0.75rem;
}

.auth-links a {
  padding: 0.6rem 1.25rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.auth-links .login-link {
  color: var(--nav-link);
  border: 1px solid var(--border);
}

.auth-links .login-link:hover {
  background: rgba(0, 0, 0, 0.05);
}

.auth-links .signup-link {
  background: var(--accent-color);
  color: white;
  border: 1px solid var(--accent-color);
}

.auth-links .signup-link:hover {
  background: var(--accent-color-hover);
  border-color: var(--accent-color-hover);
}

/* Account display */
.account-display {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem;
  border-radius: 999px;
  transition: all 0.2s ease;
}

.account-display:hover {
  background: rgba(0, 0, 0, 0.05);
}

.profile-pic-mini {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: var(--accent-color);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
  flex-shrink: 0;
  /* Critical fixes */
  max-width: 38px;
  max-height: 38px;
  box-sizing: border-box;
  overflow: hidden;
  padding: 0;
  /* Remove text styles since we're using an image */
  color: transparent;
  font-size: 0;
}

.profile-pic-mini img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.profile-name {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-display:hover .profile-pic-mini {
  transform: scale(1.05);
}

/* Notifications */
.notifications {
  position: relative;
}

.notification-bell {
  background: none;
  border: none;
  color: var(--nav-link);
  font-size: 1.3rem;
  cursor: pointer;
  position: relative;
  padding: 0.5rem;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.notification-bell:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--nav-link-hover);
}

.notification-count {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  background: var(--nav-link-hover);
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.notification-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  width: 350px;
  max-height: 500px;
  background: var(--dropdown-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  padding: 1rem;
  z-index: 100;
  overflow: hidden;
}

.notification-dropdown.open {
  display: flex;
  flex-direction: column;
  max-height: 500px;
}

@keyframes fadeInDropdown {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.notifications:hover .notification-dropdown {
  display: block;
}

.notification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--dropdown-bg);
  flex-shrink: 0;
}

.notification-header h4 {
  margin: 0;
  font-size: 1rem;
}

.notification-header .mark-all-read {
  background: none;
  border: none;
  color: var(--accent-color);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
}

.notification-list {
  padding: 0.5rem 0;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: none;
}

.no-notifications {
  padding: 1.5rem;
  text-align: center;
  color: var(--item-details);
  font-size: 0.9rem;
}

/* Wallet dropdown */
.wallet-dropdown {
  position: relative;
}

.wallet-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bubble-bg);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  font-weight: 600;
}

.wallet-toggle:hover {
  background: var(--bubble-hover-bg);
}

.token-count {
  color: var(--text);
}

.token-icon {
  color: gold;
  font-size: 1.1rem;
}

.wallet-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  background: var(--dropdown-bg);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  z-index: 1000;
  border: 1px solid var(--border);
  transform-origin: top right;
  animation: fadeInDropdown 0.2s ease-out;
}

.wallet-dropdown:hover .wallet-menu {
  display: block;
}

.wallet-menu a {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  color: var(--text);
  text-decoration: none;
  transition: background-color 0.2s ease;
  font-size: 0.95rem;
  gap: 0.75rem;
}

.wallet-menu a:hover {
  background: var(--bubble-hover-bg);
}

.wallet-menu a i {
  width: 1.25rem;
  text-align: center;
  font-size: 1rem;
  color: var(--accent-color);
}

/* Settings dropdown */
.settings-dropdown {
  position: relative;
}

.settings-toggle {
  background: none;
  border: none;
  color: var(--nav-link);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.settings-toggle:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--nav-link-hover);
}

.settings-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  background: var(--dropdown-bg);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  z-index: 1000;
  border: 1px solid var(--border);
  transform-origin: top right;
  animation: fadeInDropdown 0.2s ease-out;
}

.settings-dropdown.open .settings-menu {
  display: block;
}

.settings-menu a {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  color: var(--text);
  text-decoration: none;
  transition: background-color 0.2s ease;
  font-size: 0.95rem;
  gap: 0.75rem;
}

.settings-menu a:hover {
  background: var(--bubble-hover-bg);
}

.settings-menu a i {
  width: 1.25rem;
  text-align: center;
  font-size: 1rem;
  color: var(--accent-color);
}

.settings-menu .signout-link {
  color: var(--nav-link-hover);
  border-top: 1px solid var(--border);
  margin-top: 0.25rem;
  padding-top: 0.85rem;
}

/* Dark mode toggle */
.dark-mode-toggle {
  background: none;
  border: none;
  color: var(--nav-link);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.dark-mode-toggle:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* Balance update animation */
.wallet-display.balance-updated {
  animation: pulseBalance 1s ease;
}

@keyframes pulseBalance {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* ===== IMPROVED MOBILE RESPONSIVENESS ===== */
@media (max-width: 1024px) {
  .marketplace-nav {
    display: none;
  }
  
  .header-left {
    min-width: auto;
    flex-shrink: 0;
  }
  
  .search-container {
    margin: 0 1rem;
    flex: 0 1 auto;
    min-width: 0;
  }
}

@media (max-width: 768px) {
  header {
    padding: 0.5rem 0.75rem;
    height: 56px;
    min-height: 56px;
    overflow: visible;
    position: relative;
    z-index: 1001;
    gap: 0.5rem;
  }
  
  /* Reorder elements for mobile: LOGO > SEARCHBAR > PROFILE > NOTIFICATION > TOKENS > SETTINGS */
  .header-left {
    order: 1;
    flex-shrink: 0;
    min-width: auto;
  }
  
  .logo img {
    height: 36px;
    width: auto;
    flex-shrink: 0;
  }
  
  .logo-text {
    display: none;
  }
  
  /* Search container - positioned between logo and profile */
  .search-container {
    margin: 0;
    justify-content: flex-end;
    flex: 1;
    min-width: 0;
    max-width: none;
    order: 2;
    position: static;
  }
  
  /* Search icon button - matches other icons */
  .search-icon-mobile {
    display: flex;
    font-size: 1.1rem;
    padding: 0;
    background: var(--bubble-bg, #f1f1f1);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    color: var(--nav-link, #666);
    border: 1px solid var(--border, #e0e0e0);
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1003;
  }
  
  .search-icon-mobile:hover {
    background: var(--bubble-hover-bg, #e9e9e9);
    color: var(--nav-link-hover, #333);
    transform: scale(1.05);
  }
  
  /* FIXED: Mobile search bar - proper dark mode support */
  .search-bar {
    position: fixed;
    left: 0;
    right: 0;
    top: 56px;
    width: 100vw;
    margin: 0;
    padding: 0.875rem;
    background: var(--header-bg, #ffffff);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    z-index: 1002;
    display: none;
    border-bottom: 1px solid var(--border, #e0e0e0);
    animation: slideDown 0.3s ease-out;
    box-sizing: border-box;
    overflow: visible;
  }
  
  .search-bar.active {
    display: block;
  }
  
  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  /* FIXED: Search input wrapper - proper dark mode colors */
  .search-input-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: visible;
  }
  
  .search-input-wrapper input {
    width: 100%;
    padding: 0.875rem 3rem 0.875rem 2.75rem;
    font-size: 1rem;
    border-radius: 12px;
    border: 2px solid var(--search-border, #ddd);
    background: var(--search-bg, #fff);
    color: var(--text, #333);
    box-sizing: border-box;
    transition: all 0.2s ease;
  }
  
  .search-input-wrapper input:focus {
    outline: none;
    border-color: var(--accent-color, #8B5CF6);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
    background: var(--search-bg, #fff);
  }
  
  .search-input-wrapper input::placeholder {
    color: var(--text-muted, #999);
  }
  
  .search-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    color: var(--search-icon, #666);
    pointer-events: none;
  }
  
  .clear-button {
    position: absolute;
    right: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    color: var(--search-icon, #666);
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
  }
  
  .clear-button:hover {
    color: var(--nav-link-hover, #333);
    transform: translateY(-50%) scale(1.1);
  }
  
  /* FIXED: Mobile search suggestions positioning */
  .search-suggestions {
    position: fixed !important;
    top: 112px !important;
    left: 15px !important;
    right: 15px !important;
    width: calc(100vw - 30px) !important;
    max-height: 60vh !important;
    z-index: 1003 !important;
    background: var(--dropdown-bg, #ffffff) !important;
    border: 1px solid var(--border, #ddd) !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2) !important;
    overflow-y: auto !important;
  }
  
  /* Header actions - optimized layout with proper order */
  .header-actions {
    gap: 0.5rem;
    min-width: 0;
    flex-shrink: 0;
    justify-content: flex-end;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    order: 3;
  }
  
  /* Profile with background color */
  .profile-pic-mini {
    background-color: var(--accent-color, #8B5CF6);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid var(--border, #e0e0e0);
    flex-shrink: 0;
    order: 1; /* PROFILE comes first in the actions section */
  }
  
  .profile-name {
    display: none;
  }
  
  /* Notifications */
  .notifications {
    order: 2; /* NOTIFICATION comes after profile */
  }
  
  .notification-bell {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bubble-bg, #f1f1f1);
    border: 1px solid var(--border, #e0e0e0);
    transition: all 0.2s ease;
    flex-shrink: 0;
    cursor: pointer;
  }
  
  /* Wallet dropdown */
  .wallet-dropdown {
    order: 3; /* TOKENS comes after notification */
  }
  
  .wallet-toggle {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    border-radius: 20px;
    flex-shrink: 0;
    white-space: nowrap;
    transition: all 0.2s ease;
    background: var(--bubble-bg, #f1f1f1);
    border: 1px solid var(--border, #e0e0e0);
  }
  
  .wallet-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
  
  .wallet-toggle .token-count {
    font-size: 0.8rem;
    font-weight: 700;
  }
  
  .token-icon {
    font-size: 0.9rem;
  }
  
  /* Settings dropdown */
  .settings-dropdown {
    order: 4; /* SETTINGS comes last */
  }
  
  .settings-toggle {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bubble-bg, #f1f1f1);
    border: 1px solid var(--border, #e0e0e0);
    transition: all 0.2s ease;
    flex-shrink: 0;
    cursor: pointer;
  }
  
  /* Dark mode toggle */
  .dark-mode-toggle {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bubble-bg, #f1f1f1);
    border: 1px solid var(--border, #e0e0e0);
    transition: all 0.2s ease;
    flex-shrink: 0;
    cursor: pointer;
  }
  
  /* Hover effects for all icons */
  .notification-bell:hover,
  .settings-toggle:hover,
  .dark-mode-toggle:hover,
  .profile-pic-mini:hover,
  .wallet-toggle:hover {
    background: var(--bubble-hover-bg, #e9e9e9);
    transform: scale(1.05);
    border-color: var(--nav-link-hover, #999);
  }
  
  /* Notification badge positioning */
  .notification-bell {
    position: relative;
  }
  
  .notification-count {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.35rem;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
    border: 2px solid var(--header-bg, #fff);
  }
  
  /* Auth links - clean and compact */
  .auth-links {
    gap: 0.5rem;
    display: flex;
    align-items: center;
    flex-shrink: 0;
  }
  
  .auth-links a {
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
    flex-shrink: 0;
    white-space: nowrap;
    text-decoration: none;
  }
  
  .auth-links .login-link {
    color: var(--nav-link, #666);
    border: 1px solid var(--border, #e0e0e0);
    background: var(--bubble-bg, #f8f9fa);
  }
  
  .auth-links .login-link:hover {
    background: var(--bubble-hover-bg, #e9ecef);
    border-color: var(--nav-link-hover, #495057);
    color: var(--nav-link-hover, #333);
  }
  
  .auth-links .signup-link {
    background: var(--accent-color, #8B5CF6);
    color: white;
    border: 1px solid var(--accent-color, #8B5CF6);
  }
  
  .auth-links .signup-link:hover {
    background: var(--accent-color-hover, #7c3aed);
    border-color: var(--accent-color-hover, #7c3aed);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
  }
  
  /* Mobile search overlay for better UX */
  .search-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1001;
    backdrop-filter: none;
  }
  
  .search-overlay.active {
    display: block;
  }
  
  @keyframes fadeIn {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }
}

/* Extra small devices optimization */
@media (max-width: 380px) {
  header {
    padding: 0.4rem 0.5rem;
  }
  
  .header-actions {
    gap: 0.35rem;
  }
  
  .auth-links {
    gap: 0.35rem;
  }
  
  .auth-links a {
    padding: 0.45rem 0.7rem;
    font-size: 0.8rem;
  }
  
  .wallet-toggle {
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
  }
  
  .profile-pic-mini,
  .notification-bell,
  .settings-toggle,
  .dark-mode-toggle,
  .search-icon-mobile {
    width: 34px;
    height: 34px;
    font-size: 1rem;
  }
  
  .search-bar {
    padding: 0.75rem;
  }
  
  .search-input-wrapper input {
    padding: 0.75rem 2.75rem 0.75rem 2.5rem;
    font-size: 0.95rem;
  }
}

@media (max-width: 480px) {
  header {
    padding: 0.3rem 0.5rem;
    height: 50px;
    gap: 0.3rem;
  }
  
  .logo img {
    height: 32px;
  }
  
  /* Beautiful icon-only auth buttons */
  .auth-links .login-link span,
  .auth-links .signup-link span {
    display: none;
  }
  
  .auth-links .login-link,
  .auth-links .signup-link {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0;
    position: relative;
    transition: all 0.2s ease;
  }
  
  /* Clean, modern icons using Font Awesome */
  .auth-links .login-link::after,
  .auth-links .signup-link::after {
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .auth-links .login-link::after {
    content: "\f2f6";
    color: var(--nav-link, #666);
  }
  
  .auth-links .signup-link::after {
    content: "\f234";
    color: white;
  }
  
  /* Remove the old ::before content to avoid duplicates */
  .auth-links .login-link:before,
  .auth-links .signup-link:before {
    content: none;
  }
  
  /* Hide wallet text on smallest screens */
  .wallet-toggle .wallet-text {
    display: none;
  }
  
  .wallet-toggle {
    padding: 0.3rem 0.5rem;
    min-width: 36px;
    justify-content: center;
  }
  
  /* Even more compact icons */
  .profile-pic-mini,
  .notification-bell,
  .settings-toggle,
  .dark-mode-toggle,
  .search-icon-mobile {
    width: 34px;
    height: 34px;
    font-size: 1rem;
  }
  
  .header-actions {
    gap: 0.3rem;
  }
  
  /* Ensure header elements don't wrap */
  .header-left,
  .search-container,
  .header-actions {
    flex-shrink: 0;
  }
  
  /* Force header to be a single row */
  header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    overflow: hidden;
  }
}

/* Improved animations */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Overlay for search - better UX */
.search-overlay {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.15);
  z-index: 999;
  display: none;
  animation: fadeIn 0.3s ease-out;
  backdrop-filter: none;
}

.search-bar.active ~ .search-overlay {
  display: block;
}

/* Prevent body scroll when search is open */
body.search-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* ===== SEARCH BAR ===== */
.search-bar {
  flex: 1;
  min-width: 0;
  max-width: 600px;
  margin: 0 1.5rem;
  position: relative;
}

.search-input-wrapper {
  position: relative;
  width: 100%;
  max-width: 600px;
  box-sizing: border-box;
}

.search-input-wrapper input {
  padding: 0.75rem 1.5rem 0.75rem 3rem;
  border-radius: 999px;
  background: var(--search-bg);
  border: 1px solid var(--search-border);
  color: var(--text);
  font-size: 1rem;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input-wrapper input:focus {
  border-color: var(--search-focus-border);
  outline: none;
  box-shadow: 0 0 0 3px var(--search-focus-shadow);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--search-icon);
  pointer-events: none;
  font-size: 1.2rem;
}

.search-input-wrapper .clear-button {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--nav-link);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0;
  display: none;
}

.search-input-wrapper .clear-button:hover {
  color: var(--nav-link-hover);
}

/* ===== SEARCH SUGGESTIONS ===== */
.search-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  background: var(--suggestions-bg);
  border: 1px solid var(--suggestions-border);
  border-radius: 8px;
  box-shadow: 0 8px 20px var(--suggestions-shadow);
  max-height: 320px;
  overflow-y: auto;
  padding: 0;
  margin: 0;
  list-style: none;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 1050;
}

.search-suggestions.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.search-suggestions li.suggestion-heading {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--heading-text);
  background: var(--heading-bg);
  border-bottom: 1px solid var(--border);
  cursor: default;
  display: flex;
  align-items: center;
}

.search-suggestions li.suggestion-heading i {
  color: var(--category-accent);
  margin-right: 0.5rem;
}

.delete-history {
  background: none;
  border: none;
  color: var(--nav-link);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease;
  padding: 0.5rem;
  margin-left: auto;
}

.suggestion-entry:hover .delete-history {
  opacity: 0.7;
}

.suggestion-entry:hover .delete-history:hover {
  opacity: 1;
  color: var(--nav-link-hover);
}

.search-suggestions li.no-results {
  padding: 0.8rem 1rem;
  text-align: center;
  color: var(--no-results);
  font-style: italic;
}

.search-suggestions li.suggestion-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 1rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-size: 0.95rem;
  color: var(--suggestion-text);
}

.search-suggestions li.suggestion-entry:hover,
.search-suggestions li.suggestion-entry:focus,
.search-suggestions li.suggestion-entry.active {
  background-color: var(--suggestion-hover);
  color: var(--text);
  outline: none;
}

.search-suggestions .match {
  background-color: var(--match-bg);
  color: var(--match-text);
  padding: 0 2px;
  border-radius: 3px;
}

.suggestion-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.suggestion-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.suggestion-thumb {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.suggestion-thumb-container {
  width: 60px;
  height: 60px;
  overflow: hidden;
  border-radius: 4px;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.suggestion-text {
  flex: 1;
  min-width: 0;
}

.suggestion-title {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.suggestion-meta {
  font-size: 0.75rem;
  color: var(--nav-link);
  margin-top: 0.15rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.suggestion-price {
  color: var(--nav-link-hover);
  font-weight: 600;
}

.suggestion-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.suggestion-tag {
  background: rgba(255,255,255,0.1);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.65rem;
  color: var(--nav-link);
  white-space: nowrap;
}

.suggestion-badge {
  color: white;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
}

.suggestion-rating {
  color: #ffb400;
  font-size: 0.75rem;
}

.no-results {
  padding: 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.no-results i {
  font-size: 1.5rem;
  color: var(--nav-link);
  opacity: 0.7;
  margin-bottom: 0.5rem;
}

.no-results div {
  font-weight: 500;
}

.no-results small {
  color: var(--nav-link);
  opacity: 0.7;
  font-size: 0.85rem;
}

.user-status {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.user-status.online {
  background: #4caf50;
}

.user-status.idle {
  background: #ff9800;
}

.user-status.offline {
  background: #9e9e9e;
}

/* ===== DARK MODE FIXES ===== */
/* Ensure proper CSS variable fallbacks for dark mode */
:root {
  --header-bg: #ffffff;
  --search-bg: #ffffff;
  --search-border: #ddd;
  --text: #333333;
  --text-muted: #999999;
  --search-icon: #666666;
  --dropdown-bg: #ffffff;
  --border: #e0e0e0;
  --bubble-bg: #f8f9fa;
  --nav-link: #666666;
  --nav-link-hover: #333333;
}

/* Dark mode variables */
.dark-mode {
  --header-bg: #1a1a1a;
  --search-bg: #2d2d2d;
  --search-border: #444444;
  --text: #ffffff;
  --text-muted: #888888;
  --search-icon: #aaaaaa;
  --dropdown-bg: #2d2d2d;
  --border: #444444;
  --bubble-bg: #2d2d2d;
  --nav-link: #cccccc;
  --nav-link-hover: #ffffff;
}

/* Apply dark mode styles */
.dark-mode .search-bar {
  background: var(--header-bg);
  border-bottom-color: var(--border);
}

.dark-mode .search-input-wrapper input {
  background: var(--search-bg);
  border-color: var(--search-border);
  color: var(--text);
}

.dark-mode .search-input-wrapper input::placeholder {
  color: var(--text-muted);
}

.dark-mode .search-icon,
.dark-mode .clear-button {
  color: var(--search-icon);
}

.dark-mode .search-suggestions {
  background: var(--dropdown-bg);
  border-color: var(--border);
}

/* Token balance update animation */
.balance-updated {
  animation: balancePulse 1s ease-in-out;
}

@keyframes balancePulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.wallet-balance.updated {
  color: var(--accent-color);
  font-weight: bold;
}

/* ===== MOBILE RESPONSIVENESS FIXES ===== */
@media (max-width: 1024px) {
  .marketplace-nav {
    display: none;
  }
  
  .header-left {
    min-width: auto;
  }
  
  .search-container {
    margin: 0 1rem;
  }
  
  /* Tablet: Full-screen notifications */
  .notification-dropdown {
    position: fixed !important;
    top: 70px !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: calc(100vh - 70px) !important;
    max-height: none !important;
    border-radius: 0 !important;
    animation: slideInFromRight 0.3s ease-out !important;
  }
  
  .wallet-menu,
  .settings-menu {
    position: fixed !important;
    top: 70px !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: auto !important;
    max-height: calc(100vh - 70px) !important;
    border-radius: 0 !important;
    animation: slideInFromRight 0.3s ease-out !important;
    overflow-y: auto !important;
  }
  
  @keyframes slideInFromRight {
    from {
      transform: translateX(100%);
      opacity: 0;
    }
    to {
      transform: translateX(0);
      opacity: 1;
    }
  }
}

/* Close buttons for mobile dropdowns */
.dropdown-close {
  display: none;
}

@media (max-width: 1024px) {
  .dropdown-close {
    display: block;
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text);
    cursor: pointer;
    z-index: 1;
  }
  
  .notification-dropdown,
  .wallet-menu,
  .settings-menu {
    padding-top: 3rem !important;
  }
}

/* Prevent body scroll when dropdowns are open */
body.dropdown-open {
  overflow: hidden;
}

/* ===== MOBILE SEARCH FIX ===== */
@media (max-width: 768px) {
  .search-container {
    margin: 0 0.5rem;
    justify-content: flex-end;
    position: static;
  }
  
  .search-icon-mobile {
    display: flex;
    z-index: 1003;
    position: relative;
  }
  
  .search-bar {
    position: fixed;
    left: 0;
    top: 56px;
    width: 100%;
    padding: 1rem;
    background: var(--header-bg);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
    z-index: 1002;
    display: none;
    border-bottom: 1px solid var(--border);
  }
  
  .search-bar.active {
    display: block;
    animation: slideDown 0.2s ease-out;
  }
}

/* Prevent body scroll when search is open */
body.search-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* ===== NOTIFICATION DROPDOWN FIX ===== */
.notification-list::-webkit-scrollbar {
  width: 8px;
}

.notification-list::-webkit-scrollbar-track {
  background: #1a1a1a;
  border-radius: 4px;
  margin: 4px;
}

.notification-list::-webkit-scrollbar-thumb {
  background: #000000;
  border-radius: 4px;
  border: 1px solid #333333;
}

.notification-list::-webkit-scrollbar-thumb:hover {
  background: #111111;
  border: 1px solid #444444;
}

.notification-list::-webkit-scrollbar-thumb:active {
  background: #222222;
}

/* Firefox support for black scrollbar */
.notification-list {
  scrollbar-width: thin;
  scrollbar-color: #000000 #1a1a1a;
}

/* Dark theme support */
.dark-mode .notification-list::-webkit-scrollbar-track {
  background: #2d2d2d;
}

.dark-mode .notification-list::-webkit-scrollbar-thumb {
  background: #000000;
  border: 1px solid #555555;
}

.dark-mode .notification-list::-webkit-scrollbar-thumb:hover {
  background: #111111;
  border: 1px solid #666666;
}

.dark-mode .notification-list {
  scrollbar-color: #000000 #2d2d2d;
}

/* Tag styles */
.item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0;
}

.tag {
  padding: 0.3rem 0.6rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid;
  transition: all 0.2s ease;
  position: relative;
  z-index: 3;
  cursor: pointer;
}

.tag:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Tag Color Variants */
.tag-weapon {
  background: rgba(0, 150, 255, 0.15);
  color: #4db8ff;
  border-color: #4db8ff;
}

.tag-weapon:hover {
  box-shadow: 0 0 8px rgba(77, 184, 255, 0.4);
}

.tag-fetish {
  background: rgba(255, 51, 153, 0.15);
  color: #ff3399;
  border-color: #ff3399;
}

.tag-fetish:hover {
  box-shadow: 0 0 8px rgba(255, 51, 153, 0.4);
}

.tag-bundle {
  background: rgba(153, 102, 255, 0.15);
  color: #9966ff;
  border-color: #9966ff;
}

.tag-bundle:hover {
  box-shadow: 0 0 8px rgba(153, 102, 255, 0.4);
}

.tag-feet {
  background: rgba(255, 80, 80, 0.15);
  color: #ff5050;
  border-color: #ff5050;
}

.tag-feet:hover {
  box-shadow: 0 0 8px rgba(255, 80, 80, 0.4);
}

.tag-video {
  background: rgba(255, 178, 102, 0.15);
  color: #ffb266;
  border-color: #ffb266;
}

.tag-video:hover {
  box-shadow: 0 0 8px rgba(255, 178, 102, 0.4);
}

.tag-custom {
  background: rgba(156, 39, 176, 0.15);
  color: #9c27b0;
  border-color: #9c27b0;
}

.tag-custom:hover {
  box-shadow: 0 0 8px rgba(156, 39, 176, 0.4);
}

.tag-gaming {
  background: rgba(76, 175, 80, 0.15);
  color: #4caf50;
  border-color: #4caf50;
}

.tag-gaming:hover {
  box-shadow: 0 0 8px rgba(76, 175, 80, 0.4);
}

.tag-skin {
  background: rgba(255, 193, 7, 0.15);
  color: #ffc107;
  border-color: #ffc107;
}

.tag-skin:hover {
  box-shadow: 0 0 8px rgba(255, 193, 7, 0.4);
}

.tag-cosplay {
  background: rgba(255, 87, 34, 0.15);
  color: #ff5722;
  border-color: #ff5722;
}

.tag-cosplay:hover {
  box-shadow: 0 0 8px rgba(255, 87, 34, 0.4);
}

.tag-nsfw {
  background: rgba(156, 39, 176, 0.15);
  color: #9c27b0;
  border-color: #9c27b0;
}

.tag-nsfw:hover {
  box-shadow: 0 0 8px rgba(156, 39, 176, 0.4);
}

.tag-adult {
  background: rgba(156, 39, 176, 0.15);
  color: #9c27b0;
  border-color: #9c27b0;
}

.tag-adult:hover {
  box-shadow: 0 0 8px rgba(156, 39, 176, 0.4);
}


