/* ==========================================================================
   ClearMedUk - Header, Navigation Bar & Mobile Drawer Navigation
   ========================================================================== */

/* ==========================================================================
   1. Announcement Bar
   ========================================================================== */
.announcement-bar {
  background-color: var(--dark-bg);
  color: var(--dark-text);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--dark-border);
}

.announcement-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.announcement-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--secondary-color);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--secondary-color) 70%, transparent);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 color-mix(in srgb, var(--secondary-color) 70%, transparent); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(0, 0, 0, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); }
}

.announcement-phone:hover {
  color: var(--dark-heading);
}

/* ==========================================================================
   2. Sticky Main Header
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: var(--bg-main);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: all var(--transition-base);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem 1rem;
  height: 5rem;
}

.header-inner .main-nav {
  margin-left: auto;
}

.header-cta-btn {
  flex-shrink: 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  max-height: none;
}

.brand-logo svg,
.brand-logo img,
.brand-logo .custom-logo,
.site-header .brand-logo .site-brand-img {
  display: block;
  height: 48px !important;
  max-height: 48px !important;
  width: auto !important;
  max-width: 200px !important;
  object-fit: contain;
  object-position: left center;
}

/* ==========================================================================
   3. Desktop Navigation
   ========================================================================== */
.main-nav {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  position: relative;
  padding: 0.5rem 0;
}

.nav-link:hover, .nav-link.active {
  color: var(--text-main);
}

.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--brand-gradient);
  border-radius: 2px;
}

/* Header tools: search / account / cart (between menu and CTA) */
.header-tools {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.header-tool-search {
  display: inline-flex !important;
  align-items: center;
  position: relative;
  z-index: 60;
  visibility: visible !important;
  opacity: 1 !important;
  width: auto !important;
  height: auto !important;
  overflow: visible !important;
  pointer-events: auto !important;
}

.header-tool-search .als-wrap {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  z-index: 60;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.header-tool-search .als-icon-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: #ffffff;
  color: var(--dark-color);
  box-shadow: none;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  cursor: pointer;
  padding: 0;
  margin: 0;
}

.header-tool-search .als-icon-btn:hover,
.header-tool-search .als-wrap.als-is-open .als-icon-btn {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #ffffff;
}

.header-tool-search .als-panel {
  right: 0;
  left: auto;
}

.header-tool-search .als-icon-btn svg,
.header-tool-search .als-icon-svg {
  width: 14px !important;
  height: 14px !important;
}

.header-tool-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--dark-color);
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  position: relative;
}

.header-tool-link:hover,
.header-tool-link:focus {
  background: var(--bg-secondary);
  border-color: color-mix(in srgb, var(--primary-color) 35%, var(--border));
  color: var(--primary-color);
}

/* Account icon — brand gradient like primary CTAs */
.header-tool-account,
a.header-tool-link.header-tool-account.woopw-account {
  background: var(--brand-gradient) !important;
  background-image: var(--brand-gradient) !important;
  border: 1px solid color-mix(in srgb, var(--dark-color) 20%, transparent) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--primary-color) 22%, transparent);
}

.header-tool-account:hover,
.header-tool-account:focus,
a.header-tool-link.header-tool-account.woopw-account:hover,
a.header-tool-link.header-tool-account.woopw-account:focus {
  background: var(--brand-gradient-hover) !important;
  background-image: var(--brand-gradient-hover) !important;
  color: #ffffff !important;
  border-color: transparent !important;
  transform: none;
  box-shadow: 0 6px 14px color-mix(in srgb, var(--primary-color) 28%, transparent);
}

.header-tool-account svg,
.header-tool-account:hover svg,
.header-tool-account:focus svg {
  fill: #ffffff !important;
  color: #ffffff !important;
}

.header-tool-link svg {
  display: block;
  flex-shrink: 0;
  width: 15px;
  height: 15px;
}

.header-tool-cart {
  overflow: visible;
}

.header-tool-cart svg {
  width: 16px;
  height: 14px;
}

/* Compact badge — parent theme uses 25×25 / 15px which overwhelms the icon */
.site-header .header-tool-cart .header-cart-count,
.header-tools .woopw-cart .header-cart-count {
  position: absolute !important;
  top: -2px !important;
  right: -2px !important;
  left: auto !important;
  bottom: auto !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  min-width: 14px !important;
  width: auto !important;
  height: 14px !important;
  padding: 0 3px !important;
  border-radius: 9999px !important;
  background: var(--primary-color) !important;
  color: #ffffff !important;
  font-size: 9px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  text-align: center !important;
  box-sizing: border-box !important;
  z-index: 2;
  pointer-events: none;
  transform: none !important;
}

/* Parent style.css forces span.header-cart-count.d-none { display: block !important } */
.site-header .header-tool-cart .header-cart-count.is-empty,
.site-header .header-tool-cart .header-cart-count.d-none,
.site-header span.header-cart-count.is-empty,
.site-header span.header-cart-count.d-none,
.header-tools .woopw-cart .header-cart-count.is-empty,
.header-tools .woopw-cart .header-cart-count.d-none {
  display: none !important;
  visibility: hidden !important;
  width: 0 !important;
  height: 0 !important;
  min-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
}

