/* ==========================================================================
   Header, Navigation & Footer Styles
   ========================================================================== */

/* Topbar */
.site-topbar {
  background: var(--primary-dark);
  color: #cbd5e1;
  font-size: 0.8125rem;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.topbar-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.topbar-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #e2e8f0;
}

.topbar-item a {
  color: #ffffff;
}

.topbar-item a:hover {
  color: var(--accent);
}

.topbar-item svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
}

.topbar-highlight {
  color: var(--accent);
  font-weight: 700;
}

@media (max-width: 768px) {
  .site-topbar { display: none; }
}

/* Main Header */
.site-header {
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(79, 1, 107, 0.08);
  transition: var(--transition);
}

.header-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
  gap: 24px;
}

/* ---------- BUDDY PACKAGING LOGO ----------
   --s  = size of the cube; scales the whole lockup
   --ink = brand colour
------------------------------------------- */

.bp-logo {
  --s: 44px;
  --ink: var(--primary, #4F016B);
  --stroke: calc(var(--s) * 0.125);
  --radius: calc(var(--s) * 0.18);

  display: inline-flex;
  align-items: center;
  gap: calc(var(--s) * 0.28);
  font-family: "Poppins", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  user-select: none;
  text-decoration: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.bp-logo:hover {
  opacity: 0.92;
}

.bp-logo--sm {
  --s: 34px;
}

.bp-logo--light {
  --ink: #ffffff;
}

.bp-logo--light .bp-word i {
  color: var(--accent);
}

.bp-mark {
  width: var(--s);
  height: var(--s);
  margin: calc(var(--s) * 0.06) 0;
  flex: none;
}

.bp-cube {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform: rotateX(-28deg) rotateY(-45deg);
}

.bp-face {
  position: absolute;
  inset: 0;
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  backface-visibility: hidden;
}

.bp-face--left  { transform: translateZ(calc(var(--s) / 2)) scale(0.9); }
.bp-face--right { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)) scale(0.9); }
.bp-face--top   { transform: rotateX(90deg) translateZ(calc(var(--s) / 2)) scale(0.9); }

.bp-face span {
  font-weight: 800;
  font-size: calc(var(--s) * 0.52);
  line-height: 1;
  letter-spacing: -0.02em;
  margin-top: calc(var(--s) * -0.02);
  color: var(--ink);
}

.bp-face--top::after {
  content: "";
  width: 42%;
  height: 42%;
  border: calc(var(--stroke) * 0.7) solid var(--ink);
  border-radius: calc(var(--radius) * 0.35);
  transform: rotate(45deg);
}

.bp-word {
  display: flex;
  flex-direction: column;
  line-height: 0.92;
}

.bp-word b {
  font-weight: 800;
  font-size: calc(var(--s) * 0.62);
  letter-spacing: -0.015em;
  color: var(--ink);
}

.bp-word i {
  font-style: normal;
  font-weight: 600;
  font-size: calc(var(--s) * 0.315);
  letter-spacing: 0.055em;
  margin-top: calc(var(--s) * 0.05);
  color: var(--ink);
}

.site-logo {
  display: flex;
  align-items: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.03em;
  text-decoration: none;
}

.site-logo span {
  color: var(--accent);
}

.site-logo img {
  height: 48px;
  width: auto;
}

/* Navigation Menu */
.main-navigation {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-menu > li {
  position: relative;
}

.nav-menu > li > a {
  color: var(--primary);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 28px 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.nav-menu > li > a:hover {
  color: var(--primary-light);
}

.nav-menu > li.has-dropdown > a::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-top: -3px;
  transition: transform 0.2s ease;
}

.nav-menu > li.has-dropdown:hover > a::after {
  transform: rotate(-135deg);
}

/* Dropdown / Mega Menu */
.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  background: #ffffff;
  min-width: 260px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-color);
  padding: 12px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: var(--transition);
  z-index: 1010;
}

.nav-menu > li:hover .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  color: #000000;
  font-size: 0.9rem;
  font-weight: 600;
}

.nav-dropdown li a:hover {
  background: #fbf5ff;
  color: var(--primary);
  padding-left: 24px;
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--primary);
}

/* Menu item helpers (previously inline styles in header.php) */
.nav-dropdown-count {
  font-size: 0.75rem;
  color: #94a3b8;
}

