/* Shared main header component.
 * Keep every visual rule for templates/store/partials/main_header.html here.
 */

.main-header {
  margin-top: 12px;
  background: #fff;
  padding: 18px;
  border-radius: 30px;
  box-shadow: 0 22px 44px rgba(24, 80, 101, 0.14);
  margin-bottom: 32px;
  border: 1px solid #eef4f4;
  backdrop-filter: blur(6px);
  position: relative;
  z-index: 30;
}

.header__grid {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "brand actions"
    "search search";
  align-items: center;
  gap: 12px;
}

.main-nav {
  display: none;
  grid-area: nav;
  align-items: center;
  gap: 18px;
  font-size: 14px;
  font-weight: 600;
}

.nav-link {
  color: var(--text);
  text-decoration: none;
  padding: 10px 2px;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  outline: none;
  color: var(--teal);
  border-color: var(--teal);
}

.header-utilities {
  grid-area: actions;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
}

.help-link {
  grid-area: help;
  justify-self: end;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--muted);
  text-decoration: none;
}



.help-link.is-active {
  color: var(--teal);
}

.help-link:hover,
.help-link:focus-visible {
  outline: none;
  color: var(--teal);
}

.header__search {
  grid-area: search;
  width: 100%;
}

.header-mobile-actions {
  display: contents;
}

@media (min-width: 1024px) {
.main-header {
    padding: 18px 24px;
  }
}

@media (min-width: 1024px) {
.header__grid {
    grid-template-columns: auto auto 1fr auto auto;
    grid-template-areas: "brand nav search help actions";
    gap: 20px;
    align-items: center;
  }
}

@media (min-width: 1024px) {
.main-nav {
    display: flex;
  }
}

@media (min-width: 1024px) {
.help-link {
    justify-self: start;
    font-size: 14px;
    color: var(--text);
  }
}

@media (min-width: 1024px) {
.header__search {
    width: min(100%, 420px);
    justify-self: center;
  }
}

@media (min-width: 1024px) {
.header-utilities {
    gap: 14px;
  }
}


.logo {
  grid-area: brand;
  display: flex;
  flex-direction: column;
  line-height: 1;
  text-decoration: none;
}

.logo-image {
  width: clamp(90px, 8vw, 120px);
  max-height: 86px;
  height: auto;
  object-fit: contain;
  display: block;
}

.logo-tag {
  font-size: 12px;
  letter-spacing: 0.35em;
  color: var(--muted);
}

.search {
  flex: 1;
  display: flex;
  align-items: center;
  background: #f8fbfb;
  border-radius: 999px;
  padding: 0 18px;
  border: 1px solid transparent;
  transition: border 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: 0 12px 30px rgba(31, 107, 107, 0.08);
}

.search:focus-within {
  border-color: var(--teal);
  background: #fff;
  box-shadow: 0 16px 36px rgba(31, 107, 107, 0.12);
}

.search input {
  border: none;
  background: transparent;
  flex: 1;
  padding: 16px 8px;
  font-size: 15px;
  color: #4b5757;
}

.search input:focus {
  outline: none;
}

