/**
 * TechMart Electronics Company — Master Top Navigation Bar & Announcement Bar
 * Authoritative Stylesheet
 * 
 * Reusable and 100% consistent across all pages and sections:
 * Home, Shop, Categories, Product Details, Blog, Single Article, About Us, Contact Us,
 * Cart, Checkout, Policies (Terms, Privacy, Shipping, Warranty, Layby), Error pages.
 */

/* ── Global Header Variables & Reset ── */
:root {
  --tm-primary: #0098D9;
  --tm-primary-hover: #0080B7;
  --tm-primary-light: rgba(0, 152, 217, 0.08);
  --tm-primary-soft: rgba(0, 152, 217, 0.14);
  --tm-dark: #0F172A;
  --tm-text: #1E293B;
  --tm-muted: #64748B;
  --tm-border: #E2E8F0;
  --tm-border-light: #F1F5F9;
  --tm-bg-subtle: #F8FAFC;
  --tm-white: #FFFFFF;
  --tm-danger: #EF4444;
  --tm-hdr-height: 70px;
}

#ann-bar,
#hdr.site-header,
#mob-nav {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  box-sizing: border-box;
}

#ann-bar *,
#hdr.site-header *,
#mob-nav * {
  box-sizing: border-box;
}

/* ══════════════════════════════════════════════
   1. TOP ANNOUNCEMENT BAR
   ══════════════════════════════════════════════ */
#ann-bar {
  background: var(--tm-primary);
  color: #ffffff;
  font-size: 0.8125rem;
  line-height: 1.4;
  padding: 8px 0;
  font-weight: 500;
  position: relative;
  z-index: 10000;
}

#ann-bar a {
  color: #ffffff;
  text-decoration: none;
}

.ann-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

.ann-left,
.ann-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ann-center {
  text-align: center;
  opacity: 0.95;
  font-size: 0.8rem;
}

.ann-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ann-link {
  color: #ffffff !important;
  text-decoration: none !important;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.18);
  padding: 2px 10px;
  border-radius: 50px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
}

.ann-link:hover {
  background: #ffffff;
  color: var(--tm-primary) !important;
}

/* ══════════════════════════════════════════════
   2. MAIN STICKY HEADER
   ══════════════════════════════════════════════ */
#hdr.site-header {
  position: sticky !important;
  top: 0 !important;
  left: 0;
  right: 0;
  z-index: 9999 !important;
  background: #ffffff !important;
  border-bottom: 1px solid var(--tm-border-light) !important;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04) !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
}

#hdr .wrap,
#hdr .hdr-wrap {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

.hdr-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: var(--tm-hdr-height);
  position: relative;
}

/* ── Logo ── */
#hdr .logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
  height: 100%;
}

#hdr .logo img {
  height: 40px !important;
  width: auto !important;
  max-width: 170px !important;
  object-fit: contain;
  display: block;
}

#hdr .logo-fallback-text {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

/* ── Desktop Navigation Bar ── */
#hdr .nav-desk {
  display: flex !important;
  align-items: center !important;
  gap: 22px !important;
  margin: 0 !important;
  padding: 0 !important;
  flex: none !important;
  justify-content: flex-start !important;
  height: auto !important;
}

#hdr .nav-desk > a,
#hdr .nav-drop-trigger {
  font-family: 'Poppins', sans-serif !important;
  font-size: 0.9375rem !important;
  font-weight: 600 !important;
  color: var(--tm-text) !important;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  padding: 6px 2px !important;
  height: auto !important;
  position: relative !important;
  cursor: pointer !important;
  background: transparent !important;
  border-radius: 0 !important;
  border: none !important;
  white-space: nowrap !important;
  transition: color 0.18s ease, transform 0.15s ease !important;
}

/* Animated bottom active/hover bar indicator - sits right beneath the text */
#hdr .nav-desk > a::after,
#hdr .nav-drop-trigger::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 2px;
  right: 2px;
  height: 2.5px;
  background: var(--tm-primary);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

