@import '../../../sass/variables';

// ========================================
// Modern Header Elements - Optimized
// ========================================

// Layout
.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: $element-gap;
  flex: 1;
  min-width: 0;

  @media (max-width: 768px) { gap: 0.75rem; }
}

.header-left  { justify-content: flex-start; }
.header-right { justify-content: flex-end; }

.header-center {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;

  @media (max-width: 768px) {
    position: static;
    transform: none;
    flex: 1;
  }
}

// Logo
.site-logo {
  display: inline-block;
  text-decoration: none;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  &:hover { transform: translateY(-2px); }

  .logo-image {
    height: 72px;         // antes: 48px
    max-width: 260px;     // antes: 160px
    width: auto;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.1));
    transition: filter 0.3s ease;

    @media (max-width: 768px) {
      height: 48px;       // antes: 32px
      max-width: 160px;   // antes: 110px
    }
    &:hover { filter: drop-shadow(0 4px 16px rgba(0,0,0,0.15)); }
  }

  .site-name {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 800;
    background: $primary-gradient;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
  }
}

// Navbar toggle
.navbar-toggler {
  background: none;
  border: none;
  padding: 12px;
  cursor: pointer;
  display: none;
  border-radius: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  @media (max-width: 768px) {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  &:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.05);
  }

  .navbar-toggler-icon {
    width: 24px;
    height: 2px;
    background: #374151;
    position: relative;
    border-radius: 2px;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);

    &::before,
    &::after {
      content: '';
      position: absolute;
      width: 100%;
      height: 2px;
      background: #374151;
      border-radius: 2px;
      transition: inherit;
    }

    &::before { top: -8px; }
    &::after { bottom: -8px; }
  }

  &.active .navbar-toggler-icon {
    background: transparent;

    &::before { transform: rotate(45deg) scale(1.1); top: 0; }
    &::after  { transform: rotate(-45deg) scale(1.1); bottom: 0; }
  }
}

// Locale selector
.header-locale .locale-toggle {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.875rem;
  border-radius: 20px;
  backdrop-filter: blur(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  &:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  }

  .country-flag { width: 18px; border-radius: 2px; }
  .currency { font-weight: 600; color: #374151; }
}

// Action buttons base
%modern-action-base {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #374151;
  cursor: pointer;
  text-decoration: none;
  border-radius: 12px;
  position: relative;
  backdrop-filter: blur(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  &::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background: $primary-gradient;
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  &:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);

    &::before { opacity: 0.1; }
    svg { transform: scale(1.1); }
  }

  svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.5;
    position: relative;
    z-index: 1;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
}

.header-search-toggle,
.header-account,
.header-cart { @extend %modern-action-base; }

// Cart counter
.header-cart .cart-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: $accent-gradient;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(245, 87, 108, 0.3);
  animation: pulse 2s infinite;
}

// Animations
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}

// Responsive
@media (max-width: 768px) {
  .header-locale { display: none; }
  .header-right  { gap: 0.5rem; }

  .header-search-toggle,
  .header-account,
  .header-cart {
    width: 40px;
    height: 40px;
    border-radius: 10px;

    svg {
      width: 18px;
      height: 18px;
    }
  }
}
