/* ==========================================================================
   Sticky Header CSS - BebeYou Theme
   ========================================================================== */

/* Base Sticky Header Styles */
.sticky-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  transition: all 0.3s ease-in-out;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

/* Initial state - full height */
.sticky-header {
  padding: 1rem 0;
  background-color: rgba(248, 249, 250, 0.95);
}

/* Scrolled state - compact */
.sticky-header.scrolled {
  padding: 0.5rem 0;
  background-color: rgba(248, 249, 250, 0.98);
}

/* Logo and favicon transitions on scroll */
.sticky-header .navbar-brand {
  transition: all 0.3s ease;
}

/* Favicon styles */
.sticky-header .navbar-favicon {
  transition: all 0.3s ease;
  max-height: 32px;
  width: auto;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.sticky-header.scrolled .navbar-favicon {
  max-height: 28px;
}

/* Main logo styles */
.sticky-header .navbar-logo {
  transition: all 0.3s ease;
  max-height: 50px;
}

.sticky-header.scrolled .navbar-logo {
  max-height: 40px;
}

/* Legacy support for existing .navbar-brand img selector */
.sticky-header .navbar-brand img:not(.navbar-favicon) {
  transition: all 0.3s ease;
  max-height: 50px;
}

.sticky-header.scrolled .navbar-brand img:not(.navbar-favicon) {
  max-height: 40px;
}

/* Navigation items */
.sticky-header .navbar-nav .nav-link {
  transition: all 0.3s ease;
  padding: 0.75rem 1rem;
  color: var(--bs-gray-700);
  font-weight: 500;
}

.sticky-header.scrolled .navbar-nav .nav-link {
  padding: 0.5rem 1rem;
}

.sticky-header .navbar-nav .nav-link:hover {
  color: var(--bs-primary);
  transform: translateY(-1px);
}

/* User actions icons */
.sticky-header .user-items a {
  transition: all 0.3s ease;
  padding: 0.5rem;
  border-radius: 8px;
  color: var(--bs-gray-700);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sticky-header .user-items a:hover {
  background-color: rgba(230, 188, 235, 0.1);
  color: var(--bs-primary);
  transform: translateY(-1px);
}

/* Search input in sticky header */
.sticky-header .search-container input[type='search'] {
  transition: all 0.3s ease;
  border: 1px solid rgba(186, 235, 229, 0.3);
  background-color: rgba(255, 255, 255, 0.8);
}

.sticky-header.scrolled .search-container input[type='search'] {
  font-size: 0.9rem;
  padding: 0.5rem 2.5rem 0.5rem 2rem;
}

/* Cart count badge */
.sticky-header .cart-count {
  font-size: 0.7rem;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  top: -8px;
  right: -8px;
}

/* Body padding to prevent content from hiding under sticky header */
/* Comentado: ahora el header inicialmente no es sticky */
/*
body {
  padding-top: 90px;
}
*/

/* Mobile Sticky Header Styles */
@media (max-width: 991.98px) {
  /* Comentado: ahora el header inicialmente no es sticky */
  /*
  body {
    padding-top: 70px;
  }
  */

  /* Hide intro section on mobile */
  #intro {
    display: none !important;
  }

  /* Remove excessive spacing from category section on mobile */
  #category {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }

  /* Reduce spacing in category header */
  #category .display-header {
    margin-bottom: 1.5rem !important;
  }

  .sticky-header {
    padding: 0.75rem 0;
    background-color: rgba(248, 249, 250, 0.98);
  }

  .sticky-header.scrolled {
    padding: 0.5rem 0;
    background-color: rgba(248, 249, 250, 1);
  }

  /* Mobile favicon styles */
  .sticky-header .navbar-favicon {
    max-height: 28px;
  }

  .sticky-header.scrolled .navbar-favicon {
    max-height: 24px;
  }

  /* Mobile logo styles */
  .sticky-header .navbar-logo {
    max-height: 45px;
  }

  .sticky-header.scrolled .navbar-logo {
    max-height: 35px;
  }

  /* Legacy mobile support */
  .sticky-header .navbar-brand img:not(.navbar-favicon) {
    max-height: 45px;
  }

  .sticky-header.scrolled .navbar-brand img:not(.navbar-favicon) {
    max-height: 35px;
  }

  /* Mobile hamburger menu */
  .sticky-header .navbar-toggler {
    border: none;
    padding: 0.25rem 0.5rem;
    transition: all 0.3s ease;
  }

  .sticky-header .navbar-toggler:focus {
    box-shadow: none;
  }

  /* Hamburger animation */
  .sticky-header .hamburger {
    width: 24px;
    height: 20px;
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .sticky-header .hamburger span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--bs-gray-700);
    border-radius: 2px;
    transition: all 0.3s ease;
  }

  .sticky-header .hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translateY(9px);
  }

  .sticky-header .hamburger.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(-20px);
  }

  .sticky-header .hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translateY(-9px);
  }

  /* Mobile menu improvements for sticky */
  #mobileMenu {
    top: 0 !important; /* Full screen from top */
    background-color: rgba(248, 249, 250, 0.98) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1040 !important;
  }

  #mobileMenu.show {
    display: block !important;
  }

  /* No need for scrolled state adjustment since we want full screen */

  /* Ensure mobile menu overlay works with sticky header */
  #mobileMenuOverlay {
    z-index: 1035 !important;
  }

  #mobileMenuOverlay.show {
    display: block !important;
    opacity: 1 !important;
  }

  /* Ensure hamburger is visible over content */
  .sticky-header .navbar-toggler {
    z-index: 1050;
    position: relative;
  }
}