#hdr .nav-desk > a:hover,
#hdr .nav-drop-trigger:hover {
  color: var(--tm-primary) !important;
  background: transparent !important;
}

#hdr .nav-desk > a:hover::after,
#hdr .nav-drop-trigger:hover::after {
  transform: scaleX(1);
}

#hdr .nav-desk > a.active,
#hdr .nav-drop-trigger.active {
  color: var(--tm-primary) !important;
  font-weight: 700 !important;
  background: transparent !important;
}

#hdr .nav-desk > a.active::after,
#hdr .nav-drop-trigger.active::after {
  transform: scaleX(1);
}

#hdr .nav-drop-trigger .chev {
  transition: transform 0.2s ease;
}

#hdr .nav-dropdown:hover .nav-drop-trigger .chev {
  transform: rotate(180deg);
}

/* ── Categories Mega-Dropdown ── */
#hdr .nav-dropdown {
  position: relative;
  height: auto;
  display: flex;
  align-items: center;
}

#hdr .nav-dropdown:hover .nav-drop-menu,
#hdr .nav-dropdown:focus-within .nav-drop-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

#hdr .nav-drop-menu {
  position: absolute;
  top: calc(100% + 14px);
  left: -20px;
  width: 480px;
  background: #ffffff;
  border: 1px solid var(--tm-border);
  border-radius: 14px;
  box-shadow: 0 16px 40px -8px rgba(15, 23, 42, 0.15), 0 0 1px rgba(15, 23, 42, 0.08);
  padding: 14px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10005;
}

/* Invisible bridge so mouse never loses hover between trigger and dropdown menu */
#hdr .nav-drop-menu::before {
  content: '';
  position: absolute;
  top: -14px;
  left: 0;
  right: 0;
  height: 14px;
}

#hdr .nav-drop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

#hdr .nav-drop-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

#hdr .nav-drop-item:hover,
#hdr .nav-drop-item.active {
  background: var(--tm-bg-subtle);
  color: var(--tm-primary);
  transform: translateX(2px);
}

#hdr .nav-drop-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--tm-primary-light);
  color: var(--tm-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.15s ease, color 0.15s ease;
}

#hdr .nav-drop-item:hover .nav-drop-icon {
  background: var(--tm-primary);
  color: #ffffff;
}

#hdr .nav-drop-footer {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--tm-border-light);
}

#hdr .nav-drop-all-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--tm-primary);
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.15s ease;
}

#hdr .nav-drop-all-link:hover {
  background: var(--tm-bg-subtle);
}

/* ── Live Search Bar (Desktop) ── */
#hdr .hdr-search {
  flex: 1;
  max-width: 300px;
  position: relative;
}

#hdr .hdr-search-form {
  position: relative;
  width: 100%;
}

#hdr .hdr-search input {
  width: 100%;
  height: 42px;
  padding: 0 42px 0 16px;
  background: var(--tm-bg-subtle);
  border: 1.5px solid var(--tm-border);
  border-radius: 50px;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--tm-dark);
  outline: none;
  transition: all 0.2s ease;
}

#hdr .hdr-search input:focus {
  border-color: var(--tm-primary);
  background: #ffffff;
  box-shadow: 0 0 0 3.5px var(--tm-primary-soft);
}

#hdr .si-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--tm-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  transition: color 0.15s;
}

#hdr .si-btn:hover {
  color: var(--tm-primary);
}

/* ── Live Search Results Dropdown ── */
.search-results,
.mob-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid var(--tm-border);
  border-radius: 12px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.12);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 10005;
  max-height: 420px;
  overflow-y: auto;
}

.search-results.show,
.mob-search-results.show {
  display: flex;
}

.sr-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  text-decoration: none;
  border-bottom: 1px solid var(--tm-border-light);
  transition: background 0.15s;
}

.sr-item:hover,
.sr-item.focused {
  background: var(--tm-bg-subtle);
}

