/* Tony & Johnny — Header Styles (Phase 5A) */
/* Topbar · main header · desktop mega nav · mobile drawer */

/* ── Topbar ────────────────────────────────────────────────────────────────── */

.tj-topbar {
  background-color: var(--tj-dark);
  color: rgba(255, 255, 255, 0.85);
  padding: 7px 0;
  font-size: 0.82rem;
}

.tj-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  max-width: var(--tj-max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.tj-topbar a           { color: var(--tj-whatsapp); font-weight: 700; }
.tj-topbar a:hover     { color: #fff; }

/* ── Main Header ───────────────────────────────────────────────────────────── */

.tj-header {
  background: #fff;
  border-bottom: 1px solid var(--tj-border);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: box-shadow var(--tj-transition);
}
.tj-header.scrolled {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.tj-header-main {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  max-width: var(--tj-max-width);
  margin: 0 auto;
  min-height: 112px;
}

/* ── Logo ──────────────────────────────────────────────────────────────────── */

.tj-logo {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  color: var(--tj-coral);
  flex-shrink: 0;
  text-decoration: none;
  transition: color var(--tj-transition);
}
.tj-logo:hover { color: var(--tj-coral-dark); }

.tj-logo-img {
  width: auto;
  height: 100px;
  display: block;
  flex-shrink: 0;
  object-fit: contain;
}

/* Higher specificity to beat Astra's .woocommerce-page img { height: auto } (0,1,1) */
.tj-logo .tj-logo-img {
  height: 100px;
  width: auto;
  max-width: none;
  object-fit: contain;
}

.tj-logo-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.tj-logo-name {
  font-family: var(--tj-font-head);
  font-weight: 900;
  font-size: 1.2rem;
  line-height: 1;
  white-space: nowrap;
}

.tj-logo-tagline {
  font-family: var(--tj-font-body);
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--tj-text-muted);
  letter-spacing: 0.3px;
  white-space: nowrap;
  transition: color var(--tj-transition);
}
.tj-logo:hover .tj-logo-tagline { color: var(--tj-coral-dark); }

@media (max-width: 921px) {
  .tj-logo-img,
  .tj-logo .tj-logo-img { height: 66px; }
  .tj-logo-name { font-size: 1.05rem; }
}

/* ── Search ────────────────────────────────────────────────────────────────── */

.tj-search {
  flex: 1;
  display: flex;
  align-items: center;
  background: #fff;
  border: 1.5px solid var(--tj-border);
  border-radius: 50px;
  overflow: hidden;
  max-width: 540px;
  transition: border-color var(--tj-transition);
}
.tj-search:focus-within { border-color: var(--tj-coral); }

.tj-search input[type="search"] {
  flex: 1;
  border: none;
  outline: none;
  padding: 10px 18px;
  font-family: var(--tj-font-body);
  font-size: 0.9rem;
  background: transparent;
  direction: rtl;
  min-width: 0;
}

.tj-search button[type="submit"] {
  background: var(--tj-coral);
  color: #fff;
  border: none;
  padding: 0 18px;
  height: 44px;
  cursor: pointer;
  font-size: 1rem;
  flex-shrink: 0;
  transition: background var(--tj-transition);
}
.tj-search button[type="submit"]:hover { background: var(--tj-coral-dark); }

/* ── Header Actions (cart, account) ───────────────────────────────────────── */

.tj-header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.tj-header-actions a {
  color: var(--tj-dark);
  font-size: 1.6rem;
  position: relative;
  line-height: 1;
}
.tj-header-actions a:hover { color: var(--tj-coral); }

.tj-cart-count {
  position: absolute;
  top: -9px;
  left: -9px;
  background: var(--tj-coral);
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 0.73rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--tj-font-body);
  line-height: 1;
}

@keyframes tj-cart-pulse {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.4); }
  55%  { transform: scale(1); }
  80%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.tj-cart-bounce .tj-cart-count {
  animation: tj-cart-pulse 0.55s ease;
}

/* ── Desktop Mega Nav ──────────────────────────────────────────────────────── */

.tj-mega-nav {
  background: var(--tj-coral);
  border-radius: 0 0 10px 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  position: relative;
  overflow: visible;                /* allow mega panel to escape below */
  z-index: 999;
}