/* Tablet specific adjustments */
@media (min-width: 768px) and (max-width: 1399.98px) {
  /* Comentado: ahora el header inicialmente no es sticky */
  /*
  body {
    padding-top: 75px;
  }
  */

  .sticky-header .navbar-brand img {
    max-height: 48px;
  }

  .sticky-header.scrolled .navbar-brand img {
    max-height: 38px;
  }
}

/* Large desktop adjustments */
@media (min-width: 1200px) {
  /* Comentado: ahora el header inicialmente no es sticky */
  /*
  body {
    padding-top: 95px;
  }
  */

  .sticky-header {
    padding: 1.25rem 0;
  }

  .sticky-header.scrolled {
    padding: 0.75rem 0;
  }
}

/* Smooth scrolling improvements */
html {
  scroll-behavior: smooth;
}

/* Animation for sticky header appearance */
@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.sticky-header {
  animation: slideDown 0.3s ease-out;
}

/* Hide/show on scroll direction */
.sticky-header.hide {
  transform: translateY(-100%);
  transition: transform 0.3s ease-in-out;
}

.sticky-header.show {
  transform: translateY(0);
  transition: transform 0.3s ease-in-out;
}

/* Performance optimization */
.sticky-header {
  will-change: transform, background-color, padding;
}

/* Focus states for accessibility */
.sticky-header .nav-link:focus,
.sticky-header .user-items a:focus {
  outline: 2px solid var(--bs-primary);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .sticky-header {
    background-color: rgb(248, 249, 250);
    border-bottom: 2px solid var(--bs-gray-300);
  }

  .sticky-header.scrolled {
    background-color: rgb(255, 255, 255);
  }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  .sticky-header,
  .sticky-header .navbar-brand img,
  .sticky-header .navbar-nav .nav-link,
  .sticky-header .user-items a,
  .sticky-header .hamburger span {
    transition: none;
  }

  .sticky-header {
    animation: none;
  }
}

/* Dark mode support (if implemented) */
@media (prefers-color-scheme: dark) {
  .sticky-header {
    background-color: rgba(26, 26, 26, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .sticky-header.scrolled {
    background-color: rgba(26, 26, 26, 0.98);
  }
}
