/* Header layout for VerdantaMarket */
.vm-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background-color: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.vm-header__topbar {
  background: var(--color-primary-soft);
  border-bottom: 1px solid var(--color-border-subtle);
}

.vm-header__topbar-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: var(--space-1);
  padding-bottom: var(--space-1);
}

.vm-header__topbar-text {
  font-size: var(--font-size-xs);
  color: var(--gray-700);
}

.vm-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
}

/* Brand */
.vm-header__brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.vm-header__logo-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.vm-header__logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 20%, #4caf50 0%, var(--color-primary) 40%, var(--color-primary-strong) 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: var(--shadow-md);
}

.vm-header__logo-mark i {
  font-size: 1rem;
}

.vm-header__logo-text {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--font-size-xl);
  letter-spacing: 0.03em;
  text-transform: none;
}

/* Nav */
.vm-header__nav {
  margin-left: auto;
}

.vm-header__nav-list {
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.vm-header__nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--gray-800);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.vm-header__nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.15rem;
  width: 100%;
  height: 2px;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--color-primary), var(--color-earth));
  transform: scaleX(0);
  transform-origin: center;
  transition: transform var(--transition-normal);
}

.vm-header__nav-link:hover::after,
.vm-header__nav-link:focus-visible::after {
  transform: scaleX(1);
}

.vm-header__nav-item--highlight .vm-header__nav-link--highlight {
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-primary);
  background-color: var(--color-primary-soft);
}

.vm-header__nav-item--highlight .vm-header__nav-link--highlight::after {
  display: none;
}

.vm-header__nav-item--highlight .vm-header__nav-link--highlight:hover {
  background-color: #ffffff;
}

/* Actions */
.vm-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-left: var(--space-4);
}

.vm-header__search {
  position: relative;
  min-width: 180px;
}

.vm-header__search input[type="search"] {
  padding-right: 2.4rem;
  font-size: var(--font-size-sm);
}

.vm-header__search-btn {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  transform: translateY(-50%);
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--gray-600);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.vm-header__search-btn:hover {
  color: var(--color-primary-strong);
  box-shadow: none;
}

.vm-header__icon-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  border: 1px solid var(--color-border-subtle);
  background-color: var(--color-surface);
  color: var(--gray-800);
}

.vm-header__icon-link:hover {
  border-color: var(--color-primary);
  color: var(--color-primary-strong);
}

/* Mobile nav toggle */
.vm-header__nav-toggle {
  display: none;
  align-items: center;
  gap: 0.5rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border-subtle);
  padding: 0.45rem 0.8rem;
  background: #ffffff;
  color: var(--gray-800);
}

.vm-header__nav-toggle-box {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.vm-header__nav-toggle-line {
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background-color: var(--gray-800);
  transition: transform var(--transition-normal), opacity var(--transition-normal);
}

.vm-header__nav-toggle-text {
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Mobile state for toggle icon */
.vm-header__nav-toggle.is-open .vm-header__nav-toggle-line:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.vm-header__nav-toggle.is-open .vm-header__nav-toggle-line:nth-child(2) {
  opacity: 0;
}

.vm-header__nav-toggle.is-open .vm-header__nav-toggle-line:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* Responsive */
@media (max-width: 960px) {
  .vm-header__inner {
    gap: var(--space-3);
  }

  .vm-header__nav {
    position: fixed;
    inset: 0 0 auto 0;
    top: 120px; /* approximate header height on mobile */
    background-color: rgba(30, 37, 32, 0.4);
    backdrop-filter: blur(4px);
    display: none;
  }

  .vm-header__nav-list {
    flex-direction: column;
    align-items: stretch;
    background-color: var(--color-surface);
    margin: 0 auto;
    margin-top: 0.25rem;
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    max-width: 100%;
    box-shadow: var(--shadow-lg);
  }

  .vm-header__nav-item {
    text-align: left;
  }

  .vm-header__nav-link {
    padding: 0.6rem 0.25rem;
    font-size: var(--font-size-md);
  }

  .vm-header__nav-link::after {
    display: none;
  }

  .vm-header__nav-item--highlight .vm-header__nav-link--highlight {
    width: 100%;
    justify-content: center;
  }

  .vm-header__nav-toggle {
    display: inline-flex;
  }

  .vm-header__nav.is-open {
    display: block;
  }

  .vm-header__actions {
    margin-left: 0;
  }

  .vm-header__search {
    display: none;
  }
}

@media (max-width: 640px) {
  .vm-header__inner {
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);
  }

  .vm-header__logo-text {
    font-size: var(--font-size-lg);
  }

  .vm-header__topbar-inner {
    padding-top: var(--space-1);
    padding-bottom: var(--space-1);
  }

  .vm-header__topbar-text {
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .vm-header__nav-toggle-line {
    transition: none;
  }
}