.sr-thumb {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: contain;
  background: var(--tm-bg-subtle);
  flex-shrink: 0;
}

.sr-info {
  flex: 1;
  min-width: 0;
}

.sr-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--tm-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sr-price {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--tm-primary);
  margin-top: 2px;
}

.sr-cat-tag {
  font-size: 0.6875rem;
  background: var(--tm-bg-subtle);
  color: var(--tm-muted);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-weight: 500;
}

.sr-footer {
  padding: 10px 14px;
  background: var(--tm-bg-subtle);
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 700;
}

.sr-footer a {
  color: var(--tm-primary);
  text-decoration: none;
}

.sr-empty {
  padding: 16px;
  text-align: center;
  color: var(--tm-muted);
  font-size: 0.875rem;
}

/* ── Header Action Buttons ── */
#hdr .hdr-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

#hdr .icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--tm-bg-subtle);
  border: 1.5px solid var(--tm-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #334155;
  text-decoration: none;
  position: relative;
  transition: all 0.18s ease;
  flex-shrink: 0;
}

#hdr .icon-btn:hover {
  background: #ffffff;
  border-color: var(--tm-primary);
  color: var(--tm-primary);
  transform: translateY(-1px);
}

#hdr .user-avatar-img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
}

#hdr .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--tm-primary);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.6875rem;
  min-width: 19px;
  height: 19px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
}

#hdr .badge-wishlist {
  background: var(--tm-danger);
}

/* ── Hamburger Button ── */
#hdr .ham-toggle-btn {
  display: none;
  background: transparent;
  border: none;
  box-shadow: none;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  color: var(--tm-text, #1e293b);
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease;
  padding: 4px;
  border-radius: 8px;
  flex-shrink: 0;
}

#hdr .ham-toggle-btn:hover {
  background: var(--tm-bg-subtle);
  color: var(--tm-primary);
}

/* ── Mobile Inline Search Bar ── */
.hdr-mob-search-bar {
  display: none;
  padding: 0 0 10px;
  position: relative;
}

.hdr-mob-search-form {
  display: flex;
  align-items: center;
  position: relative;
  width: 100%;
  background: var(--tm-bg-subtle);
  border: 1.5px solid var(--tm-border);
  border-radius: 50px;
  padding: 0 6px 0 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.hdr-mob-search-form:focus-within {
  border-color: var(--tm-primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px var(--tm-primary-soft);
}

.hdr-mob-search-icon {
  color: var(--tm-muted);
  flex-shrink: 0;
  pointer-events: none;
}

.hdr-mob-search-form input {
  flex: 1;
  height: 40px;
  padding: 0 8px;
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--tm-dark);
}

.hdr-mob-search-form input::placeholder {
  color: var(--tm-muted);
}

.hdr-mob-si-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: var(--tm-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}

.hdr-mob-si-btn:hover {
  background: var(--tm-primary-dk, #0082ba);
}

#hdr-mob-search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 10010;
}

/* ══════════════════════════════════════════════
   3. MOBILE NAVIGATION DRAWER
   ══════════════════════════════════════════════ */
.mob-nav {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
}

.mob-nav.open {
  display: block;
}

.mob-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(2px);
}

.mob-drawer {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(340px, 86vw);
  background: #ffffff;
  display: flex;
  flex-direction: column;
  box-shadow: 6px 0 30px rgba(15, 23, 42, 0.2);
  transform: translateX(-100%);
  transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.mob-nav.open .mob-drawer {
  transform: translateX(0);
}

.mob-drawer-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--tm-border-light);
}

.mob-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.mob-logo img {
  height: 32px;
  width: auto;
}

