/*
 * AMUI Header v1.6.0
 * Stabilny pasek marketplace bez niebieskich akcentów i bez zależności od układu Astry.
 */

:root {
  --amui-header-orange: var(--amui-accent, #ff5a00);
  --amui-header-orange-dark: #e04d00;
  --amui-header-text: #1f2937;
  --amui-header-muted: #64748b;
  --amui-header-line: rgba(226, 232, 240, .94);
}

body.amui-has-market-header .site-header,
body.amui-has-market-header #masthead,
body.amui-has-market-header .main-header-bar,
body.amui-has-market-header .ast-primary-header-bar {
  display: none !important;
}

body.amui-has-market-header {
  --amui-header-height: 82px;
}

.amui-market-header {
  position: sticky;
  top: 0;
  z-index: 999;
  width: 100%;
  background: rgba(255, 255, 255, .97);
  border-bottom: 1px solid var(--amui-header-line);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .05);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.admin-bar .amui-market-header {
  top: 32px;
}

.amui-market-header__inner {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: auto minmax(360px, 1fr) auto;
  align-items: center;
  gap: 22px;
  width: min(100% - 40px, 1320px);
  min-height: var(--amui-header-height);
  margin: 0 auto;
}

.amui-market-header__left {
  display: flex;
  align-items: center;
  gap: 22px;
  min-width: 0;
}

.amui-market-header__brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--amui-header-text) !important;
  font-size: 18px;
  font-weight: 950;
  letter-spacing: -.035em;
  text-decoration: none !important;
  white-space: nowrap;
}

.amui-market-header__logo {
  display: block;
  max-width: 150px;
  max-height: 44px;
  width: auto;
  height: auto;
}

.amui-market-header__brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--amui-header-orange);
  color: #fff;
  box-shadow: 0 10px 20px rgba(255, 90, 0, .22);
}

.amui-market-header__nav {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border: 1px solid rgba(226, 232, 240, .88);
  border-radius: 999px;
  background: #f8fafc;
}

.amui-market-header__nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 15px;
  border-radius: 999px;
  color: #334155 !important;
  font-size: 14px;
  line-height: 1;
  font-weight: 850;
  text-decoration: none !important;
  transition: background-color .16s ease, color .16s ease, box-shadow .16s ease;
}

.amui-market-header__nav a:hover,
.amui-market-header__nav a.is-active {
  background: #fff;
  color: var(--amui-header-orange) !important;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .06);
}

.amui-market-header__search {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  height: 52px;
  border: 2px solid #ffb78d;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .055);
  overflow: hidden;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.amui-market-header__search:focus-within {
  border-color: var(--amui-header-orange);
  box-shadow: 0 0 0 4px rgba(255, 90, 0, .12), 0 12px 26px rgba(15, 23, 42, .08);
}

.amui-market-header__search-icon {
  flex: 0 0 auto;
  padding-left: 18px;
  color: var(--amui-header-orange);
  font-size: 20px;
  font-weight: 900;
  transform: translateY(-1px);
}

.amui-market-header__search input[type="search"] {
  flex: 1 1 auto;
  min-width: 0;
  height: 48px !important;
  min-height: 48px !important;
  margin: 0 !important;
  padding: 0 14px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--amui-header-text) !important;
  box-shadow: none !important;
  font-size: 15px;
  font-weight: 750;
  outline: none !important;
}

.amui-market-header__search input::placeholder {
  color: #94a3b8;
  opacity: 1;
}

.amui-market-header__search button {
  flex: 0 0 auto;
  align-self: stretch;
  min-width: 112px;
  margin: 0 !important;
  padding: 0 24px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: var(--amui-header-orange) !important;
  color: #fff !important;
  box-shadow: none !important;
  font-size: 14px !important;
  font-weight: 950 !important;
  line-height: 1 !important;
  letter-spacing: .02em;
  cursor: pointer;
}

.amui-market-header__search button:hover {
  background: var(--amui-header-orange-dark) !important;
}

.amui-market-header__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.amui-market-header__action {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--amui-header-line);
  border-radius: 14px;
  background: #fff;
  color: #1e293b !important;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .045);
  text-decoration: none !important;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.amui-market-header__action:hover {
  border-color: rgba(255, 90, 0, .38);
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, .08);
}

.amui-market-header__action > span[aria-hidden="true"] {
  font-size: 19px;
  line-height: 1;
}

.amui-market-header__cart-count {
  position: absolute;
  top: -7px;
  right: -7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 21px;
  height: 21px;
  padding: 0 5px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--amui-header-orange);
  color: #fff;
  font-size: 11px;
  font-weight: 950;
  line-height: 1;
}

/* Wyłącza stary JS-owy pasek wyszukiwania z v1.5, gdy custom header jest aktywny. */
body.amui-has-market-header .amui-header-search-wrap {
  display: none !important;
}

@media (max-width: 1040px) {
  .amui-market-header__inner {
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 12px 0;
  }

  .amui-market-header__left {
    grid-column: 1 / 2;
  }

  .amui-market-header__actions {
    grid-column: 2 / 3;
    grid-row: 1;
  }

  .amui-market-header__search {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  body.amui-has-market-header {
    --amui-header-height: auto;
  }
}

@media (max-width: 720px) {
  .admin-bar .amui-market-header {
    top: 46px;
  }

  .amui-market-header__inner {
    width: min(100% - 24px, 1320px);
  }

  .amui-market-header__brand-text {
    display: none;
  }

  .amui-market-header__left {
    gap: 10px;
  }

  .amui-market-header__nav {
    gap: 3px;
    padding: 4px;
  }

  .amui-market-header__nav a {
    min-height: 36px;
    padding: 0 11px;
    font-size: 13px;
  }

  .amui-market-header__search {
    height: 48px;
  }

  .amui-market-header__search input[type="search"] {
    height: 44px !important;
    min-height: 44px !important;
    font-size: 14px;
  }

  .amui-market-header__search button {
    min-width: 86px;
    padding: 0 16px !important;
  }

  .amui-market-header__action {
    width: 42px;
    height: 42px;
  }
}
