/**
 * Header marketplace — UX 3.1
 * 72px · max 1400px · búsqueda compacta · CTAs sin desborde
 */

:root {
  --mp-header-cta: var(--mp-color-primary, #1658F2);
  --mp-header-cta-hover: var(--mp-color-primary-hover, #0F46D9);
  --mp-header-cta-light: #EFF6FF;
  --mp-header-height: 72px;
  --mp-header-focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.22);
}

.mp-site-header,
.mp-marketplace-header {
  background: var(--mp-white);
  border-bottom: 1px solid var(--mp-border);
  position: sticky;
  top: 0;
  z-index: 220;
  min-height: var(--mp-header-height);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.mp-site-header.is-scrolled {
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
  border-bottom-color: transparent;
}

.mp-site-header .mp-container {
  max-width: 1400px;
  padding-left: 24px;
  padding-right: 24px;
}

.mp-site-header__inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px 24px;
  min-height: var(--mp-header-height);
  width: 100%;
}

.mp-site-header__brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
  line-height: 0;
  border-radius: 8px;
  transition: opacity 0.15s ease;
}

.mp-site-header__brand:hover {
  opacity: 0.88;
}

.mp-site-header__brand:focus-visible {
  outline: 2px solid var(--mp-header-cta);
  outline-offset: 3px;
}

.mp-site-header__nav--main {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 24px;
  flex-wrap: nowrap;
  list-style: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.mp-site-header__nav--main > li,
.mp-site-header__nav--main > a {
  margin: 0;
}

.mp-site-header__nav-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 0;
  font-family: var(--mp-font-body, 'Inter', system-ui, sans-serif);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--mp-muted);
  text-decoration: none;
  border-radius: 8px;
  white-space: nowrap;
  transition: color 0.18s ease, background 0.18s ease;
}

.mp-site-header__nav-link:hover {
  color: var(--mp-header-cta);
}

.mp-site-header__nav-link.is-active,
.mp-site-header__nav--main .current-menu-item > a {
  color: var(--mp-header-cta);
  font-weight: 600;
}

.mp-site-header__nav-link:focus-visible {
  outline: 2px solid var(--mp-header-cta);
  outline-offset: 2px;
}

.mp-site-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  flex-shrink: 0;
  min-width: 0;
}

.mp-site-header__search {
  display: none;
  align-items: center;
  gap: 8px;
  flex: 0 0 240px;
  width: 240px;
  min-width: 0;
  max-width: 260px;
  height: 40px;
  padding: 0 12px 0 10px;
  border: 1px solid var(--mp-border);
  border-radius: 10px;
  background: #F8FAFC;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.mp-site-header__search:hover {
  border-color: #CBD5E1;
  background: var(--mp-white);
}

.mp-site-header__search:focus-within {
  border-color: var(--mp-header-cta);
  background: var(--mp-white);
  box-shadow: var(--mp-header-focus-ring);
}

.mp-site-header__search-icon {
  display: inline-flex;
  flex-shrink: 0;
  color: #94A3B8;
  pointer-events: none;
}

.mp-site-header__search:focus-within .mp-site-header__search-icon {
  color: var(--mp-header-cta);
}

.mp-site-header__search-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: none;
  background: transparent;
  font-family: var(--mp-font-body, 'Inter', system-ui, sans-serif);
  font-size: 14px;
  font-weight: 500;
  color: var(--mp-text);
  outline: none;
}

.mp-site-header__search-input::placeholder {
  color: #94A3B8;
  font-weight: 400;
}

.mp-site-header__search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.mp-site-header__btn-login {
  padding: 11px 12px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  font-family: var(--mp-font-body, 'Inter', system-ui, sans-serif);
  font-size: 14px;
  font-weight: 500;
  color: var(--mp-text);
  text-decoration: none;
  border-radius: 8px;
  white-space: nowrap;
  transition: color 0.18s ease, background 0.18s ease;
}

.mp-site-header__btn-login:hover {
  color: var(--mp-header-cta);
  background: var(--mp-header-cta-light);
}

.mp-site-header__btn-login:focus-visible {
  outline: 2px solid var(--mp-header-cta);
  outline-offset: 2px;
}

.mp-site-header__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 20px;
  min-height: 44px;
  font-family: var(--mp-font-body, 'Inter', system-ui, sans-serif);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: none;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.15s ease, box-shadow 0.18s ease;
}

.mp-site-header__cta:hover {
  transform: translateY(-1px);
}

