/* ============================================================
   Header CSS — SmartHub IT Store
   ============================================================ */

/* ── Sticky Header Wrapper ─────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: #fff;
  box-shadow: 0 2px 16px rgba(0,0,0,0.12);
}

/* ── Row 1: Top Bar ─────────────────────────────────────────── */
.header-topbar {
  background: var(--color-primary);
  height: var(--header-h1);
  display: flex;
  align-items: center;
}
.header-topbar .container {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
}

/* Logo */
.header-logo {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  background: #ffffff;
  padding: 4px 12px;
  border-radius: 9px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: all 0.22s ease;
  height: 48px;
}
.header-logo:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}
.header-logo__img {
  height: 42px;
  width: auto;
  max-width: 210px;
  object-fit: contain;
  display: block;
}

/* Search Bar */
.header-search {
  flex: 1 1 auto;
  max-width: 720px;
  min-width: 280px;
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
  margin: 0 20px;
}
.header-search__input {
  flex: 1;
  padding: 0 14px;
  height: 40px;
  border: none;
  outline: none;
  font-size: 0.86rem;
  color: var(--color-text);
  background: transparent;
  min-width: 0;
}
.header-search__input::placeholder { color: var(--color-gray-400); font-size: 0.82rem; }
.header-search__icons {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 4px;
  border-right: 1px solid var(--color-gray-200);
}
.header-search__icon-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: var(--transition);
  color: var(--color-gray-400);
}
.header-search__icon-btn:hover {
  background: var(--color-bg-tint);
  color: var(--color-primary);
}
.header-search__icon-btn svg { width: 16px; height: 16px; }
.header-search__btn {
  height: 40px;
  padding: 0 16px;
  background: var(--color-primary-dark);
  color: #fff;
  border: none;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.header-search__btn:hover { background: #173268; }
.header-search__btn svg { width: 15px; height: 15px; }

/* Right Icons Strip */
.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}
.header-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 9px;
  border-radius: var(--radius-md);
  color: rgba(255,255,255,0.92);
  text-decoration: none;
  transition: var(--transition);
  position: relative;
  min-width: 48px;
  cursor: pointer;
}
.header-action:hover {
  background: rgba(255,255,255,0.14);
  color: #fff;
}
.header-action svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.header-action__label {
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-top: 2px;
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
}
.header-action__sub {
  font-size: 0.62rem;
  color: rgba(255,255,255,0.72);
}
/* Wider actions (phone, location, whatsapp) */
.header-action--wide {
  min-width: 0;
  flex-direction: row;
  gap: 8px;
  padding: 6px 10px;
}
.header-action--wide .header-action__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.header-action--wide .header-action__label {
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 0;
}
.header-action--wide .header-action__sub {
  font-size: 0.64rem;
}

/* Cart action badge */
.header-cart {
  position: relative;
}
.cart-badge {
  position: absolute;
  top: 2px; right: 4px;
  min-width: 18px;
  height: 18px;
  background: #f59e0b;
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}
.header-action--cart {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: var(--radius-md);
  min-width: 0;
}
.header-action--cart:hover {
  background: rgba(255,255,255,0.24);
  border-color: rgba(255,255,255,0.35);
}
.header-action--cart .cart-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.header-action--cart .cart-count {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.8);
}
.header-action--cart .cart-total {
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
}

.header-action--partner {
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  flex-direction: row;
  gap: 6px;
  font-weight: 700;
  color: #ffffff;
  transition: all 0.22s ease;
}
.header-action--partner:hover {
  background: #ffffff;
  border-color: #ffffff;
  color: var(--color-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}
.header-action--partner:hover svg {
  stroke: var(--color-primary);
}
.header-action--partner:hover .header-action__label {
  color: var(--color-primary);
}
.header-action--partner svg {
  width: 15px;
  height: 15px;
}
.header-action--partner .header-action__label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Divider between action groups */
.header-actions-sep {
  width: 1px;
  height: 22px;
  background: rgba(255,255,255,0.22);
  flex-shrink: 0;
  margin: 0 3px;
}

/* ── Row 2: Navigation Bar ───────────────────────────────────── */
.header-navbar {
  background: var(--color-primary-dark);
  height: var(--header-h2);
  display: flex;
  align-items: center;
  position: relative;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.header-navbar .container {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 0;
  overflow: visible;
  position: relative;
  max-width: 1800px;
  width: 100%;
  padding: 0 16px;
}

.nav-brand-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 100%;
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  text-decoration: none;
  border-radius: 0;
  flex-shrink: 0;
  border-right: 1px solid rgba(255,255,255,0.12);
}
.nav-brand-btn:hover { background: #2563eb; }
.nav-brand-btn svg { width: 14px; height: 14px; }

/* Scrollable Nav Container */
.nav-links-scroll {
  flex: 1;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
  display: flex;
  align-items: center;
}
.nav-links-scroll::-webkit-scrollbar { display: none; }

.nav-links-inner {
  display: flex;
  align-items: center;
  height: 100%;
  flex-shrink: 0;
  min-width: 100%;
  width: max-content;
  justify-content: space-between;
  gap: 1px;
}

.nav-item {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 7px;
  height: 100%;
  color: rgba(255,255,255,0.92);
  font-size: 0.77rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: all 0.18s ease;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  border-radius: 4px 4px 0 0;
}
.nav-link:hover,
.nav-item.is-open > .nav-link {
  color: #fff;
  background: rgba(255,255,255,0.16);
}
.nav-item.is-open::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid #0f2744;
  z-index: 920;
}
.nav-link__arrow {
  width: 9px;
  height: 9px;
  opacity: 0.72;
  stroke-width: 2.2;
  margin-top: 1px;
  transition: transform 0.22s ease, opacity 0.22s ease;
  flex-shrink: 0;
}
.nav-item.is-open .nav-link__arrow {
  transform: rotate(180deg);
  opacity: 1;
}
.nav-item--more {
  margin-left: 4px;
}
.nav-link--more {
  background: rgba(255, 255, 255, 0.08);
  padding: 0 11px;
  font-weight: 700;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px 4px 0 0;
}
.nav-link--more:hover,
.nav-item--more.is-open > .nav-link--more {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.35);
  color: #ffffff;
}

