/* Header & Navigation Styles */

/* ===== TOP BAR ===== */

.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background-color: var(--color-primary-black);
  color: var(--color-primary-white);
  z-index: calc(var(--z-index-sticky) + 1);
  height: 40px;
}

.top-bar-container {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
  height: 100%;
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0;
}

.top-bar-item {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 0 var(--spacing-lg);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  transition: background-color var(--transition-fast);
  text-decoration: none;
  color: var(--color-primary-white);
  font-size: 0.875rem;
  font-weight: var(--font-weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
}

.top-bar-item:last-child {
  border-right: none;
}

.top-bar-item:hover {
  background-color: var(--color-tjm-yellow);
  color: var(--color-primary-black);
}

.top-bar-item-icon {
  margin-right: var(--spacing-xs);
  font-size: 1.125rem;
}

@media (max-width: 767px) {
  .top-bar {
    height: 35px;
  }

  .top-bar-item {
    padding: 0 var(--spacing-sm);
    font-size: 0.75rem;
  }

  .top-bar-item-text {
    display: none;
  }

  .top-bar-item-icon {
    margin-right: 0;
    font-size: 1rem;
  }
}

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

.header {
  position: fixed;
  top: 40px;
  left: 0;
  right: 0;
  background-color: var(--color-light-gray);
  box-shadow: var(--shadow-small);
  z-index: var(--z-index-sticky);
  transition: all var(--transition-base);
}

@media (max-width: 767px) {
  .header {
    top: 35px;
  }
}

.header.scrolled {
  box-shadow: var(--shadow-medium);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 var(--spacing-md);
  max-width: var(--container-max-width);
  margin: 0 auto;
  transition: height var(--transition-base);
}

.header.scrolled .header-container {
  height: var(--header-height-scrolled);
}

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

.logo {
  display: flex;
  align-items: center;
  z-index: 1001;
}

.logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.logo-image {
  height: 50px;
  width: auto;
  transition: height var(--transition-base);
}

.header.scrolled .logo-image {
  height: 40px;
}

.logo-text {
  margin-left: var(--spacing-sm);
  font-size: var(--font-size-h5);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary-black);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.nav {
  display: flex;
  align-items: center;
  gap: 1.25rem; /* Reduced from 32px to 20px for more compact layout */
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 1.25rem; /* Reduced from 32px to 20px for more compact layout */
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: block;
  padding: var(--spacing-xs) 0.75rem; /* Reduced horizontal padding from 16px to 12px */
  font-size: 0.875rem; /* Reduced from 16px to 14px for more compact layout */
  font-weight: var(--font-weight-medium);
  color: var(--color-primary-black);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: color var(--transition-fast);
  position: relative;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(252, 238, 35, 0.3);
  touch-action: manipulation;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background-color: var(--color-tjm-yellow);
  transition: width var(--transition-base), left var(--transition-base);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
  left: 0;
}

.nav-link:hover {
  color: var(--color-tjm-yellow);
}

.nav-link.active {
  color: var(--color-primary-black);
  font-weight: var(--font-weight-semibold);
}

/* CTA Button in Nav */
.nav-cta {
  margin-left: var(--spacing-sm);
}

/* Phone Number in Nav */
.nav-phone {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs); /* 8px gap between icon and text */
  padding: var(--spacing-xs) 0.75rem;
  font-size: 0.875rem; /* 14px to match nav links */
  font-weight: var(--font-weight-medium);
  color: var(--color-primary-black);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--transition-fast);
  cursor: pointer;
}

.nav-phone-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: currentColor;
}

.nav-phone:hover {
  color: var(--color-tjm-yellow);
}

/* Address Link in Nav */
.nav-address {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs); /* 8px gap between icon and text */
  padding: var(--spacing-xs) 0.75rem;
  font-size: 0.875rem; /* 14px to match nav links */
  font-weight: var(--font-weight-medium);
  color: var(--color-primary-black);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--transition-fast);
  cursor: pointer;
}

.nav-address-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: currentColor;
}

.nav-address:hover {
  color: var(--color-tjm-yellow);
}

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

.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
  transition: all var(--transition-base);
}