.tj-mega-nav-inner {
  display: flex;
  align-items: stretch;
  max-width: var(--tj-max-width);
  margin: 0 auto;
  padding: 0 20px;
  position: relative;               /* mega panels position to this container */
  overflow: visible;
}

/* Hide horizontal scroll chrome */
.tj-mega-nav-inner::-webkit-scrollbar { display: none; }

/* ── Mega menu list ── */

.tj-mega-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;          /* centered categories */
  width: 100%;
  gap: 4px;
}

/* ── Individual item ── */

.tj-mega-item {
  display: flex;
  align-items: stretch;
  position: static;                 /* panel positions to tj-mega-nav-inner */
}

/* ── Category link ── */

.tj-mega-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 10px 18px;
  white-space: nowrap;
  border-radius: 6px;
  transition: background var(--tj-transition);
  cursor: pointer;
}

.tj-mega-link:hover,
.tj-mega-item.tj-has-mega:hover   > .tj-mega-link,
.tj-mega-item.tj-has-mega:focus-within > .tj-mega-link {
  background: rgba(0, 0, 0, 0.18);
  color: #fff;
}

.tj-mega-link .tj-cat-icon {
  font-size: 1.05em;
  line-height: 1;
}

/* ── Mega panel (desktop dropdown) ── */

.tj-mega-panel {
  position: absolute;
  top: 100%;                        /* flush below tj-mega-nav-inner */
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.13);
  z-index: 998;

  /* Hidden by default — transition via opacity+visibility (not display) */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}

/* Show on item hover or keyboard focus-within */
.tj-mega-item.tj-has-mega:hover       .tj-mega-panel,
.tj-mega-item.tj-has-mega:focus-within .tj-mega-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.tj-mega-panel-body {
  padding: 18px 24px;
}

/* ── Subcategory list ── */

.tj-mega-sub {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.tj-mega-sub li a {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--tj-text);
  font-size: 0.9rem;
  padding: 7px 14px;
  border-radius: 6px;
  white-space: nowrap;
  transition: background var(--tj-transition), color var(--tj-transition);
}

.tj-mega-sub li a:hover {
  background: var(--tj-cream);
  color: var(--tj-coral);
}

.tj-mega-sub .tj-cat-icon {
  font-size: 1em;
  line-height: 1;
}

/* ── Hamburger ─────────────────────────────────────────────────────────────── */

.tj-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
  background: none;
  border: none;
}

.tj-hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--tj-dark);
  border-radius: 2px;
  transition: all 0.28s;
}

/* ── Mobile Nav Drawer ─────────────────────────────────────────────────────── */

.tj-mobile-nav {
  background: var(--tj-dark);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.32s ease;
}

.tj-mobile-nav.open {
  max-height: 80vh;
  overflow-y: auto;
  padding: 8px 0 16px;
}

