/* CSS для хедера */
:root{
  --header-accent:#117e77; --header-text:#0f172a; --header-muted:#64748b;
  --header-glass:rgba(255,255,255,.8); --header-border:1px solid rgba(255,255,255,.25);
  --header-shadow:0 8px 32px rgba(31,38,135,.15), inset 0 1px 1px rgba(255,255,255,.8), 0 1px 0 rgba(255,255,255,.3);
  --header-radius:24px;
}
html[data-theme="dark"]{
  --header-text:#e5e7eb; --header-muted:#9ca3af;
  --header-glass:rgba(17,126,119,.15); --header-border:1px solid rgba(17,126,119,.3);
  --header-shadow:0 8px 32px rgba(0,0,0,.6), inset 0 1px 1px rgba(17,126,119,.2), 0 1px 0 rgba(17,126,119,.1);
}

/* Контейнер без переполнения */
header.header-dph{
  box-sizing:border-box;
  width:100%;
  max-width:1200px;
  margin:8px auto;
  padding:10px 14px;
  position:sticky;
  top:0;
  z-index:1000;

  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  border-radius:calc(var(--header-radius) + 4px);
  background:var(--header-glass);
  border:var(--header-border);
  box-shadow:var(--header-shadow);
  backdrop-filter: blur(14px) saturate(140%);
  transition: all 0.3s ease;
}

/* Состояние хедера при прилипании */
header.header-dph.header-sticky {
  padding: 5px 7px;
  margin: 0 auto;
  border-radius: 12px;
}

.header-left{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
  flex: 1;
  transition: gap 0.3s ease;
}
.header-right{
  display:flex;
  align-items:center;
  gap:8px;
  transition: gap 0.3s ease;
}
.header-brand{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
  transition: gap 0.3s ease;
}

/* Лого больше и "резиновое" */
.header-logo{
  height:clamp(36px, 9vw, 56px);
  width:auto;
  display:block;
  border-radius:8px;
  box-shadow:0 2px 8px rgba(0,0,0,.08);
  object-fit:contain;
  object-position:left center;
  transition: height 0.3s ease;
}

.header-links{
  display:flex;
  gap:10px;
  align-items:center;
  margin-left:8px;
  transition: gap 0.3s ease, margin-left 0.3s ease;
}
.header-btn{
  display:inline-block;
  padding:10px 14px;
  border-radius:999px;
  border:var(--header-border);
  background:var(--header-glass);
  color:var(--header-text);
  text-decoration:none;
  box-shadow:0 4px 16px rgba(31,38,135,.12), inset 0 1px 1px rgba(255,255,255,.6);
  backdrop-filter: blur(8px);
  transition: all 0.3s ease;
  white-space: nowrap;
  font-size: 14px;
}
.header-btn:hover{
  background:rgba(255,255,255,.9);
  box-shadow:0 8px 25px rgba(31,38,135,.2), inset 0 1px 1px rgba(255,255,255,.8);
  transform:translateY(-1px);
}

.header-icon-btn{
  background:var(--header-glass);
  border:var(--header-border);
  border-radius:14px;
  padding:10px 12px;
  display:inline-flex;
  align-items:center;
  cursor:pointer;
  box-shadow:0 4px 16px rgba(31,38,135,.12), inset 0 1px 1px rgba(255,255,255,.6);
  color:var(--header-text);
  backdrop-filter: blur(8px);
  transition: all 0.3s ease;
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Noto Color Emoji",sans-serif;
}
.header-icon-btn:hover{
  background:rgba(255,255,255,.9);
  box-shadow:0 8px 25px rgba(31,38,135,.2), inset 0 1px 1px rgba(255,255,255,.8);
  transform:translateY(-1px);
}

/* Кнопка корзины */
.header-cart-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  order: 3;
}

.header-cart-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background-color: #ef4444;
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: all 0.3s ease;
}

/* Кнопка языка */
.header-language-selector {
  position: relative;
  display: inline-block;
  order: 1;
}

.header-links.header-user {
  order: 2;
}

.header-right > div:last-child {
  order: 4;
}

.header-language-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--header-glass);
  border: var(--header-border);
  border-radius: 14px;
  padding: 10px 14px;
  color: var(--header-text);
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(31,38,135,.12), inset 0 1px 1px rgba(255,255,255,.6);
  backdrop-filter: blur(8px);
  transition: all 0.3s ease;
  font-size: 14px;
  font-weight: 500;
}

.header-language-btn:hover {
  background: rgba(255,255,255,.9);
  box-shadow: 0 8px 25px rgba(31,38,135,.2), inset 0 1px 1px rgba(255,255,255,.8);
  transform: translateY(-1px);
}

.header-language-btn span {
  font-size: 16px;
}

.header-language-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  width: 160px;
  background: var(--header-glass);
  border: var(--header-border);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(31,38,135,.2), inset 0 1px 1px rgba(255,255,255,.8);
  backdrop-filter: blur(16px) saturate(150%);
  z-index: 1002;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
}

.header-language-dropdown.header-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.header-language-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  color: var(--header-text);
  text-decoration: none;
  transition: background 0.2s;
  border-bottom: 1px solid rgba(255,255,255,0.2);
}

.header-language-option:last-child {
  border-bottom: none;
}

.header-language-option:hover {
  background: rgba(255,255,255,0.7);
  border-radius: 12px;
}

.header-language-option.header-active {
  background: rgba(17,126,119,0.15);
  border-radius: 12px;
}

.header-language-flag {
  width: 20px;
  height: 15px;
  object-fit: cover;
  border-radius: 2px;
}

