/**
 * Navigation Header Component Styles
 * Component: Main Navigation Bar with Search
 * 
 * Performance Optimizations:
 * - CSS containment for paint/layout isolation
 * - will-change for animated properties
 * - Hardware acceleration for transforms
 * - Minimal reflows
 * 
 * Browser Support: All modern browsers (last 2 versions)
 */

/* ===================================
   Component Container
   =================================== */

.navigation-header {
  background-color: var(--color-white);
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 98; /* Below mobile sidebar (1002) and overlay (1001) */
  overflow: visible;
}

/* Decorative Diagonal Stripe Pattern */
.navigation-header__pattern {
  display: none; /* Pattern removed per design */
}

.navigation-header__container {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 100%;
  margin: 0 auto;
  height: 96px;
  padding: var(--spacing-sm) var(--spacing-xl);
  gap: var(--spacing-lg);
  flex-wrap: wrap;
  background: var(--color-white);
  box-shadow: 0 1px 0 0 #d9d9d9;
}

/* Hamburger Menu - Visible on all screen sizes */
.navigation-header__hamburger {
  display: flex !important;  /* Force visibility on all screens */
  flex-direction: column;
  justify-content: space-between;
  width: 32px;  /* Increased to match live site */
  height: 24px;  /* Increased to match live site */
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 10;
  margin-right: 12px;  /* Reduced from var(--spacing-md) to bring logo closer */
}

.navigation-header__hamburger-line {
  width: 100%;
  height: 2px;
  background-color: var(--color-black);
  transition: all 0.3s ease;
  border-radius: 2px;
}

.navigation-header__hamburger:hover .navigation-header__hamburger-line {
  background-color: var(--color-nava);
}

.navigation-header__hamburger:focus {
  outline: 2px solid var(--color-nava);
  outline-offset: 4px;
  border-radius: 2px;
}

/* Hamburger menu active state (X animation) */
.navigation-header__hamburger.is-active
  .navigation-header__hamburger-line:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.navigation-header__hamburger.is-active
  .navigation-header__hamburger-line:nth-child(2) {
  opacity: 0;
}

.navigation-header__hamburger.is-active
  .navigation-header__hamburger-line:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* ===================================
    Mobile Sidebar Menu
    =================================== */

.mobile-sidebar {
  position: fixed;
  top: 0;
  left: -100%;
  width: 350px;
  height: 100vh;
  background-color: var(--color-white);
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  overflow-y: auto;
  transition: left 0.3s ease;
  padding: var(--spacing-xl) var(--spacing-lg);
}

.mobile-sidebar.is-active {
  left: 0;
}

/* Support 'is-open' class used by interactions.js */
.mobile-sidebar.is-open {
  left: 0;
}

/* Sidebar overlay */
.mobile-sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-sidebar-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

/* Support 'is-visible' class used by interactions.js */
.mobile-sidebar-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

/* Sidebar header */
.mobile-sidebar__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-xl);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid #e5e5e5;
}

.mobile-sidebar__logo {
  height: 32px;
  width: auto;
}

.mobile-sidebar__close {
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.mobile-sidebar__close:hover {
  background-color: #f5f5f5;
}

.mobile-sidebar__close:focus {
  outline: 2px solid var(--color-nava);
  outline-offset: 2px;
}

/* Sidebar navigation */
.mobile-sidebar__nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mobile-sidebar__nav-item {
  margin-bottom: var(--spacing-xs);
}

.mobile-sidebar__nav-link {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  color: var(--color-black);
  text-decoration: none;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}

.mobile-sidebar__nav-link:hover {
  background-color: #f5f5f5;
}

.mobile-sidebar__nav-link:active {
  background-color: #e5e5e5;
}

.mobile-sidebar__nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--color-nava);
}

/* Sidebar divider */
.mobile-sidebar__divider {
  height: 1px;
  background-color: #e5e5e5;
  margin: var(--spacing-lg) 0;
}

/* Sidebar footer */
.mobile-sidebar__footer {
  margin-top: auto;
  padding-top: var(--spacing-lg);
/*  border-top: 1px solid #e5e5e5; */
}