/* Mobile menu toggle */
.header-mobile-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
  padding: 0;
}
.header-mobile-toggle:hover {
  background: rgba(255,255,255,0.28);
}
.header-mobile-toggle svg { width: 22px; height: 22px; }

.nav-mobile-toggle {
  display: none;
}

/* ── Search Suggestions Dropdown ────────────────────────────── */
.search-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  overflow: hidden;
  display: none;
}
.search-suggestions.is-open { display: block; }
.search-sugg-item {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: var(--transition);
}
.search-sugg-item:hover { background: var(--color-bg-tint); }
.search-sugg-item svg { width: 14px; height: 14px; color: var(--color-gray-400); }

/* ── Responsive Rules ───────────────────────────────────────── */
@media (max-width: 1200px) {
  .header-search { max-width: 520px; }
  .header-action--wide .header-action__text { display: none; }
  .header-action--wide { min-width: 40px; }
  .nav-link { padding: 0 8px; font-size: 0.78rem; }
}

@media (max-width: 960px) {
  .header-topbar .container { gap: 10px; }
  .header-search { max-width: 360px; margin: 0 8px; }
  .header-actions-sep { display: none; }
  .header-action--partner { display: none; }
}

@media (max-width: 768px) {
  :root {
    --header-h1: 58px;
    --header-h2: 50px;
    --header-total: 108px;
  }
  .site-header {
    background: var(--color-primary);
  }
  .header-topbar {
    height: 58px;
  }
  .header-topbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 12px;
  }
  .header-mobile-toggle {
    display: flex;
  }
  .header-logo {
    height: 38px;
    padding: 3px 8px;
    margin-right: auto;
    margin-left: 4px;
  }
  .header-logo__img {
    height: 30px;
    max-width: 130px;
  }
  /* Search moves to row 2 */
  .header-search {
    position: absolute;
    top: 58px;
    left: 12px;
    right: 12px;
    max-width: calc(100% - 24px);
    margin: 0;
    height: 42px;
    z-index: 10;
  }
  .header-search__input {
    height: 42px;
    font-size: 0.84rem;
  }
  .header-search__btn {
    height: 42px;
    padding: 0 12px;
  }
  /* Navbar row holds space for search bar */
  .header-navbar {
    height: 50px;
    background: var(--color-primary-dark);
    display: flex;
    align-items: center;
  }
  .header-navbar .container {
    display: none;
  }
  /* Header actions on top row */
  .header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 0;
  }
  .header-action {
    padding: 6px;
    min-width: 36px;
    height: 36px;
  }
  .header-action svg {
    width: 20px;
    height: 20px;
  }
  .header-action .header-action__label,
  .header-action .header-action__text,
  .header-action--wide,
  .header-action--partner,
  .header-actions-sep {
    display: none !important;
  }
  .header-action--cart {
    background: rgba(255,255,255,0.18);
    border-radius: 8px;
    padding: 6px 10px;
  }
  .header-action--cart .cart-info {
    display: none;
  }
  .header-action--cart .cart-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    border-radius: 10px;
    padding: 1px 5px;
    min-width: 16px;
    text-align: center;
    display: block !important;
  }
}

@media (max-width: 480px) {
  .header-logo__img {
    max-width: 110px;
    height: 26px;
  }
  .header-logo {
    height: 34px;
    padding: 2px 6px;
  }
  .header-search__icons {
    display: none;
  }
}
