/**
 * AITopUp — Store header (TGDD layout, brand palette)
 */

:root {
  --brand-navy: #002d84;
  --brand-royal: #003399;
  --brand-blue: #1e90ff;
  --brand-sky: #4fc3f7;
  --brand-ink: #0f172a;
  --brand-muted: #64748b;
  --brand-header-main: #ffffff;
  --brand-header-soft: #f0f7ff;
  --brand-header-cats: #002d84;
  --brand-header-promo: linear-gradient(90deg, #001A88 0%, #0052FF 55%, #00C8FF 100%);
  --brand-header-gradient: linear-gradient(135deg, #1e90ff 0%, #4fc3f7 100%);
  --header-main-h: 3.875rem;
  --header-cats-h: 2.75rem;
  --header-promo-h: 1.75rem;
  --header-search-panel-bg: #ffffff;
  --header-max-w: var(--max-w);
}

@media (min-width: 1024px) {
  :root {
    --header-main-h: 4.25rem;
    --header-h: calc(var(--header-main-h) + var(--header-cats-h));
  }
}

@media (max-width: 1023px) {
  :root {
    --header-h: var(--header-main-h);
  }
}

/* ===== Shell — brand header (TGDD-style layout, logo colors) ===== */
.site-header.site-header--tgdd {
  background: var(--brand-header-main);
  border-bottom: 1px solid rgba(0, 45, 132, 0.1);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 2px 12px rgba(0, 45, 132, 0.06);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.site-header.site-header--tgdd::before,
.site-header.site-header--tgdd .header-glow-border,
.site-header.site-header--tgdd .header-accent-line {
  display: none !important;
}

.site-header.site-header--tgdd.is-scrolled {
  background: var(--brand-header-main);
  box-shadow: 0 2px 14px rgba(0, 45, 132, 0.1);
}

.site-header.site-header--tgdd.is-scrolled .header-promo {
  display: none;
}

/* ===== Promo strip ===== */
.header-promo {
  background: var(--brand-header-promo);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
}

.header-promo__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: var(--header-promo-h);
  padding: 0.2rem 0;
}

.header-promo__text {
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-promo__text span + span::before {
  content: " · ";
}

/* Phones keep the two promises that fit instead of cutting the sentence mid-word. */
@media (max-width: 639px) {
  .header-promo__extra {
    display: none;
  }
}

.header-promo__cta {
  flex-shrink: 0;
  padding: 0.2rem 0.65rem;
  border-radius: 9999px;
  background: #fff;
  color: var(--brand-navy);
  font-size: 0.68rem;
  font-weight: 800;
  text-decoration: none;
}

.header-promo__cta:hover {
  background: var(--brand-sky);
  color: #fff;
}

@media (max-width: 639px) {
  .header-promo__text {
    font-size: 0.65rem;
  }
}

/* ===== Main row ===== */
.header-main {
  background: var(--brand-header-main);
}

.site-header--tgdd .header-inner {
  display: grid;
  grid-template-columns: var(--touch-min) 1fr auto;
  align-items: center;
  gap: 0.75rem;
  min-height: var(--header-main-h);
  height: auto;
  max-height: none;
  padding: 0.35rem 0;
}

@media (min-width: 1024px) {
  .site-header--tgdd .header-inner {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 1.5rem;
    padding: 0.5rem 0;
  }
}

.site-header--tgdd .site-logo {
  grid-column: 2;
  justify-self: start;
}

@media (min-width: 1024px) {
  .site-header--tgdd .site-logo {
    grid-column: 1;
  }
}

.site-header--tgdd .site-logo-img {
  max-height: 2.25rem;
  max-width: min(11rem, 42vw);
  width: auto;
  height: auto;
}

@media (min-width: 768px) {
  .site-header--tgdd .site-logo-img {
    max-height: 2.75rem;
    max-width: 12.5rem;
  }
}

/* Menu toggle */
.site-header--tgdd .menu-toggle {
  grid-column: 1;
  color: var(--brand-navy);
  border-color: rgba(0, 45, 132, 0.14);
  background: var(--brand-header-soft);
}

@media (min-width: 1024px) {
  .site-header--tgdd .menu-toggle {
    display: none;
  }
}

/* ===== Search — white pill (TGDD) ===== */
.site-header--tgdd .header-search-wrap {
  display: none;
  grid-column: 1 / -1;
  width: 100%;
}

@media (min-width: 1024px) {
  .site-header--tgdd .header-search-wrap {
    display: block;
    grid-column: 2;
    width: 100%;
    max-width: none;
    padding: 0;
    justify-self: stretch;
  }
}

.header-search-root {
  position: relative;
  width: 100%;
}

.header-search {
  margin: 0;
  width: 100%;
}

.header-search__combo {
  position: relative;
}

.header-search__label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header--tgdd .header-search__field {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.75rem;
  padding: 0 0.35rem 0 0.85rem;
  border-radius: 9999px;
  border: 1px solid rgba(0, 45, 132, 0.12);
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 45, 132, 0.06);
}

.site-header--tgdd .header-search__icon {
  display: inline-flex;
  color: #9ca3af;
  flex-shrink: 0;
}

.site-header--tgdd .header-search__input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--brand-ink);
  font-size: 0.875rem;
  padding: 0.35rem 0;
  outline: none;
}

