/* src/styles/header.css */

/* SiteHeader Styles */
.site-header {
  background: linear-gradient(180deg,
    rgba(37, 37, 37, 0.75) 0%,
    rgba(21, 21, 21, 0.6) 45%,
    rgba(10, 10, 10, 0.4) 100%);
  padding: 15px;
  border-radius: 15px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  min-width: 0;
  flex-wrap: nowrap;
  gap: 10px;
  overflow: visible; /* Allow dropdown to overflow in all directions */
  backdrop-filter: blur(0.8px);
  -webkit-backdrop-filter: blur(0.8px);
  position: relative;
  z-index: 1000; /* Ensure header is above main content */
}

/* Glossy shine effect on top */
.site-header::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 6px;
  right: 6px;
  height: 35%;
  background: linear-gradient(180deg,
    rgba(255,255,255,0.45) 0%,
    rgba(255,255,255,0.25) 40%,
    rgba(255,255,255,0.08) 70%,
    transparent 100%);
  border-radius: 12px 12px 50% 50%;
  pointer-events: none;
  z-index: 1;
}

/* Subtle bottom reflection */
.site-header::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255,255,255,0.15) 50%,
    transparent 100%);
  pointer-events: none;
  z-index: 1;
}

.left-section {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.home-icon {
  display: flex;
  align-items: center;
}

.home-icon-container {
  border: none;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.home-icon-container svg {
  width: 24px;
  height: 24px;
}

.home-icon:hover .home-icon-container {
  transform: scale(1.1);
}

.search-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-grow: 1;
  flex-shrink: 1;
  min-width: 0;
}

.search-input {
  width: 100%;
  max-width: 360px;
  min-width: 50px;
  padding: 10px;
  border: 1px solid #333;
  border-radius: 5px;
  background: rgba(30, 30, 30, 0.67); /* 33% translucent */
  color: #e0e0e0;
  font-size: 1em;
  outline: none;
  box-sizing: border-box;
  flex-shrink: 1;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  height: 40px; /* Fixed height to match search button */
}

.search-input::placeholder {
  color: #888;
}

.search-input:focus::placeholder {
  opacity: 0; /* Make placeholder disappear on focus */
}

.spacer {
  flex-grow: 1;
  flex-shrink: 1;
  position: relative;
  z-index: 2;
}

.nav-links {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  margin-right: 15px;
}

.nav-link {
  padding: 8px 12px;
  background: transparent;
  color: #e0e0e0;
  text-decoration: none;
  border-radius: 5px;
  font-size: 1em;
  transition: all 0.3s ease;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
}

.auth-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
  position: relative; /* Ensure dropdown can position relative to this */
  z-index: 2;
}

.welcome-text {
  color: #00ff00;
  font-size: 0.95em;
  white-space: nowrap;
  font-weight: 500;
  text-shadow: 0 0 6px rgba(0, 255, 0, 0.6);
}

.username-link {
  color: #FFFFFF;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.username-link:hover {
  color: #D3D3D3;
}

.micro-avatar-link {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  height: 40px;
  width: 40px;
  box-sizing: border-box;
  overflow: visible; /* Allow status dot to extend outside */
  flex-shrink: 0;
}

.micro-avatar {
  width: 32px;
  height: 32px;
  border-radius: 5px;
  object-fit: cover;
  border: 1px solid #666666;
  transition: border-color 0.3s ease;
  will-change: border-color;
}

.micro-avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 5px;
  background: #4a90e2;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid #666666;
  transition: border-color 0.3s ease;
  will-change: border-color;
}

.micro-avatar-link:hover .micro-avatar,
.micro-avatar-link:hover .micro-avatar-placeholder {
  border-color: #888888;
}

.settings-dropdown-container {
  position: relative;
}

.settings-button {
  position: relative;
  padding: 8px;
  background: linear-gradient(180deg, #252525 0%, #151515 45%, #0a0a0a 100%);
  color: white;
  border: none;
  border-radius: 5px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  contain: layout style;
}

.settings-button svg {
  width: 18px;
  height: 18px;
}

.settings-button::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 3px;
  right: 3px;
  height: 40%;
  background: linear-gradient(180deg,
    rgba(255,255,255,0.45) 0%,
    rgba(255,255,255,0.25) 40%,
    rgba(255,255,255,0.08) 70%,
    transparent 100%);
  border-radius: 3px 3px 50% 50%;
  pointer-events: none;
}

.settings-button:hover {
  background: linear-gradient(180deg, #252525 0%, #151515 45%, #0a0a0a 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.7);
  transform: none;
}

.settings-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: #000000;
  border: 1px solid #444444;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  min-width: 200px;
  max-width: 280px;
  z-index: 9999; /* Very high z-index to overlay everything */
  animation: slideDown 0.2s ease-out;
}

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

