/* Dedicated mobile/tablet header layout */

@media (max-width: 1024px) {
  .amw-header-top {
    display: none !important;
  }

  .amw-header-main {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
  }

  .amw-header-inner {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "brand categories nav"
      "search search search";
    align-items: center;
    gap: 10px 12px;
  }

  .amw-brand {
    grid-area: brand;
    min-width: 0;
    white-space: nowrap;
    font-size: 1.1rem;
    line-height: 1.1;
  }

  .amw-nav-categories {
    grid-area: categories;
    min-width: 0;
    justify-self: start;
  }

  .amw-nav-categories-toggle {
    white-space: nowrap;
    padding: 10px 12px;
  }

  .amw-header-search {
    grid-area: search;
    width: 100% !important;
    max-width: none !important;
    min-width: 0;
  }

  .amw-header-search-form {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    width: 100%;
    min-width: 0;
  }

  .amw-typeahead-anchor,
  .amw-header-search-input {
    min-width: 0;
    width: 100%;
  }

  .amw-nav {
    grid-area: nav;
    justify-self: end;
    display: flex !important;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }

  /* Keep only Sponsoring + wishlist on tablet */
  .amw-nav > * {
    display: none !important;
  }

  .amw-nav > a[href="/sponsoring"],
  .amw-nav > .amw-wishlist-button {
    display: inline-flex !important;
  }

  .amw-nav a[href="/sponsoring"] {
    white-space: nowrap;
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
  }

  .amw-wishlist-button {
    flex: 0 0 auto;
  }
}

@media (max-width: 767px) {
  .amw-header-main {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
  }

  .amw-header-inner {
    grid-template-columns: 44px minmax(0, 1fr) 44px !important;
    grid-template-areas:
      "categories brand nav"
      "search search search";
    gap: 10px 8px;
  }

  .amw-brand {
    justify-self: center;
    font-size: 1rem !important;
    white-space: nowrap;
  }

  /* Turn categories button into hamburger */
  .amw-nav-categories {
    width: 44px;
    justify-self: start;
    position: relative;
  }

  .amw-nav-categories-toggle {
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 10px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }

  .amw-nav-categories-label,
  .amw-nav-caret {
    display: none !important;
  }

  .amw-nav-categories-toggle::before {
    content: "☰";
    font-size: 28px;
    line-height: 1;
    color: #111827;
  }

  /* Mobile dropdown panel */
  .amw-category-menu {
    position: fixed !important;
    top: 88px !important;
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    max-height: 70vh !important;
    overflow: auto !important;
    border-radius: 16px !important;
    padding: 1rem !important;
    z-index: 2000 !important;
  }

  .amw-nav {
    justify-self: end;
    gap: 6px;
  }

  /* Keep only wishlist in mobile top row */
  .amw-nav > * {
    display: none !important;
  }

  .amw-nav > .amw-wishlist-button {
    display: inline-flex !important;
  }

  .amw-wishlist-button {
    width: 44px;
    height: 44px;
    padding: 0 !important;
  }

  .amw-wishlist-heart {
    width: 1.2rem;
    height: 1.2rem;
  }

  .amw-header-search {
    margin-top: 2px;
  }

  .amw-header-search-form {
    grid-template-columns: minmax(0, 1fr) auto !important;
  }

  .amw-header-search-input {
    min-height: 46px;
  }

  .amw-header-search-button {
    min-width: 84px;
    min-height: 46px;
    padding: 0 1rem;
  }
}
