/* ============================
   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-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
  transition: opacity 0.2s ease;
}

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

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

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

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

.header-tag {
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  line-height: 1.2;
}

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

.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-section {
  padding: 12px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.mobile-menu-label {
  display: block;
  padding: 8px 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
}

.mobile-menu-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 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);
}

.mobile-menu-link svg {
  color: #94a3b8;
  flex-shrink: 0;
}

.mobile-menu-section .mobile-menu-link {
  padding-left: 32px;
  font-size: 15px;
  color: #475569;
}

/* ---------- 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;
  }
}

/* ========================================
   АДАПТИВ: МАЛЕНЬКИЕ ТЕЛЕФОНЫ
   ======================================== */

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

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

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

@media (min-width: 601px) and (max-width: 900px) {
  .header-brand-mobile .header-name {
    font-size: 15px;
  }
  
  .header-brand-mobile .header-tag {
    font-size: 12px;
  }
  
  .header-logo {
    width: 40px;
    height: 40px;
  }
}

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

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

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

  .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    text-decoration: none;
    border: none;
    background: transparent;
    cursor: pointer;
    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);
  }

  .services-dropdown {
    position: relative;
  }

  .services-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 240px;
    padding: 8px;
    
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
    
    display: none;
    flex-direction: column;
    gap: 2px;
    
    z-index: 1200;
    
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
  }

  .services-menu.open {
    display: flex;
    opacity: 1;
    transform: translateY(0);
  }

  .services-menu a {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    color: #475569;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
  }

  .services-menu a:hover {
    background: rgba(148, 163, 184, 0.08);
    color: #0f172a;
  }

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

  .header-phone {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    
    font-size: 14px;
    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: 16px;
    height: 16px;
    color: #0EA5A5;
  }

  .header-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
  }

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