/**handles:fajne-header**/
/*
 * header.css – stylowanie nagłówka w stylu aplikacji
 */

/* Nowy nagłówek w stylu aplikacji */
.site-header {
  width: 100%;
  max-width: var(--max-width);
  margin-bottom: 2rem;
  background: var(--background-color);
  border-bottom: 1px solid var(--border-color);
  /* Optymalizacja wydajności */
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.header-container {
  display: flex;
  flex-direction: column;
}

/* Górny pasek z logo i ikonami */
.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  gap: 1rem;
}

.header-left {
  flex-shrink: 0;
}

.site-title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.site-title-link {
  color: var(--text-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

.site-title-link:hover {
  color: var(--link-hover);
  text-decoration: none;
}

.header-right {
  flex-shrink: 0;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.header-action {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text-color);
  border-radius: 6px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-width: 44px;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  /* Optymalizacja wydajności */
  will-change: background-color, color;
  transform: translateZ(0);
}

.header-action:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: var(--link-hover);
}

@media (prefers-color-scheme: dark) {
  .header-action:hover {
    background-color: rgba(255, 255, 255, 0.1);
  }
}

.action-icon {
  width: 20px;
  height: 20px;
}

/* Menu nawigacyjne */
.main-navigation {
  border-top: 1px solid var(--border-color);
  padding: 0 !important;
  margin: 0 !important;
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 !important;
  margin: 0 !important;
}

.main-menu {
  display: flex;
  list-style: none;
  margin: 0 !important;
  padding: 0 !important;
  gap: 2rem;
  align-items: center;
  flex-wrap: wrap;
  flex: 1;
  /* Zapobieganie łamaniu menu na dwa wiersze */
  min-height: 44px;
}

.main-menu li {
  margin: 0 !important;
  padding: 0 !important;
  flex-shrink: 0;
}

.main-menu a {
  color: var(--text-color);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s ease;
  padding: 0.1rem 0 !important;
  position: relative;
  white-space: nowrap;
  display: block;
  min-height: 32px !important;
  display: flex;
  align-items: center;
  margin: 0 !important;
  line-height: 1 !important;
}

.main-menu a:hover {
  color: var(--link-hover);
  text-decoration: none;
}

.main-menu a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--link-hover);
  transition: width 0.2s ease;
}

.main-menu a:hover::after {
  width: 100%;
}

/* Dropdown dla niemieszczących się opcji */
.nav-dropdown {
  position: relative;
  flex-shrink: 0;
  display: none; /* Domyślnie ukryte */
}

.nav-dropdown-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text-color);
  border-radius: 6px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
}

.nav-dropdown-toggle:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: var(--link-hover);
}

@media (prefers-color-scheme: dark) {
  .nav-dropdown-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
  }
}

.dropdown-dots {
  font-size: 1.2rem;
  font-weight: bold;
  line-height: 1;
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--background-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 0.5rem 0;
  min-width: 200px;
  z-index: 100;
  display: none;
  list-style: none;
  margin: 0;
  /* Optymalizacja wydajności */
  will-change: opacity, transform;
  transform: translateZ(0);
}

.nav-dropdown.active .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu li {
  margin: 0;
}

.nav-dropdown-menu a {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--text-color);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background-color 0.2s ease;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.nav-dropdown-menu a:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: var(--link-hover);
}

@media (prefers-color-scheme: dark) {
  .nav-dropdown-menu a:hover {
    background-color: rgba(255, 255, 255, 0.1);
  }
}

/* Hamburger menu dla mobile */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text-color);
  border-radius: 6px;
  transition: all 0.2s ease;
}

.mobile-menu-toggle:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: var(--link-hover);
}

@media (prefers-color-scheme: dark) {
  .mobile-menu-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
  }
}

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

/* Responsywność */
@media (max-width: 768px) {
  .site-title {
    font-size: 1.5rem;
  }
  
  .header-actions {
    gap: 0.25rem;
  }
  
  .header-action {
    padding: 0.4rem;
    min-width: 44px;
    min-height: 44px;
  }
  
  .action-icon {
    width: 18px;
    height: 18px;
  }
  
  /* Ukryj desktop menu */
  .main-navigation {
    display: none;
  }
  
  /* Pokaż hamburger menu */
  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0.5rem;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }
  
  /* Mobile menu overlay */
  .mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    -webkit-overflow-scrolling: touch;
    /* Optymalizacja wydajności */
    will-change: opacity;
    transform: translateZ(0);
  }
  
  .mobile-menu-overlay.active {
    display: flex;
    opacity: 1;
  }
  
  .mobile-menu-content {
    background: var(--background-color);
    width: 100%;
    max-width: 300px;
    height: 100%;
    padding: 2rem 1.5rem;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    -webkit-overflow-scrolling: touch;
    /* Optymalizacja wydajności */
    will-change: transform;
    backface-visibility: hidden;
  }
  
  .mobile-menu-overlay.active .mobile-menu-content {
    transform: translateX(0);
  }
  
  .mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
  }
  
  .mobile-menu-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.75rem;
    color: var(--text-color);
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 1.5rem;
    line-height: 1;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .mobile-menu-close:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--link-hover);
  }
  
  .mobile-menu {
    list-style: none;
    margin: 0;
    padding: 0;
  }
  
  .mobile-menu li {
    margin: 0;
  }
  
  .mobile-menu a {
    display: block;
    padding: 1rem 0;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1rem;
    transition: color 0.2s ease;
    border-bottom: 1px solid var(--border-color);
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  
  .mobile-menu a:hover {
    color: var(--link-hover);
  }
}

@media (max-width: 480px) {
  .site-title {
    font-size: 1.25rem;
  }
  
  .header-actions {
    gap: 0.2rem;
  }
  
  .header-action {
    padding: 0.3rem;
  }
  
  .action-icon {
    width: 16px;
    height: 16px;
  }
}

/* Ukryj overlay mobile menu na desktopie */
@media (min-width: 769px) {
  .mobile-menu-overlay {
    display: none !important;
  }
  
  /* Ukryj dropdown na bardzo szerokich ekranach */
  .nav-dropdown {
    display: none;
  }
}

/* Optymalizacja dla bardzo wąskich ekranów */
@media (max-width: 360px) {
  .header-top {
    padding: 0.75rem 0;
  }
  
  .site-title {
    font-size: 1.1rem;
  }
  
  .header-actions {
    gap: 0.1rem;
  }
  
  .header-action {
    padding: 0.25rem;
    min-width: 40px;
    min-height: 40px;
  }
  
  .action-icon {
    width: 14px;
    height: 14px;
  }
}