.settings-menu-content {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-menu-item {
  padding: 10px 14px;
  background: transparent;
  color: #e0e0e0;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 0.9em;
  font-family: inherit; /* Ensure buttons use same font as parent */
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-align: left;
  text-decoration: none;
  display: block;
  box-sizing: border-box; /* Ensure padding is included in width calculation */
  width: 100%; /* Ensure buttons fill width like links did */
}

.settings-menu-item:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.settings-menu-divider {
  height: 1px;
  background: #333333;
  margin: 6px 0;
}

.admin-section-label {
  padding: 6px 14px;
  color: #66b3ff;
  font-size: 0.75em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.settings-menu-logout {
  padding: 10px 14px;
  background: #000000;
  color: white;
  border: 1px solid #ff4444;
  border-radius: 6px;
  font-size: 0.9em;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-align: center;
  box-sizing: border-box; /* Ensure padding is included in width calculation */
}

.settings-menu-logout:hover:not(:disabled) {
  background: #1a1a1a;
  border-color: #ff6666;
  transform: translateY(-1px);
}

.settings-menu-logout:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.logout-button {
  padding: 6px 13px; /* 20% smaller than 8px 16px */
  background: #000000;
  color: white;
  border: 1px solid #ff4444;
  border-radius: 5px;
  font-size: 0.8em; /* 20% smaller than 1em */
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.logout-button:hover:not(:disabled) {
  background: #1a1a1a;
  border-color: #ff6666;
  transform: translateY(-1px);
}

.logout-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-button {
  padding: 8px 10px;
  background: transparent;
  border: 1px solid #81C784;
  color: #FFFFFF;
  text-decoration: none;
  border-radius: 5px;
  font-size: 1em;
  transition: background 0.3s ease;
  white-space: nowrap;
}

.login-button:hover {
  background: rgba(129, 199, 132, 0.2);
  color: #FFFFFF;
}

.signup-button {
  position: relative;
  padding: 8px 10px;
  background: linear-gradient(180deg, #252525 0%, #151515 45%, #0a0a0a 100%);
  color: #FFFFFF;
  text-decoration: none;
  border-radius: 5px;
  border: none;
  overflow: hidden;
  font-size: 1em;
  transition: background 0.3s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  flex-shrink: 0;
}

/* Icon-only search button in header */
.signup-button svg {
  width: 18px;
  height: 18px;
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.7))
          drop-shadow(0 0 2px rgba(255, 200, 50, 0.5))
          drop-shadow(0 0 3px rgba(255, 150, 0, 0.3));
}

.signup-button:hover svg {
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.9))
          drop-shadow(0 0 2px rgba(255, 200, 50, 0.7))
          drop-shadow(0 0 3px rgba(255, 150, 0, 0.5))
          drop-shadow(0 0 4px rgba(255, 100, 0, 0.4));
}

/* When signup-button is used as icon-only button */
button.signup-button {
  padding: 8px;
  min-width: 40px;
  width: 40px;
  height: 40px;
}

.signup-button::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 3px;
  right: 3px;
  height: 40%;
  background: linear-gradient(180deg,
    rgba(255,255,255,0.45) 0%,
    rgba(255,255,255,0.25) 40%,
    rgba(255,255,255,0.08) 70%,
    transparent 100%);
  border-radius: 3px 3px 50% 50%;
  pointer-events: none;
}

.signup-button:hover {
  background: linear-gradient(180deg, #252525 0%, #151515 45%, #0a0a0a 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.7);
  color: #FFFFFF;
}

/* Media Queries for SiteHeader */
@media (max-width: 768px) {
  .site-header {
    padding: 10px 15px;
    border-radius: 12px;
    gap: 6px;
  }

  .left-section {
    gap: 6px;
    flex-shrink: 1;
  }

  .search-input {
    max-width: 240px;
    font-size: 0.85em;
    padding: 6px;
    min-width: 160px;
    height: 40px;
  }

  .nav-links {
    gap: 4px;
    margin-right: 0;
    flex-shrink: 0;
  }

  .nav-link {
    padding: 6px 8px;
    font-size: 0.85em;
  }

  .auth-buttons {
    gap: 6px;
  }

  .welcome-text {
    font-size: 0.85em;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .login-button,
  .signup-button {
    padding: 6px 8px;
    font-size: 0.85em;
  }

  .settings-dropdown {
    min-width: 160px;
    font-size: 0.9em;
  }

  .settings-menu-logout {
    padding: 7px 12px;
    font-size: 0.85em;
  }
}

@media (max-width: 600px) {
  .site-header {
    gap: 4px;
    padding: 8px 12px;
  }

  .search-input {
    max-width: 160px;
    min-width: 120px;
    font-size: 0.8em;
    padding: 5px;
    height: 40px;
  }

  .nav-links {
    gap: 3px;
    margin-right: 0;
  }

  .nav-link {
    padding: 5px 6px;
    font-size: 0.8em;
  }

  .auth-buttons {
    gap: 4px;
  }

  .welcome-text {
    font-size: 0.75em;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .login-button,
  .signup-button {
    padding: 5px 6px;
    font-size: 0.8em;
  }

  button.signup-button {
    padding: 8px;
    width: 40px;
    height: 40px;
  }

  .settings-dropdown {
    min-width: 140px;
  }

  .settings-menu-logout {
    padding: 6px 10px;
    font-size: 0.8em;
  }
}

@media (max-width: 480px) {
  .site-header {
    padding: 6px 10px;
    gap: 3px;
  }

  .left-section {
    gap: 3px;
  }

  .search-input {
    max-width: 120px;
    min-width: 100px;
    font-size: 0.75em;
    padding: 4px;
    height: 40px;
  }

  .nav-link {
    padding: 4px 5px;
    font-size: 0.75em;
  }

  .auth-buttons {
    gap: 3px;
  }

  .welcome-text {
    font-size: 0.7em;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .login-button,
  .signup-button {
    padding: 4px 5px;
    font-size: 0.75em;
  }

  button.signup-button {
    padding: 8px;
    width: 40px;
    height: 40px;
  }

  .settings-dropdown {
    min-width: 120px;
  }

  .settings-menu-logout {
    padding: 5px 8px;
    font-size: 0.75em;
  }
}
