/* Galaxy Hub — Storefront header */

.gh-header {
  --gh-primary: #266ab4;
  --gh-primary-dark: #1a4f8a;
  --gh-accent: #f59e0b;
  --gh-accent-hot: #f97316;
  --gh-purple: #7c3aed;
  --gh-cyan: #06b6d4;
  position: sticky;
  top: 0;
  z-index: 1100;
  background: #fff;
  box-shadow: 0 4px 24px rgba(38, 106, 180, 0.1);
}

/* Top bar */
.gh-header__top {
  background: linear-gradient(90deg, #0f2d52 0%, #1a4f8a 35%, #266ab4 65%, #4f46e5 100%);
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.8rem;
  padding: 0.5rem 0;
  position: relative;
  overflow: hidden;
}

.gh-header__top::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.08) 50%, transparent 100%);
  pointer-events: none;
}

.gh-header__top-inner {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.gh-header__promo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.gh-header__promo-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 50px;
  background: linear-gradient(135deg, #fbbf24, #f97316);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.45);
}

.gh-header__promo i {
  color: #fde047;
  font-size: 0.95rem;
  filter: drop-shadow(0 0 6px rgba(253, 224, 71, 0.5));
}

.gh-header__promo strong {
  color: #fde047;
  font-weight: 700;
}

.gh-header__top-links {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.gh-header__top-links a {
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: background 0.2s, color 0.2s, transform 0.2s;
}

.gh-header__top-links a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.gh-header__top-links a i {
  color: #7dd3fc;
}

/* Main bar */
.gh-header__main {
  background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
  border-bottom: 1px solid #dbeafe;
}

.gh-header__main-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.5rem;
}

.gh-header__logo img {
  height: 52px;
  width: auto;
  display: block;
}

/* Search */
.gh-header__search {
  display: flex;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.gh-header__search:focus-within {
  border-color: var(--gh-primary);
  box-shadow: 0 0 0 3px rgba(38, 106, 180, 0.12);
}

.gh-header__search input {
  flex: 1;
  border: none;
  padding: 0.7rem 1rem;
  font-size: 0.925rem;
  outline: none;
  background: #fff;
  min-width: 0;
}

.gh-header__search button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1.25rem;
  background: var(--gh-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  transition: background 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.gh-header__search button:hover {
  background: var(--gh-primary-dark);
}

/* Actions */
.gh-header__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.gh-header__action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding: 0.35rem 0.55rem;
  border-radius: 12px;
  text-decoration: none;
  color: #374151;
  font-size: 0.7rem;
  font-weight: 600;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  position: relative;
  transition: background 0.2s, color 0.2s, transform 0.2s;
  white-space: nowrap;
}

.gh-header__action:hover {
  background: #eff6ff;
  color: var(--gh-primary);
  transform: translateY(-1px);
}

.gh-header__action > i {
  font-size: 1.35rem;
}

.gh-header__action-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gh-header__action:hover .gh-header__action-icon {
  transform: scale(1.06);
}

.gh-header__action-icon--purple {
  background: linear-gradient(135deg, #ede9fe, #ddd6fe);
  color: #6d28d9;
  box-shadow: 0 4px 12px rgba(109, 40, 217, 0.15);
}

.gh-header__action-icon--orange {
  background: linear-gradient(135deg, #ffedd5, #fed7aa);
  color: #ea580c;
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.18);
}

.gh-header__action--phone {
  flex-direction: row;
  gap: 0.65rem;
  padding: 0.45rem 0.9rem;
  border: 1.5px solid #bfdbfe;
  border-radius: 14px;
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
}

.gh-header__action--phone:hover {
  border-color: #93c5fd;
  background: linear-gradient(135deg, #dbeafe 0%, #dcfce7 100%);
}

.gh-header__action--phone .gh-header__action-icon,
.gh-header__action--phone > i {
  width: auto;
  height: auto;
  background: none;
  box-shadow: none;
  font-size: 1.5rem;
  color: var(--gh-primary);
}

.gh-header__action--phone span {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}

.gh-header__action--phone strong {
  font-size: 0.85rem;
  color: #111827;
}

.gh-header__action--phone small {
  font-size: 0.7rem;
  color: #6b7280;
  font-weight: 500;
}

.gh-header__cart-count {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.45);
}

/* Nav bar */
.gh-header__nav {
  background: linear-gradient(90deg, #1a4f8a 0%, #266ab4 40%, #3b82f6 70%, #6366f1 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  position: relative;
  z-index: 20;
  overflow: visible;
}

.gh-header__nav-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: stretch;
  gap: 0;
  position: relative;
  overflow: visible;
}

.gh-header__menu-toggle {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1rem;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  transition: background 0.2s;
}

.gh-header__menu-toggle:hover {
  background: rgba(255, 255, 255, 0.22);
}

.gh-header__categories {
  position: relative;
}

.gh-header__categories-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.25rem;
  background: linear-gradient(135deg, #f59e0b 0%, #f97316 55%, #ea580c 100%);
  color: #fff;
  border: none;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: filter 0.2s, transform 0.2s;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 4px 0 16px rgba(0, 0, 0, 0.08);
}

.gh-header__categories-btn:hover,
.gh-header__categories.is-open .gh-header__categories-btn {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.gh-header__categories-btn i {
  font-size: 1.15rem;
}

.gh-header__mega {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 280px;
  background: #fff;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  border: 1px solid #e5e7eb;
  border-top: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  z-index: 1200;
  overflow: visible;
}

.gh-header__categories.is-open .gh-header__mega,
.gh-header__categories:hover .gh-header__mega {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.gh-header__mega-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: visible;
}

.gh-header__mega-item {
  position: relative;
}

.gh-header__mega-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.25rem;
  color: #374151;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.gh-header__mega-link:hover {
  background: #f0f7ff;
  color: var(--gh-primary);
}

.gh-header__mega-sub {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0 0.5rem;
  background: #f9fafb;
  display: none;
}

.gh-header__mega-item.has-sub.is-expanded .gh-header__mega-sub {
  display: block;
}

.gh-header__mega-sub a {
  display: block;
  padding: 0.4rem 1.25rem 0.4rem 2rem;
  color: #6b7280;
  text-decoration: none;
  font-size: 0.825rem;
  transition: color 0.15s, background 0.15s;
}

.gh-header__mega-sub a:hover {
  color: var(--gh-primary);
  background: #f0f7ff;
}

/* Desktop sidekick panel for subcategories */
@media (min-width: 992px) {
  .gh-header__mega-item.has-sub:hover > .gh-header__mega-link {
    background: #f0f7ff;
    color: var(--gh-primary);
  }

  .gh-header__mega-sub {
    position: absolute;
    left: 100%;
    top: 0;
    min-width: 260px;
    max-width: 300px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 0.5rem 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0 12px 12px 0;
    box-shadow: 8px 12px 32px rgba(0, 0, 0, 0.1);
    z-index: 102;
  }

  .gh-header__mega-sub::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 0;
    width: 10px;
    height: 100%;
  }

  .gh-header__mega-item.has-sub:hover > .gh-header__mega-sub,
  .gh-header__mega-item.has-sub.is-expanded > .gh-header__mega-sub {
    display: block;
  }

  .gh-header__mega-sub a {
    padding: 0.55rem 1.25rem;
  }
}

.gh-header__nav-links {
  display: flex;
  align-items: stretch;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: none;
}

.gh-header__nav-links > li.dropdown {
  position: static;
}

.gh-header__nav-links::-webkit-scrollbar {
  display: none;
}

.gh-header__nav-links > li > a {
  display: flex;
  align-items: center;
  padding: 0.85rem 1rem;
  color: rgba(255, 255, 255, 0.94);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  position: relative;
}

.gh-header__nav-links > li > a:hover,
.gh-header__nav-links > li.is-active > a {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.gh-header__nav-links > li.is-active > a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 1rem;
  right: 1rem;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(90deg, #fbbf24, #f97316);
}

.gh-header__nav-links .dropdown-menu {
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  padding: 0.5rem 0;
  margin-top: 0;
  z-index: 1200;
}

.gh-header__nav-links .dropdown-item {
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.gh-header__nav-links .dropdown-item img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.gh-header__nav-links .dropdown-item:hover {
  background: #f0f7ff;
  color: var(--gh-primary);
}

/* Mobile drawer */
.gh-header__overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1160;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.gh-header__overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

.gh-header__drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: min(320px, 88vw);
  height: 100vh;
  background: #fff;
  z-index: 1170;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.gh-header__drawer.is-open {
  transform: translateX(0);
}

.gh-header__drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%);
}

.gh-header__drawer-head img {
  height: 40px;
}

.gh-header__drawer-close {
  width: 36px;
  height: 36px;
  border: none;
  background: #f3f4f6;
  border-radius: 8px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gh-header__drawer-body {
  padding: 0.75rem 0;
  flex: 1;
}

.gh-header__drawer-label {
  padding: 0.5rem 1.25rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
}

.gh-header__drawer-link {
  display: block;
  padding: 0.65rem 1.25rem;
  color: #374151;
  text-decoration: none;
  font-size: 0.925rem;
  font-weight: 500;
  border-bottom: 1px solid #f9fafb;
}

.gh-header__drawer-link:hover {
  background: #f0f7ff;
  color: var(--gh-primary);
}

.gh-header__drawer-sub {
  padding-left: 1rem;
}

.gh-header__drawer-sub a {
  font-size: 0.85rem;
  font-weight: 400;
  color: #6b7280;
}

.gh-header__drawer-foot {
  padding: 1rem 1.25rem;
  border-top: 1px solid #e5e7eb;
  background: linear-gradient(135deg, #eff6ff 0%, #fff7ed 100%);
}

.gh-header__drawer-foot a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--gh-primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
}

/* Hide old header */
.main-header,
.featured-section,
.sticky-header,
.mobile-menu,
.category-menu {
  display: none !important;
}

/* Responsive */
@media (max-width: 991px) {
  .gh-header__main-inner {
    grid-template-columns: auto 1fr auto;
    gap: 0.75rem;
  }

  .gh-header__search-wrap {
    display: none;
  }

  .gh-header__action--phone span {
    display: none;
  }

  .gh-header__action--phone {
    padding: 0.4rem;
    border: none;
  }

  .gh-header__action-label {
    display: none;
  }

  .gh-header__menu-toggle {
    display: flex;
  }

  .gh-header__categories {
    display: none;
  }

  .gh-header__nav-links {
    display: none;
  }

  .gh-header__top-links {
    display: none;
  }

  .gh-header__action.d-lg-none > i {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #dbeafe, #eff6ff);
    color: var(--gh-primary);
    box-shadow: 0 3px 10px rgba(38, 106, 180, 0.12);
  }

  #ghMenuOpen > i {
    background: linear-gradient(135deg, #ede9fe, #f3e8ff);
    color: #6d28d9;
  }
}

@media (max-width: 575px) {
  .gh-header__logo img {
    height: 42px;
  }

  .gh-header__promo span {
    display: none;
  }

  .gh-header__promo::after {
    content: 'Free delivery in Nairobi';
    font-size: 0.75rem;
  }
}

/* Mini cart dropdown */
.gh-minicart {
  position: relative;
}

.gh-minicart__panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(380px, calc(100vw - 2rem));
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  max-height: min(70vh, 520px);
  overflow: hidden;
}

.gh-minicart.is-open .gh-minicart__panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.gh-minicart__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid #eef2f7;
  background: linear-gradient(180deg, #f8fbff 0%, #fff 100%);
}

.gh-minicart__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.gh-minicart__title i {
  color: #ea580c;
}

.gh-minicart__title-count {
  font-weight: 600;
  color: #6b7280;
}

.gh-minicart__close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: #f3f4f6;
  color: #374151;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.gh-minicart__close:hover {
  background: #e5e7eb;
}

.gh-minicart__body {
  overflow-y: auto;
  padding: 0.5rem 0;
  flex: 1;
}

.gh-minicart__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.gh-minicart__item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 0.75rem;
  align-items: start;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f3f4f6;
}