.mobile-sidebar__contact {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  padding-bottom: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  border-bottom: 1px solid #e5e5e5;
  border-top: 1px solid #e5e5e5;
}

.mobile-sidebar__contact-link {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  color: var(--color-black);
  text-decoration: none;
  font-family: var(--font-primary);
  font-size: 14px;
  line-height: 1.5;
  transition: color 0.2s ease;
}

.mobile-sidebar__contact-link:hover {
  color: var(--color-nava);
}

.mobile-sidebar__contact-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Desktop - hide sidebar */
/* Temporarily commented to test on desktop
@media (min-width: 768px) {
  .mobile-sidebar,
  .mobile-sidebar-overlay {
    display: none;
  }
}
*/

/* ===================================
    Mobile Sidebar Additional Styles
    =================================== */

/* Categories Section */
.mobile-sidebar__section {
  padding: var(--spacing-xl) 0;
 /* border-top: 1px solid #e5e5e5; */
}

/* Remove top border for the first section (just above categories) */
.mobile-sidebar__section:first-of-type {
  border-top: none;
  padding-top: var(--spacing-lg);
}

.mobile-sidebar__section-title {
  font-family: var(--font-bold);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666;
  margin-bottom: var(--spacing-md);
  padding: 0 var(--spacing-lg);
}

.mobile-sidebar__categories {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mobile-sidebar__category-item {
  margin-bottom: var(--spacing-xs);
}

.mobile-sidebar__category-link {
  display: block;
  padding: var(--spacing-sm) var(--spacing-lg);
  color: var(--color-black);
  text-decoration: none;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  transition: all 0.2s ease;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.mobile-sidebar__category-link:hover {
  background-color: rgba(125, 154, 76, 0.08);
  color: var(--color-nava);
  padding-left: calc(var(--spacing-lg) + 4px);
}

.mobile-sidebar__category-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background-color: var(--color-nava);
  transition: height 0.3s ease;
}

.mobile-sidebar__category-link:hover::before {
  height: 70%;
}

/* Right arrow indicator
.mobile-sidebar__category-link::after {
  content: '>';
  position: absolute;
  right: var(--spacing-lg);
  top: 50%;
  transform: translateY(-50%);
  color: #999999;
  font-size: 16px;
  line-height: 1;
}

.mobile-sidebar__category-link:hover::after {
  color: var(--color-nava);
}

*/

/* Account Section */
.mobile-sidebar__section--account {
  margin-top: auto;
  padding: var(--spacing-lg) 0;
}

.mobile-sidebar__account-link {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md) var(--spacing-lg);
  color: var(--color-black);
  text-decoration: none;
  font-family: var(--font-primary);
  font-size: 15px;
  font-weight: 600;
  transition: all 0.2s ease;
  background-color: #f9f9f9;
  border-radius: 4px;
  margin: 0 var(--spacing-lg);
}

.mobile-sidebar__account-link:hover {
  background-color: var(--color-nava);
  color: white;
}

.mobile-sidebar__account-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Footer Links in sidebar */
.mobile-sidebar__footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  padding: var(--spacing-lg);
/*  border-top: 1px solid #e5e5e5; */
  margin-top: var(--spacing-xl);
}

.mobile-sidebar__footer-link {
  color: #666;
  text-decoration: none;
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 500;
  padding: var(--spacing-xs) var(--spacing-sm);
  transition: color 0.2s ease;
}

.mobile-sidebar__footer-link:hover {
  color: var(--color-nava);
}

.mobile-sidebar__footer-link:not(:last-child)::after {
  content: '•';
  margin-left: var(--spacing-sm);
  color: #ccc;
}

.mobile-sidebar__close-icon {
  width: 20px;
  height: 20px;
}

/* ===================================
    Left Section: Logo
    =================================== */

.navigation-header__left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.navigation-header__logo {
  position: relative;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  transition: opacity 0.2s ease;
  will-change: opacity;
}

.navigation-header__logo:hover {
  opacity: 0.85;
}

.navigation-header__logo:focus {
  outline: 2px solid var(--color-nava);
  outline-offset: 4px;
  border-radius: 4px;
}

.navigation-header__logo-image {
  display: block;
  height: 48px;  /* Slightly increased */
  width: 240px;  /* Slightly increased */
  max-width: 240px;
  object-fit: contain;
}