.mp-site-header__cta:focus-visible {
  outline: 2px solid var(--mp-header-cta);
  outline-offset: 2px;
}

.mp-site-header__cta-label--short {
  display: none;
}

.mp-site-header__cta--primary {
  color: var(--mp-white);
  background: var(--mp-header-cta);
  border: 1px solid var(--mp-header-cta);
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.28);
}

.mp-site-header__cta--primary:hover {
  background: var(--mp-header-cta-hover);
  border-color: var(--mp-header-cta-hover);
  color: var(--mp-white);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.32);
}

.mp-site-header__cta--secondary {
  color: var(--mp-header-cta);
  background: transparent;
  border: 1px solid var(--mp-header-cta);
}

.mp-site-header__cta--secondary:hover {
  background: var(--mp-header-cta-light);
  color: var(--mp-header-cta-hover);
}

.mp-site-header__menu-toggle {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--mp-border);
  border-radius: 10px;
  background: var(--mp-white);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.mp-site-header__menu-toggle:hover {
  border-color: var(--mp-header-cta);
  background: var(--mp-header-cta-light);
}

.mp-site-header__menu-toggle:focus-visible {
  outline: 2px solid var(--mp-header-cta);
  outline-offset: 2px;
}

.mp-site-header__menu-toggle-bar {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--mp-text);
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.mp-site-header__menu-toggle[aria-expanded="true"] .mp-site-header__menu-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.mp-site-header__menu-toggle[aria-expanded="true"] .mp-site-header__menu-toggle-bar:nth-child(2) {
  opacity: 0;
}

.mp-site-header__menu-toggle[aria-expanded="true"] .mp-site-header__menu-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (min-width: 1200px) {
  .mp-site-header__nav--main {
    display: flex;
  }

  .mp-site-header__search {
    display: flex;
  }
}

@media (min-width: 1024px) and (max-width: 1199px) {
  .mp-site-header__nav--main {
    display: flex;
    gap: 16px;
  }

  .mp-site-header__nav-link {
    font-size: 13px;
  }

  .mp-site-header__search {
    display: flex;
    flex: 0 0 200px;
    width: 200px;
    max-width: 220px;
  }

  .mp-site-header__cta-label--full {
    display: none;
  }

  .mp-site-header__cta-label--short {
    display: inline;
  }

  .mp-site-header__cta--secondary {
    display: none;
  }
}

@media (min-width: 900px) and (max-width: 1023px) {
  .mp-site-header__nav--main {
    display: flex;
    gap: 12px;
  }

  .mp-site-header__nav-link {
    font-size: 13px;
    padding: 8px 0;
  }

  .mp-site-header__search {
    display: none;
  }

  .mp-site-header__btn-login {
    display: none;
  }

  .mp-site-header__cta-label--full {
    display: none;
  }

  .mp-site-header__cta-label--short {
    display: inline;
  }

  .mp-site-header__cta--secondary {
    display: none;
  }
}

@media (min-width: 769px) {
  .mp-site-header__menu-toggle {
    display: none;
  }
}

/* Cuenta — dropdown */
.mp-site-header__account {
  position: relative;
}

.mp-site-header__account-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 12px;
  min-height: 44px;
  font-family: var(--mp-font-body, 'Inter', system-ui, sans-serif);
  font-size: 14px;
  font-weight: 500;
  color: var(--mp-text);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .18s ease, background .18s ease;
}

.mp-site-header__account-toggle:hover,
.mp-site-header__account-toggle[aria-expanded="true"] {
  color: var(--mp-header-cta);
  background: var(--mp-header-cta-light);
}

.mp-site-header__account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  padding: 6px;
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .12);
  z-index: 240;
}

.mp-site-header__account-menu[hidden] {
  display: none !important;
}

.mp-site-header__account-item {
  display: block;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--mp-text);
  text-decoration: none;
  border-radius: 8px;
  white-space: nowrap;
}

.mp-site-header__account-item:hover {
  background: #F8FAFC;
  color: var(--mp-header-cta);
}

.mp-site-header__account-item--logout {
  color: #64748B;
  border-top: 1px solid #F1F5F9;
  margin-top: 4px;
  padding-top: 12px;
}

@media (max-width: 768px) {
  .mp-site-header__inner {
    grid-template-columns: auto 1fr auto;
    gap: 12px 16px;
  }

  .mp-site-header__search,
  .mp-site-header__cta,
  .mp-site-header__btn-login,
  .mp-site-header__account {
    display: none;
  }
}