.mobile-menu-toggle span {
  display: block;
  width: 100%;
  height: 3px;
  background-color: var(--color-primary-black);
  border-radius: 2px;
  transition: all var(--transition-base);
  transform-origin: center;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: translateY(10.5px) rotate(45deg);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: translateY(-10.5px) rotate(-45deg);
}

/* ===== MOBILE MENU OVERLAY ===== */

.mobile-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: calc(100% - 300px);
  height: 100vh;
  background-color: transparent;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all var(--transition-base);
  z-index: 999;
}

.mobile-menu-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

@media (max-width: 767px) {
  .mobile-menu-overlay {
    width: calc(100% - 280px);
  }
}

/* ===== MOBILE RESPONSIVE ===== */

@media (max-width: 1023px) {
  .header-container {
    height: var(--header-height-mobile);
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 300px;
    height: 100vh;
    background-color: var(--color-primary-white);
    flex-direction: column;
    align-items: flex-start;
    padding: calc(var(--header-height-mobile) + var(--spacing-lg)) var(--spacing-lg) var(--spacing-lg);
    gap: 0;
    box-shadow: var(--shadow-xlarge);
    overflow-y: auto;
    transition: right var(--transition-slow);
    z-index: 1000;
  }

  .nav.active {
    right: 0;
  }

  .nav-menu {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: 0;
  }

  .nav-item {
    width: 100%;
    border-bottom: 1px solid var(--color-light-gray);
    pointer-events: auto;
  }

  .nav-link {
    width: 100%;
    padding: var(--spacing-md) 0;
    font-size: 1.125rem;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(252, 238, 35, 0.3);
    touch-action: manipulation;
  }

  .nav-link::after {
    display: none;
  }

  .nav-cta {
    width: 100%;
    margin-left: 0;
    margin-top: var(--spacing-lg);
  }

  .nav-cta .btn {
    width: 100%;
    text-align: center;
  }

  /* Show phone number in mobile header - icon only */
  .nav-phone {
    position: fixed;
    right: 70px; /* Position between logo and hamburger menu */
    top: calc(40px + (var(--header-height-mobile) / 2)); /* Top bar height + half of header height */
    transform: translateY(-50%);
    padding: var(--spacing-xs);
    z-index: 100;
    background-color: transparent;
  }

  .nav-phone span {
    display: none; /* Hide text on mobile, show icon only */
  }

  .nav-phone-icon {
    width: 22px;
    height: 22px;
  }

  /* Show address in mobile header - icon only */
  .nav-address {
    position: fixed;
    right: 120px; /* Position to the left of phone icon */
    top: calc(40px + (var(--header-height-mobile) / 2)); /* Top bar height + half of header height */
    transform: translateY(-50%);
    padding: var(--spacing-xs);
    z-index: 100;
    background-color: transparent;
  }

  .nav-address span {
    display: none; /* Hide text on mobile, show icon only */
  }

  .nav-address-icon {
    width: 22px;
    height: 22px;
  }

  /* Prevent body scroll when menu is open */
  body.mobile-menu-open {
    overflow: hidden;
  }
}

@media (max-width: 767px) {
  .header-container {
    padding: 0 var(--spacing-sm);
  }

  .logo-image {
    height: 40px;
  }

  .nav {
    width: 280px;
  }

  /* Adjust phone position for smaller mobile (top bar is 35px) */
  .nav-phone {
    top: calc(35px + (var(--header-height-mobile) / 2));
    right: 60px; /* Slightly closer on smaller screens */
  }

  /* Adjust address position for smaller mobile (top bar is 35px) */
  .nav-address {
    top: calc(35px + (var(--header-height-mobile) / 2));
    right: 110px; /* Position to the left of phone on smaller screens */
  }
}

/* ===== STICKY HEADER SPACER ===== */

.header-spacer {
  height: calc(var(--header-height) + 40px);
}

@media (max-width: 1023px) {
  .header-spacer {
    height: calc(var(--header-height-mobile) + 40px);
  }
}

@media (max-width: 767px) {
  .header-spacer {
    height: calc(var(--header-height-mobile) + 35px);
  }
}