.navigation-header__logo-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.navigation-header__logo-text {
  font-family: var(--font-bold);
  font-size: 24px;
  font-weight: 700;
  color: var(--color-nava);
  text-decoration: none;
}

.navigation-header__icon-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-black);
  text-decoration: none;
}

/* ===================================
    Center Section: Search Bar
    =================================== */

.navigation-header__center {
  flex: 1;
  display: flex;
  justify-content: center;
  max-width: 920px; /* Wider like live site */
  min-width: 0;
}

.navigation-header__search {
  display: flex;
  align-items: stretch;
  width: 100%;
  background-color: var(--color-white);
  overflow: hidden;
}

.navigation-header__search-input {
  flex: 1;
  border: 2px solid #e5e5e5;
  border-right: none;
  border-radius: 6px 0 0 6px;
  outline: none;
  padding: 8px 16px;
  min-height: 48px;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--color-black);
  background-color: var(--color-white);
  min-width: 0;
  transition: border-color 0.2s ease;
}

.navigation-header__search-input::placeholder {
  color: #999999;
  font-weight: 500;
  font-size: 16px;
}

.navigation-header__search-input:focus {
  outline: none;
  border-color: var(--color-nava);
}

/* Remove default search input styling */
.navigation-header__search-input::-webkit-search-decoration,
.navigation-header__search-input::-webkit-search-cancel-button,
.navigation-header__search-input::-webkit-search-results-button,
.navigation-header__search-input::-webkit-search-results-decoration {
  display: none;
}

.navigation-header__search-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: 7px 24px;
  background-color: var(--color-nava);
  color: var(--color-white);
  border: 2px solid var(--color-nava);
  border-radius: 0 6px 6px 0;
  font-family: var(--font-bold);
  font-size: var(--font-size-base);
  font-weight: 700;
  line-height: 1.5;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
  will-change: background-color, transform;
  flex-shrink: 0;
  min-height: 48px;
}

.navigation-header__search-button:hover {
  background-color: var(--color-nava-dark);
}

.navigation-header__search-button:active {
  transform: scale(0.98);
}

.navigation-header__search-button:focus {
  outline: 2px solid var(--color-nava);
  outline-offset: 2px;
}

.navigation-header__search-icon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

.navigation-header__search-text {
  font-weight: 770;
  white-space: nowrap;
  font-size: 18px;
  letter-spacing: 1px;
  align-self: end;
}

/* ===================================
    Right Section: Action Icons
    =================================== */

.navigation-header__right {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}

.navigation-header__icon-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: var(--color-black);
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease;
  will-change: background-color, color;
}

.navigation-header__icon-link:hover {
  background-color: #f5f5f5;
}

.navigation-header__icon-link:focus {
  outline: 2px solid var(--color-nava);
  outline-offset: 2px;
}

.navigation-header__icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

/* Icon Count Badge */
.navigation-header__count {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-nava);
  color: var(--color-white);
  font-family: var(--font-bold);
  font-size: 14px;
  font-weight: 600;
  line-height: 24px;
  letter-spacing: 0.28px;
  padding: 0 5px;
  border-radius: 10px;
  align-items: baseline;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border: 2px solid var(--color-white);
  z-index: 1;
}

.navigation-header__count--cart {
  background-color: var(--color-nava);
  color: var(--color-white);
}

/* ===================================
    Animations
    =================================== */

@keyframes cartCountPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
  }
}

.cart-count-updated {
  animation: cartCountPulse 0.6s ease;
}

/* ===================================
    Accessibility
    =================================== */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===================================
    Responsive Design
    =================================== */

/* Desktop: Force hamburger visibility on all screens */
@media (min-width: 768px) 
{
  .navigation-header__hamburger {
    display: flex !important;
    order: 0; /* Keep hamburger before logo on desktop */
  }
}

