@use 'ui-design-system/src/styles/semantic/index' as *;

.ui-lp-header {
  position: relative;
  width: 100%;
  z-index: $semantic-z-index-sticky;
  transition: all $semantic-motion-duration-normal $semantic-motion-easing-ease;
  background: $semantic-color-surface-primary;
  border-bottom: 1px solid $semantic-color-border-secondary;
  
  // Transparent variant
  &--transparent {
    background: transparent;
    border-bottom: 1px solid transparent;
    
    &.ui-lp-header--scrolled {
      background: rgba($semantic-color-surface-primary, 0.95);
      border-bottom-color: $semantic-color-border-secondary;
      backdrop-filter: blur(10px);
      box-shadow: $semantic-shadow-card-rest;
    }
  }
  
  // Sticky positioning
  &--sticky {
    position: sticky;
    top: 0;
  }
  
  // Dark theme
  &--theme-dark {
    background: $semantic-color-inverse-surface;
    border-bottom-color: $semantic-color-border-secondary;
    color: $semantic-color-text-primary;
    
    &.ui-lp-header--transparent {
      &.ui-lp-header--scrolled {
        background: rgba($semantic-color-inverse-surface, 0.95);
        border-bottom-color: $semantic-color-border-secondary;
      }
    }
  }
  
  // Content container
  &__content {
    min-height: 64px;
    position: relative;
  }
  
  // Logo Section
  &__logo-section {
    display: flex;
    align-items: center;
    flex-shrink: 0;
  }
  
  &__logo-link,
  &__logo-text {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    transition: opacity $semantic-motion-duration-fast $semantic-motion-easing-ease;
    
    &:hover {
      opacity: $semantic-opacity-hover;
    }
  }
  
  &__logo-text {
    font-family: map-get($semantic-typography-heading-h3, font-family);
    font-size: map-get($semantic-typography-heading-h3, font-size);
    font-weight: map-get($semantic-typography-heading-h3, font-weight);
    line-height: map-get($semantic-typography-heading-h3, line-height);
    color: $semantic-color-text-primary;
    
    .ui-lp-header--theme-dark & {
      color: $semantic-color-text-primary;
    }
  }
  
  &__logo-image {
    max-height: 48px;
    width: auto;
    object-fit: contain;
  }
  
  // Desktop Navigation
  &__nav--desktop {
    display: flex;
    align-items: center;
    
    @media (max-width: $semantic-breakpoint-md - 1) {
      display: none;
    }
  }
  
  &__nav-list {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: $semantic-spacing-component-lg;
  }
  
  &__nav-item {
    position: relative;
  }
  
  &__nav-link {
    display: flex;
    align-items: center;
    gap: $semantic-spacing-component-xs;
    padding: $semantic-spacing-component-sm $semantic-spacing-component-md;
    text-decoration: none;
    color: $semantic-color-text-primary;
    font-family: map-get($semantic-typography-body-medium, font-family);
    font-size: map-get($semantic-typography-body-medium, font-size);
    font-weight: map-get($semantic-typography-body-medium, font-weight);
    line-height: map-get($semantic-typography-body-medium, line-height);
    border-radius: $semantic-border-button-radius;
    transition: all $semantic-motion-duration-fast $semantic-motion-easing-ease;
    background: transparent;
    border: none;
    cursor: pointer;
    
    &:hover {
      background: $semantic-color-surface-hover;
      color: $semantic-color-primary;
    }
    
    &:focus-visible {
      outline: 2px solid $semantic-color-focus;
      outline-offset: 2px;
    }
    
    .ui-lp-header--theme-dark & {
      color: $semantic-color-text-primary;
      
      &:hover {
        background: rgba($semantic-color-surface-hover, 0.1);
        color: $semantic-color-primary;
      }
    }
  }
  
  &__nav-arrow {
    display: flex;
    align-items: center;
    transition: transform $semantic-motion-duration-fast $semantic-motion-easing-ease;
    
    .ui-lp-header__nav-link--dropdown[aria-expanded="true"] & {
      transform: rotate(180deg);
    }
  }
  
  &__nav-icon {
    display: flex;
    align-items: center;
    font-size: 16px;
  }
  
  &__nav-badge {
    padding: $semantic-spacing-component-xs $semantic-spacing-component-sm;
    background: $semantic-color-warning;
    color: $semantic-color-on-primary;
    border-radius: 9999px;
    font-family: map-get($semantic-typography-body-small, font-family);
    font-size: map-get($semantic-typography-body-small, font-size);
    font-weight: map-get($semantic-typography-body-small, font-weight);
    line-height: 1;
  }
  
  // Dropdown Menu
  &__dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: $semantic-color-surface-elevated;
    border: 1px solid $semantic-color-border-secondary;
    border-radius: $semantic-border-card-radius;
    box-shadow: $semantic-shadow-dropdown;
    padding: $semantic-spacing-component-sm 0;
    z-index: $semantic-z-index-dropdown;
    opacity: 1;
    transform: translateY(0);
    animation: dropdownFadeIn $semantic-motion-duration-normal $semantic-motion-easing-ease;
    
    .ui-lp-header--theme-dark & {
      background: $semantic-color-inverse-surface;
      border-color: $semantic-color-border-secondary;
    }
  }
  
  &__dropdown-item {
    display: flex;
    align-items: center;
    gap: $semantic-spacing-component-sm;
    padding: $semantic-spacing-component-sm $semantic-spacing-component-md;
    text-decoration: none;
    color: $semantic-color-text-primary;
    font-family: map-get($semantic-typography-body-medium, font-family);
    font-size: map-get($semantic-typography-body-medium, font-size);
    font-weight: map-get($semantic-typography-body-medium, font-weight);
    line-height: map-get($semantic-typography-body-medium, line-height);
    transition: background $semantic-motion-duration-fast $semantic-motion-easing-ease;
    
    &:hover {
      background: $semantic-color-surface-hover;
    }
    
    .ui-lp-header--theme-dark & {
      color: $semantic-color-text-primary;
      
      &:hover {
        background: rgba($semantic-color-surface-hover, 0.1);
      }
    }
  }
  
  // Actions Section
  &__actions {
    display: flex;
    align-items: center;
    gap: $semantic-spacing-component-md;
    flex-shrink: 0;
  }
  
  &__cta-button {
    @media (max-width: $semantic-breakpoint-sm - 1) {
      display: none;
    }
  }
  
  &__cta-icon {
    display: flex;
    align-items: center;
    font-size: 16px;
  }
  
  &__mobile-toggle {
    display: none;
    
    @media (max-width: $semantic-breakpoint-md - 1) {
      display: flex;
    }
  }
  
  // Mobile Navigation
  &__nav--mobile {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: $semantic-color-surface-primary;
    border-bottom: 1px solid $semantic-color-border-secondary;
    box-shadow: $semantic-shadow-card-hover;
    z-index: $semantic-z-index-dropdown;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    
    &.ui-lp-header--mobile-menu-open & {
      display: block;
      animation: slideDown $semantic-motion-duration-normal $semantic-motion-easing-ease;
    }
    
    .ui-lp-header--theme-dark & {
      background: $semantic-color-inverse-surface;
      border-bottom-color: $semantic-color-border-secondary;
    }
    
    @media (max-width: $semantic-breakpoint-md - 1) {
      .ui-lp-header--mobile-menu-open & {
        display: block;
      }
    }
  }
  
  &__mobile-list {
    list-style: none;
    margin: 0;
    padding: $semantic-spacing-component-md 0;
  }
  
  &__mobile-item {
    &:not(:last-child) {
      border-bottom: 1px solid $semantic-color-border-subtle;
    }
  }
  
  &__mobile-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: $semantic-spacing-component-md;
    text-decoration: none;
    color: $semantic-color-text-primary;
    font-family: map-get($semantic-typography-body-large, font-family);
    font-size: map-get($semantic-typography-body-large, font-size);
    font-weight: map-get($semantic-typography-body-large, font-weight);
    line-height: map-get($semantic-typography-body-large, line-height);
    background: transparent;
    border: none;
    width: 100%;
    cursor: pointer;
    transition: background $semantic-motion-duration-fast $semantic-motion-easing-ease;
    
    &:hover {
      background: $semantic-color-surface-hover;
    }
    
    .ui-lp-header--theme-dark & {
      color: $semantic-color-text-primary;
      
      &:hover {
        background: rgba($semantic-color-surface-hover, 0.1);
      }
    }
  }
  
  &__mobile-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    background: $semantic-color-surface-secondary;
    
    .ui-lp-header--theme-dark & {
      background: rgba($semantic-color-surface-secondary, 0.1);
    }
  }
  
  &__mobile-sublink {
    display: block;
    padding: $semantic-spacing-component-sm $semantic-spacing-component-lg;
    text-decoration: none;
    color: $semantic-color-text-secondary;
    font-family: map-get($semantic-typography-body-medium, font-family);
    font-size: map-get($semantic-typography-body-medium, font-size);
    font-weight: map-get($semantic-typography-body-medium, font-weight);
    line-height: map-get($semantic-typography-body-medium, line-height);
    transition: background $semantic-motion-duration-fast $semantic-motion-easing-ease;
    
    &:hover {
      background: $semantic-color-surface-hover;
      color: $semantic-color-text-primary;
    }
    
    .ui-lp-header--theme-dark & {
      color: rgba($semantic-color-text-primary, 0.7);
      
      &:hover {
        background: rgba($semantic-color-surface-hover, 0.1);
        color: $semantic-color-text-primary;
      }
    }
  }
  
  &__mobile-cta {
    padding: $semantic-spacing-component-md;
    margin-top: $semantic-spacing-component-md;
    border-top: 1px solid $semantic-color-border-subtle;
  }
  
  // Mobile Menu Backdrop
  &__backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba($semantic-color-inverse-surface, $semantic-opacity-backdrop);
    z-index: $semantic-z-index-overlay - 1;
    animation: backdropFadeIn $semantic-motion-duration-normal $semantic-motion-easing-ease;
  }
  
  // Mobile menu open state
  &--mobile-menu-open {
    .ui-lp-header__nav--mobile {
      display: block;
    }
  }
  
  // Responsive Design
  @media (max-width: $semantic-breakpoint-sm - 1) {
    &__logo-text {
      font-family: map-get($semantic-typography-heading-h4, font-family);
      font-size: map-get($semantic-typography-heading-h4, font-size);
      font-weight: map-get($semantic-typography-heading-h4, font-weight);
      line-height: map-get($semantic-typography-heading-h4, line-height);
    }
    
    &__content {
      min-height: 64px-sm;
    }
  }
}

// Animations
@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes backdropFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}