.site-header--tgdd .header-search__input::placeholder {
  color: var(--brand-blue);
  opacity: 0.75;
}

.site-header--tgdd .header-search-root.is-open .header-search__field,
.site-header--tgdd .header-search__field:focus-within {
  border-color: rgba(30, 144, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.22);
}

.site-header--tgdd .header-search__submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border: none;
  border-radius: 9999px;
  background: var(--brand-header-gradient);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

.site-header--tgdd .header-search__submit:hover {
  background: linear-gradient(135deg, #1a7fe8 0%, #38b6e8 100%);
}

.header-search__clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border: none;
  border-radius: 9999px;
  background: #f3f4f6;
  color: #6b7280;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.header-search__clear:hover {
  color: var(--brand-navy);
}

.header-search__kbd {
  display: none;
  font-size: 0.625rem;
  font-family: inherit;
  padding: 0.15rem 0.35rem;
  border-radius: 0.35rem;
  border: 1px solid #e5e7eb;
  color: #9ca3af;
  background: #f9fafb;
  flex-shrink: 0;
}

@media (min-width: 1280px) {
  .site-header--tgdd .header-search__kbd {
    display: inline-block;
  }
}

.header-search__loading {
  width: 1rem;
  height: 1rem;
  border: 2px solid #e5e7eb;
  border-top-color: var(--brand-blue);
  border-radius: 50%;
  animation: header-search-spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes header-search-spin {
  to { transform: rotate(360deg); }
}

.header-search-root.is-loading .header-search__submit {
  opacity: 0.65;
}

.header-search__suggestions {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 120;
  max-height: min(24rem, 60vh);
  overflow: auto;
  padding: 0.35rem;
  border-radius: 0.85rem;
  border: 1px solid #e5e7eb;
  background-color: var(--header-search-panel-bg);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.header-search__option {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.55rem 0.6rem;
  border: none;
  border-radius: 0.6rem;
  background: none;
  color: inherit;
  text-decoration: none;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.header-search__option:hover,
.header-search__option.is-active {
  background: var(--brand-header-soft);
}

.header-search__thumb {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.5rem;
  object-fit: cover;
  flex-shrink: 0;
  background: #f3f4f6;
}

.header-search__thumb--icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-header-gradient);
  color: #fff;
}

.header-search__option-body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.header-search__option-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--brand-ink);
}

.header-search__option-price {
  font-size: 0.75rem;
  color: #cb1c22;
}

.header-search__option--all {
  margin-top: 0.2rem;
  border-top: 1px solid #e5e7eb;
  font-weight: 600;
  color: var(--brand-blue);
}

.header-search__empty,
.header-search__hint {
  margin: 0.35rem 0.5rem;
  font-size: 0.75rem;
  color: #6b7280;
}

.header-search__section-label {
  margin: 0.5rem 0 0.35rem;
  padding: 0 0.5rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9ca3af;
}

.header-search__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 0.35rem 0.5rem;
}

.header-search__chip {
  border: 1px solid rgba(0, 45, 132, 0.12);
  background: var(--brand-header-soft);
  color: var(--brand-navy);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  border-radius: 9999px;
  cursor: pointer;
}

.header-search__chip:hover {
  background: #e3f2fd;
  border-color: var(--brand-sky);
}

.search-hit {
  background: rgba(79, 195, 247, 0.35);
  padding: 0 0.1rem;
  border-radius: 0.15rem;
}

/* ===== Actions — TGDD icon + label ===== */
.site-header--tgdd .header-actions {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-shrink: 0;
  grid-column: 3;
}

@media (min-width: 1024px) {
  .site-header--tgdd .header-actions {
    gap: 0.875rem;
  }
}

.header-tgdd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--brand-navy);
  cursor: pointer;
}

.header-tgdd-btn:hover {
  background: var(--brand-header-soft);
}