.header__search { margin: 0; }
.header__search input { min-width: 0; }
.header__search-submit, .header__search-clear { border: 0; cursor: pointer; flex-shrink: 0; min-height: 44px; }
.header__search-submit { background: #591c31; color: #fff; border-radius: 999px; padding: 0 14px; font-weight: 600; }
.header__search .header__search-submit:not(:disabled) { transform: none; box-shadow: none; transition: none; }
.header__search-clear { background: transparent; color: #591c31; min-width: 36px; }
.header__search-clear[hidden] { display: none; }
.header__search button:focus-visible { outline: 2px solid #591c31; outline-offset: 3px; }
.header__search input:focus-visible { outline: none; }
.header__search input::-webkit-search-cancel-button { display: none; }
.catalog-search-feedback { display: flex; gap: 12px; align-items: center; }
.catalog-search-feedback p:empty { margin: 0; }
#catalog-results[aria-busy="true"] { opacity: .6; }
.mobile-results { overflow-wrap: anywhere; }
.catalog-empty button, [data-search-retry] { min-height: 44px; border: 1px solid #591c31; border-radius: 999px; padding: 8px 16px; background: #fff; color: #591c31; cursor: pointer; }
.catalog-empty__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 20px; }
.catalog-empty__actions button { margin: 0; }
@media (max-width: 1023px) {
  [data-mobile-search]:not(.is-mobile-search-open) :is(.header__search-submit, .header__search-clear) { display: none; }
}

.search .icon {
  font-size: 18px;
  margin-right: 10px;
}

.header__search-toggle {
  display: none;
  border: none;
  background: transparent;
  color: var(--teal);
  font-size: 20px;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.cart {
  position: relative;
  border: none;
  background: linear-gradient(135deg, #f6fbfb, #eef6f6);
  border: 1px solid #e5efef;
  border-radius: 16px;
  padding: 12px 16px;
  font-size: 18px;
  cursor: pointer;
  color: var(--teal);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  height: 52px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 10px 24px rgba(20, 60, 60, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.cart:hover,
.cart:focus-visible {
  outline: none;
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(31, 107, 107, 0.16);
  background: linear-gradient(135deg, #f2fafa, #e8f3f3);
  border-color: #d7e7e7;
}

.cart-count {
  position: absolute;
  top: -4px;
  right: -6px;
  background: #72122e;
  color: #ffffff;
  border-radius: 999px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.profile {
  position: relative;
  border: none;
  background: #eef6f6;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--teal);
  cursor: pointer;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.profile-avatar-image {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.profile:hover,
.profile:focus-visible {
  outline: none;
  box-shadow: 0 8px 16px rgba(31, 107, 107, 0.15);
  transform: translateY(-1px);
}

.profile-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.profile-notification-count {
  background: #72122e;
  color: #ffffff;
  border-radius: 999px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  position: absolute;
  top: -5px;
  right: -6px;
}

.profile-notification-count.is-hidden {
  display: none;
}

@media (max-width: 1023px) {
.main-header {
    padding: 16px;
    border-radius: 32px;
    box-shadow: 0 24px 48px rgba(29, 88, 110, 0.16);
    border-color: #e7edf3;
  }
}

@media (max-width: 1023px) {
.header__grid {
    grid-template-columns: 1fr auto;
    gap: 14px;
  }
}

@media (max-width: 1023px) {
.header-utilities {
    gap: 10px;
  }
}


@media (max-width: 1023px) {
:is(.catalog-page, .home-page, .favorites-body, .account-body, .ratings-body, .orders-body, .help-center-body, .customer-service-body) .header__grid {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "brand search actions";
    gap: 8px;
    align-items: center;
  }
}

/* The catalog switches to its mobile layout at 768px. Keep the header tied to
 * the full page width at the same breakpoint instead of inheriting the tablet
 * page inset. */
@media (max-width: 768px) {
  .catalog-page .header__grid {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 1023px) {
:is(.home-page, .catalog-page, .favorites-body, .account-body, .ratings-body, .orders-body, .help-center-body, .customer-service-body) .header__grid {
    /*grid-template-columns: 1fr auto 1fr;*/
    grid-template-areas: ". brand actions";
  }
}

@media (max-width: 1023px) {
:is(.home-page, .catalog-page, .favorites-body, .account-body, .ratings-body, .orders-body, .help-center-body, .customer-service-body) .logo {
    grid-area: brand;
    justify-self: center;
    align-items: center;
  }
}

@media (max-width: 1023px) {
:is(.home-page, .catalog-page, .favorites-body, .account-body, .ratings-body, .orders-body, .help-center-body, .customer-service-body) .header-mobile-actions {
    grid-area: actions;
    display: flex;
    align-items: center;
    justify-self: end;
    gap: 8px;
  }
}

@media (max-width: 1023px) {
:is(.home-page, .catalog-page, .favorites-body, .account-body, .ratings-body, .orders-body, .help-center-body, .customer-service-body) .help-link {
    display: none;
  }
}

@media (max-width: 1023px) {
:is(.catalog-page, .home-page, .favorites-body, .account-body, .ratings-body, .orders-body, .help-center-body, .customer-service-body) .main-header {
    padding: 0px 12px;
    border-radius: 0px;
    margin: 0px;
  }
}

@media (max-width: 1023px) {
:is(.home-page, .catalog-page, .favorites-body, .account-body, .ratings-body, .orders-body, .help-center-body, .customer-service-body) .main-header {
    position: relative;
    overflow: visible;
  }
}

@media (max-width: 1023px) {
:is(.home-page, .catalog-page, .favorites-body, .account-body, .ratings-body, .orders-body, .help-center-body, .customer-service-body) .main-header.is-mobile-search-open {
    padding-bottom: 0;
  }
}

@media (max-width: 1023px) {
:is(.catalog-page, .home-page, .favorites-body, .account-body, .ratings-body, .orders-body, .help-center-body, .customer-service-body) .logo-image {
    width: 92px;
    margin-bottom: 10px;
    margin-top: 10px;
  }
}

@media (max-width: 1023px) {
:is(.catalog-page, .home-page, .favorites-body, .account-body, .ratings-body, .orders-body, .help-center-body, .customer-service-body) .search {
    min-width: 0;
    min-height: 44px;
    padding-inline: 8px 10px;
  }
}

@media (max-width: 1023px) {
:is(.home-page, .catalog-page, .favorites-body, .account-body, .ratings-body, .orders-body, .help-center-body, .customer-service-body) .header__search {
    width: 46px;
    min-width: 46px;
    min-height: 46px;
    height: 46px;
    padding-inline: 0;
    justify-content: center;
    background: linear-gradient(135deg, #f4f8fa, #edf3f5);
    border: 1px solid #dce8ec;
    border-radius: 50%;
    box-shadow: none;
  }
}

@media (max-width: 1023px) {
:is(.home-page, .catalog-page, .favorites-body, .account-body, .ratings-body, .orders-body, .help-center-body, .customer-service-body) .header__search .header__search-toggle {
    display: inline-flex;
    width: 100%;
    height: 100%;
  }
}

@media (max-width: 1023px) {
:is(.home-page, .catalog-page, .favorites-body, .account-body, .ratings-body, .orders-body, .help-center-body, .customer-service-body) .header__search .icon,
  :is(.home-page, .catalog-page, .favorites-body, .account-body, .ratings-body, .orders-body, .help-center-body, .customer-service-body) .header__search input {
    display: none;
  }
}

@media (max-width: 1023px) {
:is(.home-page, .catalog-page, .favorites-body, .account-body, .ratings-body, .orders-body, .help-center-body, .customer-service-body) .header__search.is-mobile-search-open {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    width: auto;
    min-width: 0;
    min-height: 46px;
    padding-inline: 12px 14px;
    justify-content: flex-start;
    border-radius: 999px;
    box-shadow: 0 10px 24px rgba(29, 88, 110, 0.14);
    z-index: 25;
  }
}

@media (max-width: 1023px) {
:is(.home-page, .catalog-page, .favorites-body, .account-body, .ratings-body, .orders-body, .help-center-body, .customer-service-body) .header__grid.is-mobile-search-open {
    overflow: visible;
  }
}

@media (max-width: 1023px) {
:is(.home-page, .catalog-page, .favorites-body, .account-body, .ratings-body, .orders-body, .help-center-body, .customer-service-body) .header__search.is-mobile-search-open .header__search-toggle {
    display: none;
  }
}

@media (max-width: 1023px) {
:is(.home-page, .catalog-page, .favorites-body, .account-body, .ratings-body, .orders-body, .help-center-body, .customer-service-body) .header__search.is-mobile-search-open .icon {
    display: inline-flex;
    margin-right: 6px;
  }
}

@media (max-width: 1023px) {
:is(.home-page, .catalog-page, .favorites-body, .account-body, .ratings-body, .orders-body, .help-center-body, .customer-service-body) .header__search.is-mobile-search-open input {
    display: block;
  }
}

@media (max-width: 1023px) {
:is(.catalog-page, .home-page, .favorites-body, .account-body, .ratings-body, .orders-body, .help-center-body, .customer-service-body) .search input {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    padding-block: 10px;
  }
}

@media (max-width: 1023px) {
:is(.catalog-page, .home-page, .favorites-body, .account-body, .ratings-body, .orders-body, .help-center-body, .customer-service-body) .search .icon {
    width: 24px;
    height: 24px;
    margin-right: 6px;
  }
}

@media (max-width: 1023px) {
:is(.home-page, .catalog-page, .favorites-body, .account-body, .ratings-body, .orders-body, .help-center-body, .customer-service-body) .header-mobile-actions .cart-icon img {
    width: 22px;
    height: 22px;
    object-fit: contain;
  }
}

@media (max-width: 1023px) {
.logo {
    align-items: flex-start;
  }
}

@media (max-width: 1023px) {
.cart {
    min-width: 46px;
    width: 46px;
    height: 46px;
    padding: 0;
    border-radius: 50%;
    border-color: #dce8ec;
    background: linear-gradient(135deg, #f4f8fa, #edf3f5);
    box-shadow: none;
  }
}

@media (max-width: 1023px) {
.cart-count {
    top: -7px;
    right: -8px;
    min-width: 18px;
    height: 18px;
    font-size: 11px;
  }
}

@media (max-width: 1023px) {
.profile {
    width: 46px;
    height: 46px;
    background: linear-gradient(135deg, #f4f8fa, #edf3f5);
    border: 1px solid #dce8ec;
  }
}

@media (max-width: 1023px) {
.profile-wrapper {
    position: static;
  }
}

@media (max-width: 1023px) {
.help-link {
    display: none;
  }
}

@media (max-width: 1023px) {
.search {
    min-height: 50px;
    padding: 0 14px;
    border-radius: 999px;
    background: #f8fbff;
    border-color: #e3e9ef;
    box-shadow: none;
  }
}

@media (max-width: 1023px) {
.search input {
    padding: 12px 8px;
    font-size: 15px;
    color: #6f8492;
  }
}

@media (max-width: 1023px) {
.search .icon {
    font-size: 22px;
    margin-right: 12px;
  }
}

@media (max-width: 1023px) {
.logo-image {
    width: clamp(96px, 28vw, 124px);
  }
}

@media (max-width: 1023px) {
  .product-page .main-header {
    display: none;
  }
}