/* Desktop exact search sizing */
@media (min-width: 1024px) {
  .navigation-header__container {
    max-width: 100%;
    margin: 0;
    padding-left: 16px; /* leave room from left extreme */
    padding-right: 16px; /* leave room from right extreme */
  }
  .navigation-header__center {
    justify-content: center;
    max-width: 1200px;
    margin: 0 auto;
  }
  .navigation-header__search {
    width: auto;
  }
  .navigation-header__search-input {
    box-sizing: border-box;
    height: 53px; /* match button height exactly */

    width: 406px;
    flex: 0 0 406px;
    padding: 10px 16px;
  }
  .navigation-header__search-button {
    box-sizing: border-box;
    height: 53px; /* match input height exactly */

    width: 163px;
    min-width: 163px;
    padding: 10px 16px;
  }
}

/* Tablet: 768px - 1023px */
@media (max-width: 1023px) {
  .navigation-header__container {
    padding: var(--spacing-md) var(--spacing-lg);
    gap: var(--spacing-md);
  }

  .navigation-header__center {
    max-width: 480px;
  }

  .navigation-header__search-input {
    padding: 12px 16px;
    font-size: 13px;
  }

  .navigation-header__search-button {
    padding: 10px 16px;
  }

  .navigation-header__right {
    gap: var(--spacing-md);
  }

  .navigation-header__icon-link {
    width: 40px;
    height: 40px;
  }

  .navigation-header__icon {
    width: 22px;
    height: 22px;
  }
}

/* Mobile: 320px - 767px */
@media (max-width: 767px) {
  /* Final fix: Add padding-top to main element to clear fixed header */
  main {
    padding-top: 150px !important; /* Match actual header height (146px) + 4px breathing room */
  }

  .navigation-header {
    min-height: 150px;
    position: fixed; /* Use fixed positioning on mobile to ensure visibility */
    width: 100%;
    top: 0;
    left: 0;
    right: 0;
    z-index: 98; /* Below mobile sidebar (1002) and overlay (1001) */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }
  

  .navigation-header__container {
    padding: var(--spacing-md);
    gap: var(--spacing-md);
    flex-wrap: wrap;
    box-shadow: none;
  }

  /* Show hamburger menu on mobile */
  .navigation-header__hamburger {
    display: flex;
    order: 1;
  }

  /* Center logo on mobile */
  .navigation-header__left {
    order: 2;
    flex: 1;
    display: flex;
    justify-content: center;
    min-width: 0;
  }

  .navigation-header__logo {
    display: flex;
  }

  .navigation-header__logo-image {
    height: 32px;
    max-width: 160px;
  }

  /* Right icons stay on right */
  .navigation-header__right {
    order: 3;
    gap: 0px;
    flex-shrink: 0;
  }

  /* Search bar full-width below */
  .navigation-header__center {
    order: 4;
    width: 100%;
    max-width: 100%;
    flex-basis: 100%;
  }

  .navigation-header__search {
    border-radius: 6px;
  }

  .navigation-header__search-input {
    padding: 10px 16px;
    font-size: 13px;
    min-height: 48px;
    border-radius: 6px 0 0 6px;
  }

  .navigation-header__search-button {
    padding: 10px 20px;
    min-height: 48px;
    border-radius: 0 6px 6px 0;
  }

  .navigation-header__search-text {
    display: none;
  }

  .navigation-header__search-icon {
    width: 30px;
    height: 30px;
  }

  .navigation-header__icon-link {
    width: 40px;
    height: 40px;
  }

  .navigation-header__icon {
    min-width: 40px;
    min-height: 40px;
  }

  .navigation-header__count {
    min-width: 18px;
    height: 18px;
    font-size: 10px;
    top: 3px;
    right: 0px;
  }
  .navigation-header__count--cart {
    min-width: 18px;
    height: 22px;
    font-size: 12px;
    top: -5px;
    right: -2px;
  }
}

/* Small Mobile: 320px - 374px */
@media (max-width: 374px) {
  .navigation-header__logo-image {
    height: 24px;
    max-width: 100px;
  }

  .navigation-header__right {
    gap: 4px;
  }

  .navigation-header__icon-link {
    width: 32px;
    height: 32px;
  }
  .navigation-header__left {
    justify-content: end;
  }
}

/* ===================================
    Print Styles
    =================================== */

@media print {
  .navigation-header__pattern {
    display: none;
  }

  .navigation-header__search-button,
  .navigation-header__right {
    display: none;
  }
}