/* List resets */
.tj-mobile-nav-menu,
.tj-mobile-sub {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ── Mobile item row (link + optional toggle button) ── */

.tj-mobile-item-row {
  display: flex;
  align-items: center;
}

.tj-mobile-link {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 11px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: color var(--tj-transition);
}
.tj-mobile-link:hover  { color: #fff; }
.tj-mobile-link .tj-cat-icon { font-size: 1em; }

/* Last item in a group: no border when sub is closed */
.tj-mobile-item:last-child > .tj-mobile-item-row .tj-mobile-link {
  border-bottom-color: transparent;
}
.tj-mobile-item.tj-mobile-has-sub > .tj-mobile-item-row .tj-mobile-link {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

/* ── Sub-category toggle button ── */

.tj-sub-toggle {
  flex-shrink: 0;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 11px 20px 11px 12px;
  font-size: 1rem;
  line-height: 1;
  transition: transform 0.22s ease, color var(--tj-transition);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.tj-sub-toggle:hover           { color: #fff; }
.tj-mobile-item.is-open .tj-sub-toggle { transform: rotate(180deg); }

/* ── Mobile sub-category list ── */

.tj-mobile-sub {
  padding-inline-start: 0;
  background: rgba(0, 0, 0, 0.18);
}

.tj-mobile-sub-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.9rem;
  padding: 9px 20px 9px 36px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  transition: color var(--tj-transition);
}
.tj-mobile-sub-link:hover { color: #fff; }
.tj-mobile-sub li:last-child .tj-mobile-sub-link { border-bottom: none; }

/* ── Responsive ────────────────────────────────────────────────────────────── */

@media (max-width: 921px) {
  .tj-topbar    { display: none; }
  .tj-mega-nav  { display: none; }   /* hidden on mobile — drawer takes over */
  .tj-search    { display: none; }
  .tj-hamburger { display: flex; }

  .tj-header-main {
    padding: 8px 16px;
    min-height: 56px;
  }
}

/* TJ desktop nav - ZooStore-inspired orange pill */
.tj-mega-nav {
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  padding: 12px 0 10px;
}

.tj-mega-nav-inner {
  justify-content: center;
  padding: 0 20px;
}

.tj-mega-menu {
  width: auto;
  min-height: 72px;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0 34px;
  background: #E07862;
  border-radius: 999px;
  box-shadow: 0 10px 26px rgba(44, 24, 16, 0.18);
  overflow: hidden;
}

.tj-mega-item {
  position: relative;
}

.tj-mega-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 1px;
  background: rgba(255, 255, 255, 0.48);
}

.tj-mega-link {
  min-height: 72px;
  padding: 0 30px;
  gap: 12px;
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
}

.tj-mega-link .tj-cat-icon {
  font-size: 1.45em;
  line-height: 1;
}

.tj-mega-link:hover,
.tj-mega-link:focus {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

@media (max-width: 1200px) {
  .tj-mega-menu { min-height: 64px; padding: 0 20px; }
  .tj-mega-link { min-height: 64px; padding: 0 20px; font-size: 1.15rem; }
}


/* TJ single combined brand logo */
.tj-logo--single {
  gap: 0;
  align-items: center;
  flex-shrink: 0;
}

.tj-logo--single .tj-logo-img--single {
  display: block;
  width: auto;
  height: 108px;
  max-width: 420px;
  object-fit: contain;
}

@media (max-width: 1200px) {
  .tj-logo--single .tj-logo-img--single {
    height: 92px;
    max-width: 360px;
  }
}

@media (max-width: 768px) {
  .tj-logo--single .tj-logo-img--single {
    height: 72px;
    max-width: 280px;
  }
}


/* TJ peach pink header nav overrides */
.tj-mega-menu {
  background: #F7C7C2 !important;
  border: 2px solid #111111 !important;
  box-shadow: 0 10px 26px rgba(17, 17, 17, 0.16);
}

.tj-mega-item:not(:last-child)::after {
  background: #111111 !important;
  opacity: 1;
}

.tj-mega-link {
  color: #3B241A !important;
  text-shadow: none !important;
}

.tj-mega-link:hover,
.tj-mega-link:focus {
  background: #111111 !important;
  color: #ffffff !important;
}


/* TJ header category animal photo icons */
.tj-site-header .tj-cat-icon--photo { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; font-size: 0; line-height: 1; vertical-align: middle; }
.tj-site-header .tj-cat-icon--photo img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }


/* TJ header animal hover animation test */
.tj-mega-link .tj-cat-icon--photo img {
  transition: transform 180ms ease, filter 180ms ease;
  transform-origin: center bottom;
}

.tj-mega-link:hover .tj-cat-icon--photo img,
.tj-mega-link:focus .tj-cat-icon--photo img {
  transform: translateY(-4px) rotate(-3deg) scale(1.08);
  filter: drop-shadow(0 6px 7px rgba(17, 17, 17, 0.18));
}

@media (prefers-reduced-motion: reduce) {
  .tj-mega-link .tj-cat-icon--photo img {
    transition: none;
  }

  .tj-mega-link:hover .tj-cat-icon--photo img,
  .tj-mega-link:focus .tj-cat-icon--photo img {
    transform: none;
  }
}

/* TJ remove black hover from header animal nav */
.tj-mega-link:hover,
.tj-mega-link:focus {
  background: transparent !important;
  color: #3B241A !important;
}

.tj-mega-link:hover .tj-cat-label,
.tj-mega-link:focus .tj-cat-label {
  color: #3B241A !important;
}

/* TJ account text beside icon */
.tj-header-account {
  display: inline-flex !important;
  align-items: center;
  gap: 9px;
  text-decoration: none !important;
}

.tj-account-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  line-height: 1.1;
  color: #3B241A;
  font-size: 0.86rem;
  white-space: nowrap;
}

.tj-account-hello {
  font-weight: 500;
}

.tj-account-login {
  font-weight: 700;
}
