/* ============================
   MOBILE-FIRST HEADER
   ============================ */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.site-header.hidden {
  transform: translateY(-100%);
}

.site-header .container {
  padding-block: 12px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* ---------- Логотип ---------- */

.header-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 8px;
  flex-shrink: 0;
}

/* ---------- Бренд ---------- */

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex-shrink: 0;
  transition: opacity 0.2s ease;
}

.header-brand:active {
  opacity: 0.7;
}

.header-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.header-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.header-tag {
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
}

/* ---------- Название для мобильных (скрыто по умолчанию) ---------- */

.header-brand-mobile {
  display: none;
  flex-direction: column;
  gap: 2px;
  text-decoration: none;
  text-align: center;
  transition: opacity 0.2s ease;
}

.header-brand-mobile:active {
  opacity: 0.7;
}

/* ---------- Навигация (скрыта на мобилке) ---------- */

.header-nav,
.header-actions {
  display: none;
}

/* ---------- Бургер-кнопка ---------- */

.nav-toggle-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.nav-toggle-btn:active {
  background: rgba(148, 163, 184, 0.15);
}

.nav-toggle-btn span {
  display: block;
  width: 20px;
  height: 2px;
  margin: 0 auto;
  background: #0f172a;
  border-radius: 2px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              opacity 0.3s ease;
}

.nav-toggle-btn.active span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle-btn.active span:nth-child(2) {
  opacity: 0;
}

.nav-toggle-btn.active span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ---------- МОБИЛЬНОЕ МЕНЮ (слайдер справа) ---------- */

.mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 85vw);
  background: #ffffff;
  box-shadow: -4px 0 24px rgba(15, 23, 42, 0.15);
  z-index: 1100;
  
  display: flex;
  flex-direction: column;
  
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu.active {
  transform: translateX(0);
}

.mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.mobile-menu-title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

.mobile-menu-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: #64748b;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.mobile-menu-close:active {
  background: rgba(148, 163, 184, 0.15);
  color: #0f172a;
}

.mobile-menu-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.mobile-menu-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 500;
  color: #0f172a;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.mobile-menu-link:active {
  background: rgba(148, 163, 184, 0.1);
}

/* ---------- Overlay ---------- */

.header-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.header-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ---------- ФИКСИРОВАННАЯ НИЖНЯЯ ПАНЕЛЬ ---------- */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999;
  
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  
  background: #ffffff;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
  
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 12px;
  
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  background: transparent;
  cursor: pointer;
  
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.bottom-nav-item:active {
  transform: scale(0.96);
}

.bottom-nav-cta {
  color: #ffffff;
  background: linear-gradient(135deg, #0EA5A5, #2563EB);
}

.bottom-nav-cta:active {
  background: linear-gradient(135deg, #0d9494, #1d4ed8);
}

.bottom-nav-phone {
  color: #0EA5A5;
  background: rgba(14, 165, 165, 0.08);
}

.bottom-nav-phone:active {
  background: rgba(14, 165, 165, 0.15);
}

.bottom-nav-item svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

/* ========================================
   АДАПТИВ: МОБИЛЬНЫЕ (до 900px)
   Лого слева, название по центру, бургер справа
   ======================================== */

@media (max-width: 900px) {
  .header-inner {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    align-items: center;
  }
  
  /* Лого без текста слева */
  .header-brand {
    grid-column: 1;
  }
  
  .header-brand .header-title-wrap {
    display: none;
  }
  
  /* Название по центру */
  .header-brand-mobile {
    display: flex;
    grid-column: 2;
    justify-self: center;
  }
  
  /* Бургер справа */
  .nav-toggle-btn {
    grid-column: 3;
  }
}

/* ========================================
   МАЛЫЕ ЭКРАНЫ (до 600px)
   ======================================== */

@media (max-width: 600px) {
  .header-brand-mobile .header-name {
    font-size: 15px;
  }

  .bottom-nav-item {
    font-size: 11px;
    padding: 8px 10px;
    gap: 2px;
  }

  .bottom-nav-item svg {
    width: 18px;
    height: 18px;
  }
}

/* ========================================
   ОЧЕНЬ МАЛЕНЬКИЕ ЭКРАНЫ
   ======================================== */

@media (max-width: 360px) {
  .header-brand-mobile .header-name {
    font-size: 13px;
  }
  
  .header-brand-mobile .header-tag {
    font-size: 10px;
  }
  
  .header-logo {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 340px) {
  .header-brand-mobile .header-name {
    font-size: 12px;
  }
  
  .header-brand-mobile .header-tag {
    font-size: 9px;
  }
  
  .header-logo {
    width: 34px;
    height: 34px;
  }
}

/* ========================================
   ПЛАНШЕТЫ (601px - 900px)
   ======================================== */

@media (max-width: 900px) and (min-width: 601px) {
  .header-brand-mobile .header-tag {
    display: block;
  }
  
  .header-logo {
    width: 42px;
    height: 42px;
  }
}

/* ========================================
   ДЕСКТОП (901px+)
   ======================================== */

@media (min-width: 901px) {
  .site-header .container {
    padding-block: 6px;
  }
  
  .header-inner {
    display: flex;
    justify-content: space-between;
  }
  
  .header-logo {
    width: 44px;
    height: 44px;
  }
  
  .header-brand .header-title-wrap {
    display: flex;
  }
  
  /* Скрываем мобильное название */
  .header-brand-mobile {
    display: none;
  }

  .header-nav {
    display: flex;
    align-items: center;
    gap: 0;
    flex: 1;
    justify-content: center;
  }

  .nav-link {
    display: inline-flex;
    align-items: center;
    padding: 5px 7px;
    border-radius: 5px;
    font-size: 11.5px;
    font-weight: 500;
    color: #64748b;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s ease, background-color 0.2s ease;
  }

  .nav-link:hover {
    color: #0f172a;
    background: rgba(148, 163, 184, 0.1);
  }

  .header-actions {
    display: flex;
    align-items: center;
    gap: 5px;
  }

  .header-phone {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 7px;
    border-radius: 5px;
    
    font-size: 11.5px;
    font-weight: 600;
    color: #0f172a;
    text-decoration: none;
    
    transition: background-color 0.2s ease;
  }

  .header-phone:hover {
    background: rgba(148, 163, 184, 0.08);
  }

  .header-phone svg {
    width: 13px;
    height: 13px;
    color: #0EA5A5;
  }

  .header-btn {
    padding: 6px 12px;
    font-size: 11.5px;
    font-weight: 600;
  }

  .header-name {
    font-size: 15px;
  }

  .header-tag {
    font-size: 11px;
  }

  /* Скрываем мобильные элементы */
  .nav-toggle-btn,
  .mobile-menu,
  .bottom-nav {
    display: none;
  }
}

/* Для больших экранов делаем чуть просторнее */
@media (min-width: 1400px) {
  .site-header .container {
    padding-block: 8px;
  }

  .nav-link {
    padding: 6px 9px;
    font-size: 12.5px;
  }

  .header-phone {
    padding: 6px 9px;
    font-size: 12.5px;
  }

  .header-phone svg {
    width: 14px;
    height: 14px;
  }

  .header-btn {
    padding: 7px 14px;
    font-size: 12.5px;
  }

  .header-name {
    font-size: 16px;
  }

  .header-tag {
    font-size: 12px;
  }

  .header-nav {
    gap: 0;
  }

  .header-actions {
    gap: 7px;
  }
}