.nav-dropdown .nav-dropdown-all {
  font-weight: 700;
  color: var(--primary, #4F016B);
  border-top: 1px solid #f1f5f9;
  margin-top: 4px;
}

.nav-menu > li > a.nav-item-featured {
  color: var(--primary, #4F016B);
  font-weight: 700;
}

.nav-menu .nav-badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  margin-left: 3px;
}

/* --------------------------------------------------------------------------
   Header navigation across breakpoints.

     > 1024px : full desktop nav with hover dropdowns
     741-1024 : same nav, one row, tightened, hover dropdowns suppressed
     <= 740px : hamburger + drawer only

   Phones get the drawer and nothing else. Showing the inline menu there as
   well meant two competing menus: the drawer overlaid a header row that had
   wrapped onto several clipped lines behind it.
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .header-wrapper { gap: 16px; }

  .main-navigation {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center;
    gap: 0;
  }

  .nav-menu {
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .nav-menu::-webkit-scrollbar { display: none; }

  .nav-menu > li { flex: 0 0 auto; }

  .nav-menu > li > a {
    white-space: nowrap;
    font-size: 0.9rem;
    padding: 26px 8px;
  }

  /* No hover dropdowns on touch - the parent link goes to the page. */
  .nav-menu > li.has-dropdown > a::after { display: none; }
  .nav-dropdown { display: none !important; }

  /* Topbar gets tight well before it is hidden at 768px. */
  .site-topbar { font-size: 0.75rem; }
  .topbar-left,
  .topbar-right { gap: 12px; }
  .topbar-item { white-space: nowrap; }
}

@media (max-width: 900px) {
  /* Drop the email first - the phone number and the delivery promise matter
     more, and all three no longer fit on one line. */
  .topbar-left .topbar-item + .topbar-item { display: none; }
}

@media (max-width: 740px) {
  .main-navigation { display: none; }
  .mobile-menu-toggle { display: block; }
  .header-wrapper { height: 72px; }
}

/* --------------------------------------------------------------------------
   WordPress admin bar. The header is sticky, so without this it slides under
   the admin bar for logged-in users.
   -------------------------------------------------------------------------- */
.admin-bar .site-header { top: 32px; }

@media (max-width: 782px) {
  .admin-bar .site-header { top: 46px; }
}