.gh-minicart__item:last-child {
  border-bottom: none;
}

.gh-minicart__thumb {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 10px;
  background: #f9fafb;
  border: 1px solid #eef2f7;
  overflow: hidden;
}

.gh-minicart__thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gh-minicart__info {
  min-width: 0;
}

.gh-minicart__name {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #111827;
  text-decoration: none;
  line-height: 1.35;
  margin-bottom: 0.15rem;
}

.gh-minicart__name:hover {
  color: var(--gh-primary);
}

.gh-minicart__variant {
  display: block;
  font-size: 0.72rem;
  color: #6b7280;
  margin-bottom: 0.35rem;
}

.gh-minicart__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.gh-minicart__qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.gh-minicart__qty-btn {
  width: 26px;
  height: 26px;
  border: none;
  background: #f9fafb;
  color: #374151;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
}

.gh-minicart__qty-btn:hover {
  background: #eff6ff;
  color: var(--gh-primary);
}

.gh-minicart__qty-val {
  min-width: 24px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
}

.gh-minicart__price {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gh-primary);
  white-space: nowrap;
}

.gh-minicart__remove {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: #fef2f2;
  color: #dc2626;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.gh-minicart__remove:hover {
  background: #fee2e2;
}

.gh-minicart__empty {
  text-align: center;
  padding: 2rem 1.25rem;
  color: #6b7280;
}

.gh-minicart__empty i {
  font-size: 2rem;
  color: #d1d5db;
  display: block;
  margin-bottom: 0.5rem;
}

.gh-minicart__empty p {
  margin: 0 0 1rem;
  font-size: 0.9rem;
}

.gh-minicart__foot {
  padding: 0.85rem 1rem 1rem;
  border-top: 1px solid #eef2f7;
  background: #fafafa;
}

.gh-minicart__subtotal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.gh-minicart__subtotal strong {
  font-size: 1rem;
  color: #111827;
}

.gh-minicart__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

@media (max-width: 767px) {
  .gh-minicart__panel {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 85vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }

  .gh-minicart.is-open .gh-minicart__panel {
    transform: translateY(0);
  }
}
