/**
 * THE CONNECTED HAVEN - HEADER STYLES
 *
 * Header, navigation, mobile menu, and search modal styles
 *
 * @package Blocksy_Child_TCH
 * @version 1.0.0
 */

/* ==========================================================================
   HEADER CONTAINER
   ========================================================================== */

.tch-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--tch-white);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
  transition: all var(--transition-base);
}

.tch-header.is-scrolled {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.tch-header.is-hidden {
  transform: translateY(-100%);
}

.tch-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
  gap: var(--space-lg);
}

/* ==========================================================================
   LOGO / BRAND
   ========================================================================== */

.tch-header__brand {
  flex-shrink: 0;
}

.tch-header__logo {
  display: flex;
  align-items: center;
}

.tch-header__logo img {
  height: 40px;
  width: auto;
}

/* ==========================================================================
   PRIMARY NAVIGATION
   ========================================================================== */

.tch-header__nav {
  flex: 1;
  display: flex;
  justify-content: center;
}

.tch-nav-menu {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  list-style: none;
  margin: 0;
  padding: 0;
}

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

.tch-nav-menu > li > a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  color: var(--tch-text);
  font-weight: 500;
  font-size: 0.9375rem;
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
}

.tch-nav-menu > li > a:hover,
.tch-nav-menu > li.current-menu-item > a {
  color: var(--tch-primary);
  background: rgba(37, 99, 235, 0.05);
}

/* Dropdown arrow for parent items */
.tch-nav-menu > li.menu-item-has-children > a::after {
  content: '';
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
  opacity: 0.5;
  transition: transform var(--transition-base);
}

.tch-nav-menu > li.menu-item-has-children:hover > a::after {
  transform: rotate(180deg);
}

/* ==========================================================================
   DROPDOWN MENUS
   ========================================================================== */

.tch-nav-menu .sub-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  min-width: 220px;
  background: var(--tch-white);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  list-style: none;
  padding: var(--space-sm);
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.tch-nav-menu > li:hover > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.tch-nav-menu .sub-menu li {
  margin: 0;
}

.tch-nav-menu .sub-menu a {
  display: block;
  padding: 10px 16px;
  color: var(--tch-text);
  font-size: 0.9375rem;
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
}

.tch-nav-menu .sub-menu a:hover {
  color: var(--tch-primary);
  background: var(--tch-light);
}

/* Nested dropdowns */
.tch-nav-menu .sub-menu .sub-menu {
  position: absolute;
  top: 0;
  left: 100%;
  transform: translateX(10px) translateY(0);
}

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

/* ==========================================================================
   HEADER ACTIONS
   ========================================================================== */

.tch-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-shrink: 0;
}

.tch-header__search-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--tch-light);
  border: none;
  border-radius: var(--radius-md);
  color: var(--tch-text);
  cursor: pointer;
  transition: all var(--transition-base);
}

.tch-header__search-toggle:hover {
  background: var(--tch-primary);
  color: var(--tch-white);
}

.tch-header__cta {
  display: none;
}

@media (min-width: 1024px) {
  .tch-header__cta {
    display: inline-flex;
  }
}

/* ==========================================================================
   MOBILE MENU TOGGLE
   ========================================================================== */

.tch-header__mobile-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
}

@media (min-width: 1024px) {
  .tch-header__mobile-toggle {
    display: none;
  }
}

.tch-hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 24px;
}

.tch-hamburger span {
  display: block;
  height: 2px;
  background: var(--tch-dark);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.tch-hamburger span:nth-child(1) {
  width: 100%;
}

.tch-hamburger span:nth-child(2) {
  width: 75%;
}

.tch-hamburger span:nth-child(3) {
  width: 50%;
}

/* Active state */
.tch-header__mobile-toggle[aria-expanded="true"] .tch-hamburger span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.tch-header__mobile-toggle[aria-expanded="true"] .tch-hamburger span:nth-child(2) {
  opacity: 0;
}

.tch-header__mobile-toggle[aria-expanded="true"] .tch-hamburger span:nth-child(3) {
  width: 100%;
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ==========================================================================
   MOBILE NAVIGATION
   ========================================================================== */

.tch-mobile-nav {
  position: fixed;
  top: 80px;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--tch-white);
  z-index: 999;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.tch-mobile-nav[aria-hidden="false"] {
  transform: translateX(0);
}

.tch-mobile-nav__inner {
  padding: var(--space-lg);
}

.tch-mobile-menu {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-xl);
}

.tch-mobile-menu li {
  border-bottom: 1px solid var(--tch-light);
}

.tch-mobile-menu li:last-child {
  border-bottom: none;
}

.tch-mobile-menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0;
  color: var(--tch-text);
  font-weight: 500;
  font-size: 1rem;
  text-decoration: none;
}

.tch-mobile-menu a:hover {
  color: var(--tch-primary);
}

.tch-mobile-menu .sub-menu {
  list-style: none;
  padding: 0 0 0 var(--space-lg);
  margin: 0;
}

.tch-mobile-menu .sub-menu a {
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--tch-muted);
}

.tch-mobile-nav__cta {
  padding-top: var(--space-lg);
  border-top: 1px solid var(--tch-light);
}

@media (min-width: 1024px) {
  .tch-mobile-nav {
    display: none;
  }
}

/* Hide desktop nav on mobile */
@media (max-width: 1023px) {
  .tch-header__nav {
    display: none;
  }
}

/* ==========================================================================
   SEARCH MODAL
   ========================================================================== */

.tch-search-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 120px var(--space-lg) var(--space-lg);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.tch-search-modal[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
}

.tch-search-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(4px);
}

.tch-search-modal__content {
  position: relative;
  width: 100%;
  max-width: 640px;
  transform: translateY(-20px);
  transition: transform 0.3s ease;
}

.tch-search-modal[aria-hidden="false"] .tch-search-modal__content {
  transform: translateY(0);
}

.tch-search-form {
  display: flex;
  background: var(--tch-white);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.tch-search-form__input {
  flex: 1;
  padding: var(--space-lg) var(--space-xl);
  border: none;
  font-size: 1.125rem;
  color: var(--tch-text);
  background: transparent;
}

.tch-search-form__input::placeholder {
  color: var(--tch-muted);
}

.tch-search-form__input:focus {
  outline: none;
}

.tch-search-form__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  background: var(--tch-primary);
  border: none;
  color: var(--tch-white);
  cursor: pointer;
  transition: background var(--transition-base);
}

.tch-search-form__btn:hover {
  background: var(--tch-primary-dark);
}

.tch-search-modal__close {
  position: absolute;
  top: -60px;
  right: 0;
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: var(--radius-full);
  color: var(--tch-white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
}

.tch-search-modal__close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

/* ==========================================================================
   BUTTON VARIANTS FOR HEADER
   ========================================================================== */

.tch-btn-sm {
  padding: 8px 16px;
  font-size: 0.875rem;
}

.tch-btn-block {
  display: block;
  width: 100%;
  text-align: center;
}

/* ==========================================================================
   RESPONSIVE ADJUSTMENTS
   ========================================================================== */

@media (max-width: 639px) {
  .tch-header__inner {
    height: 64px;
  }

  .tch-header__logo img {
    height: 32px;
  }

  .tch-mobile-nav {
    top: 64px;
  }
}