/* Mobile Drawer */
.mobile-drawer {
  position: fixed;
  inset: 0;
  background: rgba(79, 1, 107, 0.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.mobile-drawer.active {
  opacity: 1;
  visibility: visible;
}

.mobile-drawer-inner {
  position: absolute;
  top: 0;
  right: 0;
  width: 320px;
  height: 100%;
  background: #ffffff;
  padding: 30px 24px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.mobile-drawer.active .mobile-drawer-inner {
  transform: translateX(0);
}

.mobile-nav-list li {
  border-bottom: 1px solid var(--border-color);
}

.mobile-nav-list li a {
  display: block;
  padding: 14px 0;
  font-weight: 700;
  color: var(--primary);
  font-size: 1rem;
}

/* Footer Styles */
.site-footer {
  background: var(--primary-dark);
  color: #cbd5e1;
  padding-top: 80px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-top-grid {
  display: grid;
  grid-template-columns: 1.8fr 1fr 1fr 1fr 1.4fr;
  gap: 36px;
  padding-bottom: 60px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

@media (max-width: 1200px) {
  /* Brand block takes the full first row, link columns share the second. */
  .footer-top-grid { grid-template-columns: repeat(4, 1fr); }
  .footer-top-grid > .footer-col:first-child { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .footer-top-grid { grid-template-columns: 1fr 1fr; }
  .footer-top-grid > .footer-col:first-child { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .footer-top-grid { grid-template-columns: 1fr; }
}

.footer-col h4 {
  color: #ffffff;
  font-size: 1.1rem;
  margin-bottom: 20px;
  font-weight: 700;
}

.footer-col ul {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-col ul li a {
  color: #cbd5e1;
  font-size: 0.9rem;
  transition: var(--transition);
}

.footer-col ul li a:hover {
  color: var(--accent);
  padding-left: 4px;
}

.footer-certifications {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.cert-badge {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: #f1f5f9;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.footer-bottom {
  padding: 30px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
  color: #94a3b8;
}

.footer-bottom a {
  color: #cbd5e1;
}

.footer-bottom a:hover {
  color: var(--accent);
}

@media (max-width: 768px) {
  .footer-bottom {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }
}

/* ==========================================================================
   Header Search Icon Button & AJAX Live Search Modal
   ========================================================================== */

.header-search-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full, 9999px);
  background: var(--bg-subtle, #fbf5ff);
  border: 1.5px solid var(--border-color, #e5e7eb);
  color: var(--primary, #4F016B);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.header-search-icon-btn:hover {
  background: var(--primary, #4F016B);
  color: #ffffff;
  border-color: var(--primary, #4F016B);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 1, 107, 0.2);
}

.header-search-icon-btn svg {
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease;
}

.header-search-icon-btn:hover svg {
  transform: scale(1.08);
}

/* Full-screen Backdrop Overlay for AJAX Search */
.bp-search-modal-overlay {
  position: fixed;
  inset: 0;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(35, 0, 50, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 999999;
  padding: 100px 20px 40px 20px;
  overflow-y: auto;
  opacity: 0;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.bp-search-modal-overlay.active,
.bp-search-modal-overlay[style*="display: flex"] {
  display: flex !important;
  opacity: 1;
}

/* AJAX Search Modal Content */
.bp-search-modal-content {
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  background: #ffffff;
  border-radius: var(--radius-lg, 16px);
  box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(79, 1, 107, 0.12);
  border: 1px solid rgba(79, 1, 107, 0.12);
  padding: 0 !important;
  overflow: hidden;
  position: relative;
  animation: bpModalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes bpModalPop {
  0% { transform: scale(0.95) translateY(-10px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.bp-search-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  background: #ffffff;
}

.bp-search-form {
  flex: 1;
  margin: 0;
}

.bp-search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.bp-search-input-icon {
  position: absolute;
  left: 14px;
  color: var(--primary, #4F016B);
  pointer-events: none;
}

.bp-search-input {
  width: 100%;
  padding: 14px 44px 14px 44px;
  font-size: 1.05rem;
  font-weight: 500;
  color: #000000;
  background: #fbf5ff;
  border: 2px solid transparent;
  border-radius: var(--radius-md, 10px);
  outline: none;
  font-family: inherit;
  transition: all 0.2s ease;
}

.bp-search-input:focus {
  background: #ffffff;
  border-color: var(--primary, #4F016B);
  box-shadow: 0 0 0 3px rgba(79, 1, 107, 0.12);
}

.bp-search-input::placeholder {
  color: #71717a;
  font-weight: 400;
}

.bp-search-clear-btn {
  position: absolute;
  right: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e4e4e7;
  color: #52525b;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.15s ease;
}

.bp-search-clear-btn:hover {
  background: #d4d4d8;
  color: #18181b;
}

.bp-search-spinner {
  position: absolute;
  right: 44px;
  width: 18px;
  height: 18px;
  border: 2px solid #e9d5ff;
  border-top-color: var(--primary, #4F016B);
  border-radius: 50%;
  animation: bpSpin 0.6s linear infinite;
}

@keyframes bpSpin {
  to { transform: rotate(360deg); }
}

.bp-search-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm, 6px);
  border: none;
  background: transparent;
  color: #71717a;
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.bp-search-close-btn:hover {
  background: #f4f4f5;
  color: #000000;
}

/* Results Dropdown */
.bp-search-results {
  max-height: 420px;
  overflow-y: auto;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  background: #ffffff;
}

.bp-search-results-list {
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bp-search-result-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-md, 8px);
  text-decoration: none;
  color: inherit;
  transition: all 0.15s ease;
  background: transparent;
}

.bp-search-result-item:hover,
.bp-search-result-item.active {
  background: #fbf5ff;
  transform: translateX(3px);
}

.bp-search-result-thumb {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm, 6px);
  background: #f4f4f5;
  border: 1px solid var(--border-color, #e5e7eb);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bp-search-result-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bp-search-result-content {
  flex: 1;
  min-width: 0;
}

.bp-search-result-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.bp-search-result-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #000000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bp-search-highlight {
  background: #fef08a;
  color: #000000;
  padding: 0 2px;
  border-radius: 2px;
  font-weight: 800;
}

.bp-search-type-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  flex-shrink: 0;
}

.bp-search-result-meta {
  font-size: 0.8rem;
  color: #525252;
}

.bp-search-result-arrow {
  color: #a1a1aa;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.bp-search-result-item:hover .bp-search-result-arrow,
.bp-search-result-item.active .bp-search-result-arrow {
  color: var(--primary, #4F016B);
  transform: translateX(2px);
}

.bp-search-results-bottom {
  padding: 10px 16px;
  background: #faf5ff;
  border-top: 1px solid #f3e8ff;
  text-align: center;
}

.bp-search-view-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary, #4F016B);
  text-decoration: none;
}

.bp-search-view-all:hover {
  text-decoration: underline;
}

.bp-search-empty-state {
  padding: 36px 20px;
  text-align: center;
}

.bp-search-empty-icon {
  font-size: 2.2rem;
  margin-bottom: 8px;
}

.bp-search-empty-state h4 {
  font-size: 1.1rem;
  color: var(--primary, #4F016B);
  margin-bottom: 6px;
}

.bp-search-empty-state p {
  font-size: 0.875rem;
  color: #525252;
  max-width: 440px;
  margin: 0 auto;
}

/* Modal Footer */
.bp-search-footer {
  padding: 14px 20px;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.bp-search-popular-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.bp-search-popular-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #525252;
}

.bp-search-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.bp-search-hints {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.75rem;
  color: #71717a;
}

.bp-search-hints kbd {
  background: #ffffff;
  border: 1px solid #d4d4d8;
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 0.7rem;
  font-family: inherit;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
}

@media (max-width: 640px) {
  .bp-search-hints { display: none; }
}