/* Бургер включаем на меньшей ширине */
.header-burger{
  display:none;
  border:var(--header-border);
  background:var(--header-glass);
  border-radius:12px;
  padding:10px;
  box-shadow:var(--header-shadow);
  color:var(--header-text);
  cursor:pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  transition: all 0.3s ease;
}
.header-burger span{
  display:block;
  width:20px;
  height:2px;
  background:currentColor;
  margin:2px 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.header-burger.header-open span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.header-burger.header-open span:nth-child(2) {
  opacity: 0;
}
.header-burger.header-open span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* Мобильное меню */
.header-menu{
  display:none;
  position:fixed;
  left:8px;
  right:8px;
  top: 80px;
  background:var(--header-glass);
  border:var(--header-border);
  box-shadow:0 16px 40px rgba(31,38,135,.2), inset 0 1px 1px rgba(255,255,255,.8);
  border-radius:16px;
  padding:16px;
  z-index:1001;
  backdrop-filter: blur(16px) saturate(150%);
  flex-direction: column;
  gap: 8px;
}
.header-menu.header-open{
  display: flex !important;
  animation: header-fadeIn 0.3s ease;
}
.header-menu a{
  display:block;
  padding:12px 14px;
  border-radius:12px;
  text-decoration:none;
  color:var(--header-text);
  text-align: center;
}
.header-menu a:hover{
  background:rgba(255,255,255,.86)
}
.header-hidden{
  display:none!important;
}

/* Анимация появления меню */
@keyframes header-fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Стики состояния */
header.header-dph.header-sticky .header-logo {
  height: clamp(18px, 4.5vw, 28px);
}

header.header-dph.header-sticky .header-btn {
  padding: 5px 7px;
  font-size: 12px;
}

header.header-dph.header-sticky .header-icon-btn {
  padding: 5px 6px;
  border-radius: 7px;
}

header.header-dph.header-sticky .header-language-btn {
  padding: 5px 7px;
  border-radius: 7px;
  font-size: 12px;
}

header.header-dph.header-sticky .header-burger {
  padding: 5px;
  width: 22px;
  height: 22px;
  border-radius: 6px;
}

header.header-dph.header-sticky .header-burger span {
  width: 10px;
  height: 1px;
  margin: 1px 0;
}

header.header-dph.header-sticky .header-burger.header-open span:nth-child(1) {
  transform: translateY(3px) rotate(45deg);
}
header.header-dph.header-sticky .header-burger.header-open span:nth-child(3) {
  transform: translateY(-3px) rotate(-45deg);
}

header.header-dph.header-sticky .header-cart-badge {
  width: 14px;
  height: 14px;
  font-size: 9px;
  top: -3px;
  right: -3px;
}

header.header-dph.header-sticky .header-left {
  gap: 6px;
}

header.header-dph.header-sticky .header-right {
  gap: 4px;
}

header.header-dph.header-sticky .header-brand {
  gap: 5px;
}

header.header-dph.header-sticky .header-links {
  gap: 5px;
  margin-left: 4px;
}

/* Брейкпоинты */
@media (max-width: 980px) {
  .header-language-btn span.header-text {
    display: none;
  }
  .header-language-btn {
    padding: 10px;
  }
  header.header-dph.header-sticky .header-language-btn {
    padding: 5px;
  }
}

@media (max-width: 880px) {
  .header-links.header-primary {
    display: none;
  }
  .header-burger {
    display: flex;
  }
  header.header-dph {
    padding: 10px 12px;
  }
  header.header-dph.header-sticky {
    padding: 5px 6px;
  }
}

@media (max-width: 640px) {
  .header-btn {
    padding: 8px 12px;
    font-size: 13px;
  }
  header.header-dph.header-sticky .header-btn {
    padding: 4px 6px;
    font-size: 11px;
  }
  .header-logo {
    height: 40px;
  }
  header.header-dph.header-sticky .header-logo {
    height: 20px;
  }
  .header-right .header-links.header-user {
    display: none;
  }
  .header-menu {
    top: 70px;
  }
  .header-language-selector {
    display: none;
  }
  .header-cart-btn {
    order: 1;
  }
  .header-right > div:last-child {
    order: 2;
  }
}

@media (max-width: 480px) {
  header.header-dph {
    border-radius: 16px;
  }
  header.header-dph.header-sticky {
    border-radius: 0;
  }
  .header-brand {
    gap: 6px;
  }
  header.header-dph.header-sticky .header-brand {
    gap: 3px;
  }
  .header-icon-btn {
    padding: 8px 10px;
  }
  header.header-dph.header-sticky .header-icon-btn {
    padding: 4px 5px;
  }
}

@media (max-width: 360px) {
  .header-logo {
    height: 36px;
  }
  header.header-dph.header-sticky .header-logo {
    height: 18px;
  }
  .header-btn {
    padding: 7px 10px;
    font-size: 12px;
  }
  header.header-dph.header-sticky .header-btn {
    padding: 3px 5px;
    font-size: 10px;
  }
}

/* Стили для мобильного меню в ночном режиме */
html[data-theme="dark"] .header-menu {
  background: rgba(17,126,119,.30);
  border: 1px solid rgba(17,126,119,.2);
  box-shadow: 0 16px 40px rgba(0,0,0,.4), inset 0 1px 1px rgba(17,126,119,.15);
  backdrop-filter: blur(20px) saturate(160%);
}

html[data-theme="dark"] .header-menu a:hover {
  background: rgba(17,126,119,.2);
  box-shadow: inset 0 1px 1px rgba(17,126,119,.1);
}

/* Скрываем селектор языков */
.header-language-selector {
  display: none !important;
}

/* Скрываем языковой блок в мобильном меню */
.header-language-options-mobile {
  display: none !important;
}