/* Parent mobile rule prints title via a.my-basket:after — never show here */
.site-header a.my-basket::after,
.header-tools a.my-basket::after,
.header-tool-cart::after {
  content: none !important;
  display: none !important;
  padding: 0 !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

.header-tool-cart.woopw-cart,
.header-tools .woopw-cart {
  font-size: 0 !important;
  line-height: 0 !important;
  white-space: nowrap;
  overflow: visible;
}

.header-tools .woopw-cart svg {
  font-size: initial;
  line-height: normal;
}

.mobile-header-tools {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mobile-toggle {
  display: none;
  padding: 0.5rem;
  color: var(--text-main);
  border-radius: var(--radius-md);
  flex-shrink: 0;
  position: relative;
  z-index: 70;
  pointer-events: auto !important;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--border);
}

/* Mobile / tablet header — larger logo + taller bar */
@media (max-width: 1024px) {
  .site-header .header-inner {
    gap: 0.5rem;
    min-width: 0;
    height: 5.25rem !important;
    min-height: 5.25rem !important;
  }

  .site-header .brand-logo {
    min-width: 0;
    max-height: none !important;
    flex: 1 1 auto;
  }

  .site-header .brand-logo img,
  .site-header .brand-logo .site-brand-img,
  .site-header .brand-logo svg,
  .site-header .brand-logo .custom-logo,
  header.site-header a.brand-logo img {
    max-width: min(220px, 56vw) !important;
    width: auto !important;
    height: 60px !important;
    max-height: 60px !important;
    min-height: 56px !important;
  }

  .header-tools {
    margin-left: auto;
    gap: 0.4rem;
    flex-shrink: 0;
  }

  .header-tool-link,
  .header-tool-search .als-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 9999px;
    flex-shrink: 0;
  }

  .header-tool-link svg {
    width: 14px;
    height: 14px;
  }

  .header-tool-cart svg {
    width: 15px;
    height: 13px;
  }

  .header-tool-search .als-icon-btn svg,
  .header-tool-search .als-icon-svg {
    width: 14px;
    height: 14px;
  }

  .header-tool-search .als-panel {
    position: fixed;
    top: 5.75rem;
    left: 0.75rem;
    right: 0.75rem;
    width: auto;
    max-width: none;
  }

  .mobile-toggle {
    padding: 0.45rem;
    margin-left: 0.15rem;
  }

  .mobile-toggle svg {
    width: 24px;
    height: 24px;
  }
}

@media (max-width: 480px) {
  .site-header .header-inner {
    height: 5rem !important;
    min-height: 5rem !important;
  }

  .header-tools {
    gap: 0.3rem;
  }

  .header-tool-link,
  .header-tool-search .als-icon-btn {
    width: 30px;
    height: 30px;
  }

  .site-header .brand-logo img,
  .site-header .brand-logo .site-brand-img,
  .site-header .brand-logo svg,
  .site-header .brand-logo .custom-logo,
  header.site-header a.brand-logo img {
    max-width: min(210px, 54vw) !important;
    height: 56px !important;
    max-height: 56px !important;
    min-height: 52px !important;
  }
}

/* ==========================================================================
   4. Mobile Menu Drawer & Overlay
   ========================================================================== */
.mobile-menu-drawer {
  position: fixed;
  top: 0;
  right: -100%;
  width: 84%;
  max-width: 380px;
  height: 100vh;
  height: 100dvh;
  background-color: var(--bg-main);
  z-index: 2000;
  padding: 2rem;
  box-shadow: var(--shadow-xl);
  transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
}

.mobile-menu-drawer.open {
  right: 0;
}

/* Parent live-search.css hides .woo-header-search under 991px — keep ClearMed search visible */
@media (max-width: 991px) {
  .site-header .header-tool-search,
  .site-header .header-tool-search .als-wrap,
  .site-header .header-tool-search .als-icon-btn {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .site-header,
  .site-header .header-inner,
  .site-header .header-tools,
  .site-header .header-tool-search {
    overflow: visible !important;
  }

  /* Parent sets .als-panel { display:none } on mobile except old mobile-header selectors */
  .site-header .header-tool-search .als-wrap .als-panel {
    display: none !important;
  }

  .site-header .header-tool-search .als-wrap.als-is-open {
    z-index: 10000031 !important;
    position: relative !important;
  }

  .site-header .header-tool-search .als-wrap.als-is-open .als-panel,
  body.als-search-open .site-header .header-tool-search .als-wrap.als-is-open .als-panel {
    display: block !important;
    position: fixed !important;
    top: var(--als-panel-top, var(--als-header-height, 5rem)) !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    min-width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 !important;
    transform: none !important;
    z-index: 10000020 !important;
    background: #ffffff !important;
    padding: 1rem 1.1rem 1.15rem !important;
    border-radius: 0 0 1rem 1rem !important;
    box-shadow: 0 12px 32px rgba(58, 39, 67, 0.12) !important;
    border: 1px solid var(--border) !important;
    border-top: 1px solid var(--border) !important;
    box-sizing: border-box !important;
    max-height: calc(100vh - var(--als-header-height, 5rem)) !important;
    overflow-y: auto !important;
    font-size: 0.875rem !important;
    line-height: 1.4 !important;
    color: var(--dark-color) !important;
  }

  .site-header .header-tool-search .als-wrap.als-is-open .als-suggestions,
  body.als-search-open .site-header .header-tool-search .als-wrap.als-is-open .als-suggestions {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  body.als-search-open .site-header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 10000030 !important;
    background: var(--bg-main) !important;
  }

  body.als-search-open {
    padding-top: var(--als-header-height, 5rem);
  }
}

.mobile-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 1999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.3s ease;
}

.mobile-backdrop.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.mobile-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.mobile-nav-links {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.mobile-nav-link {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-main);
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-light);
}

.mobile-nav-link.active {
  color: var(--primary-color);
}