@media (min-width: 1024px) {
  .site-header--tgdd .search-open-mobile {
    display: none !important;
  }

  .site-header--tgdd .theme-toggle {
    display: inline-flex;
  }
}

.header-tgdd-action {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  min-width: 3.25rem;
  padding: 0.15rem 0.35rem;
  border: none;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--brand-navy);
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}

.header-tgdd-action:hover {
  background: var(--brand-header-soft);
}

.header-tgdd-action__icon {
  display: block;
  stroke: currentColor;
}

.header-tgdd-action__label {
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

@media (max-width: 1023px) {
  .header-tgdd-action__label,
  .header-tgdd-support__label {
    display: none;
  }

  .header-tgdd-action {
    min-width: 2.25rem;
    padding: 0.15rem;
  }
}

.header-tgdd-badge {
  position: absolute;
  top: 0;
  right: 0.15rem;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.2rem;
  border-radius: 9999px;
  background: #cb1c22;
  color: #fff;
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1rem;
  text-align: center;
  display: none;
}

.header-tgdd-badge.is-visible,
.cart-count.is-visible {
  display: block;
}

.header-tgdd-support {
  display: none;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: 0.5rem;
  background: var(--brand-header-soft);
  color: var(--brand-navy);
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid rgba(0, 45, 132, 0.12);
}

@media (min-width: 1200px) {
  .header-tgdd-support {
    display: inline-flex;
  }
}

.header-tgdd-support:hover {
  background: #fff;
}

.header-account {
  display: block;
}

.site-header--tgdd .account-menu {
  background: #fff;
  border-color: #e5e7eb;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.site-header--tgdd .account-menu a {
  color: var(--brand-ink);
}

.site-header--tgdd .account-menu a:hover {
  background: var(--brand-header-soft);
}

/* ===== Category bar (row 2) ===== */
.header-cats {
  display: none;
  background: linear-gradient(90deg, #001A88 0%, #0052FF 65%, #0078FF 100%);
  border-top: 1px solid rgba(0, 200, 255, 0.12);
}

@media (min-width: 1024px) {
  .header-cats {
    display: block;
  }
}

.header-cats__inner {
  position: relative;
  overflow: hidden;
}

.header-cats__list {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.header-cats__list::-webkit-scrollbar {
  display: none;
}

.header-cats__item {
  flex-shrink: 0;
}

.header-cats__link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: var(--header-cats-h);
  padding: 0 1.1rem;
  color: rgba(255, 255, 255, 0.95);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.header-cats__link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.header-cats__link.is-active {
  background: rgba(255, 255, 255, 0.14);
  border-bottom-color: #00C8FF;
  color: #fff;
  font-weight: 800;
}

.header-cats__icon {
  display: inline-flex;
  flex-shrink: 0;
  stroke: currentColor;
}

/* ===== Search overlay ===== */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  padding: 1rem;
  padding-top: calc(var(--viewport-header-offset, 4rem) + 0.75rem);
}

.search-overlay[hidden] {
  display: none !important;
}

.search-overlay:not([hidden]) {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.search-overlay__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.search-overlay__panel {
  position: relative;
  width: min(100%, var(--max-w), 36rem);
  padding: 1rem;
  border-radius: 1rem;
  border: 1px solid #e5e7eb;
  background: #fff;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15);
}

.search-overlay__close {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 0.5rem;
  background: #f3f4f6;
  color: var(--brand-navy);
  cursor: pointer;
}

.header-search--overlay .header-search__field,
.header-search--drawer .header-search__field {
  min-height: var(--touch-min, 44px);
  border-radius: 9999px;
  background: #fff;
}

.header-search--overlay .header-search__suggestions,
.header-search--drawer .header-search__suggestions {
  position: static;
  margin-top: 0.5rem;
  max-height: 50vh;
}

.search-overlay--spotlight {
  align-items: center;
  padding-top: 10vh;
}

.search-overlay--spotlight .search-overlay__panel {
  width: min(100%, 40rem);
}

@media (min-width: 1024px) {
  .search-overlay:not(.search-overlay--spotlight)[hidden] {
    display: none !important;
  }
}

/* Mobile drawer logo */
.drawer-logo .site-logo-img {
  max-height: 2.25rem;
  max-width: 11rem;
  width: auto;
  height: auto;
}

/* === Scroll fade indicator — category bar (auto-added fix) === */
.header-cats__inner::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 3rem;
  background: linear-gradient(to right, transparent, #0078FF);
  pointer-events: none;
  z-index: 1;
}