.mob-close-btn {
  background: var(--tm-bg-subtle);
  border: 1px solid var(--tm-border);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tm-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.mob-close-btn:hover {
  background: #ffffff;
  color: var(--tm-danger);
}

.mob-search {
  padding: 14px 20px;
  border-bottom: 1px solid var(--tm-border-light);
  position: relative;
}

.mob-search-form {
  position: relative;
  width: 100%;
}

.mob-search input {
  width: 100%;
  height: 40px;
  padding: 0 40px 0 14px;
  border-radius: 8px;
  border: 1.5px solid var(--tm-border);
  background: var(--tm-bg-subtle);
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
}

.mob-search input:focus {
  border-color: var(--tm-primary);
  background: #ffffff;
}

.mob-si-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--tm-muted);
  cursor: pointer;
  padding: 6px;
}

.mob-nav-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
}

.mob-nav-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mob-nav-links a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9375rem;
  color: #334155;
  text-decoration: none;
  transition: all 0.15s ease;
}

.mob-nav-links a:hover,
.mob-nav-links a.active {
  background: var(--tm-bg-subtle);
  color: var(--tm-primary);
}

.mob-acc-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  background: transparent;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9375rem;
  color: #334155;
  cursor: pointer;
  transition: background 0.15s;
}

.mob-acc-trigger:hover,
.mob-acc-trigger.open {
  background: var(--tm-bg-subtle);
  color: var(--tm-primary);
}

.mob-acc-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mob-acc-arrow {
  transition: transform 0.2s ease;
}

.mob-acc-trigger.open .mob-acc-arrow {
  transform: rotate(180deg);
}

.mob-acc-content {
  display: none;
  flex-direction: column;
  padding-left: 28px;
  gap: 2px;
  margin-top: 4px;
}

.mob-acc-content.show {
  display: flex;
}

.mob-sublink {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px !important;
  font-size: 0.875rem !important;
  color: var(--tm-muted) !important;
}

.mob-sublink:hover {
  color: var(--tm-primary) !important;
}

.mob-sub-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tm-primary);
}

/* ── Mobile Account / Auth box ── */
.mob-account-box {
  background: var(--tm-bg-subtle);
  border: 1px solid var(--tm-border);
  border-radius: 12px;
  padding: 16px;
}

.mob-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--tm-border);
}

.mob-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--tm-primary);
  color: #ffffff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.mob-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mob-user-details strong {
  display: block;
  font-size: 0.875rem;
  color: var(--tm-dark);
}

.mob-user-details small {
  display: block;
  font-size: 0.75rem;
  color: var(--tm-muted);
  word-break: break-all;
}

.mob-user-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mob-user-links a {
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  text-decoration: none;
  padding: 4px 0;
}

.mob-user-links a:hover {
  color: var(--tm-primary);
}

.mob-logout-link {
  color: var(--tm-danger) !important;
  margin-top: 4px;
}

.mob-auth-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mob-btn-primary {
  display: block;
  text-align: center;
  background: var(--tm-primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.875rem;
  padding: 10px;
  border-radius: 8px;
  text-decoration: none;
}

.mob-btn-outline {
  display: block;
  text-align: center;
  background: #ffffff;
  border: 1.5px solid var(--tm-border);
  color: #334155;
  font-weight: 700;
  font-size: 0.875rem;
  padding: 9px;
  border-radius: 8px;
  text-decoration: none;
}

/* ══════════════════════════════════════════════
   4. RESPONSIVE BREAKPOINTS
   ══════════════════════════════════════════════ */
@media (max-width: 992px) {
  #hdr .nav-desk,
  #hdr .hdr-search {
    display: none !important;
  }
  #hdr .ham-toggle-btn {
    display: inline-flex !important;
  }
  .hdr-mob-search-bar {
    display: block !important;
  }
  #hdr .desk-only {
    display: none !important;
  }
  .ann-center {
    display: none !important;
  }
}

@media (max-width: 640px) {
  .ann-right {
    display: none !important;
  }
  .ann-inner {
    justify-content: center !important;
  }
  .hdr-inner {
    height: 60px !important;
  }
  #hdr .logo img {
    height: 32px !important;
  }
}
