/* ==========================================
   ШАПКА САЙТУ (css/header.css)
   Компанія: APFEL EXPERT (APFEL GROUP)
   ========================================== */

/* 1. Прозора шапка на самому верху сторінки */
.header {
  position: fixed;
  top: 0 !important;
  left: 0;
  width: 100%;
  z-index: 1000;
  min-height: 84px;
  display: flex;
  align-items: center;
  padding: 18px 0;
  background-color: transparent;
  box-shadow: none;
  
  /* Апаратне прискорення GPU, щоб шапка "не відривалася" */
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  will-change: background-color, box-shadow, padding, min-height;

  transition: background-color 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.35s ease,
              padding 0.35s ease,
              min-height 0.35s ease;
}

/* 2. Стан при скролі: біла скляна шапка */
.header.is-scrolled {
  background-color: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  min-height: 72px;
  padding: 12px 0;
}

.header__container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
}

/* --- ЛОГОТИП --- */
.logo {
  display: flex;
  align-items: center;
  z-index: 1100;
  flex-shrink: 0;
}

.logo__img {
  max-height: 44px;
  width: auto;
  display: block;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo:hover .logo__img {
  transform: scale(1.03);
}

/* --- НАВІГАЦІЯ (ПК) --- */
.nav__list {
  display: flex;
  align-items: center;
  gap: 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav__link {
  position: relative;
  font-weight: 600;
  font-size: 0.95rem;
  color: #FFFFFF !important;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.65);
  padding: 6px 0;
  transition: color 0.3s ease;
  white-space: nowrap;
  text-decoration: none;
}

.header.is-scrolled .nav__link {
  color: #0F172A !important;
  text-shadow: none;
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2.5px;
  background-color: #63AF38;
  border-radius: 2px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav__link:hover,
.nav__link.is-active {
  color: #63AF38 !important;
}

.nav__link:hover::after,
.nav__link.is-active::after {
  width: 100%;
}

.nav__mobile-footer {
  display: none;
}

/* ==========================================
   ПРАВИЙ БЛОК НА ПК: ТЕЛЕФОН + ІКОНКИ + КНОПКА
   ========================================== */
.header__actions {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 0;
  transition: gap 0.35s ease;
}

.header.is-scrolled .header__actions {
  gap: 18px;
}

.header__contacts {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  gap: 12px !important;
  white-space: nowrap;
}

.header__phone {
  font-weight: 700;
  font-size: 1.05rem;
  color: #FFFFFF !important;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.65);
  white-space: nowrap;
  line-height: 1;
  transition: color 0.3s ease;
  text-decoration: none;
}

.header.is-scrolled .header__phone {
  color: #0F172A !important;
  text-shadow: none;
}

.header__phone:hover {
  color: #63AF38 !important;
}

.header__messengers {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px !important;
}

.messenger-icon-link {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 32px !important;
  height: 32px !important;
  border-radius: 50%;
  flex-shrink: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.messenger-icon-link img {
  width: 28px !important;
  height: 28px !important;
  max-width: 28px !important;
  max-height: 28px !important;
  object-fit: contain;
  display: block;
}

.messenger-icon-link:hover {
  transform: translateY(-2px);
  opacity: 0.85;
}

/* КНОПКА "ЗАМОВИТИ ДЗВІНОК" (ПК) */
.header__btn {
  display: none !important;
  opacity: 0;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.header.is-scrolled .header__btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  opacity: 1;
  pointer-events: auto;
  padding: 10px 20px !important;
  font-size: 0.9rem !important;
  border-radius: 10px !important;
}

/* --- ПРЕМІАЛЬНИЙ ГАМБУРГЕР --- */
.burger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 21px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1100;
}

.burger__line {
  width: 100%;
  height: 2.5px;
  background-color: #FFFFFF;
  border-radius: 2px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.header.is-scrolled .burger__line,
.nav.is-open ~ .burger .burger__line {
  background-color: #0F172A;
}

.burger.is-active .burger__line:nth-child(1) { transform: translateY(9px) rotate(45deg); }
.burger.is-active .burger__line:nth-child(2) { opacity: 0; }
.burger.is-active .burger__line:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

/* ==========================================
   АДАПТИВНІСТЬ ДЛЯ ПЛАНШЕТІВ ТА СМАРТФОНІВ
   ========================================== */

@media (max-width: 1024px) {
  .burger {
    display: flex;
  }

  .header__actions {
    display: none !important;
  }

  /* 
   * Мобільне меню-шторка
   * ФІКС ЛАГІВ: Замість 'left: -100%' використовуємо 'transform: translateX(-100%)' 
   * Це переносить анімацію на відеокарту, роблячи її миттєвою та плавною.
   */
  .nav {
    position: fixed;
    top: 0;
    left: 0;
    transform: translateX(-100%);
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background-color: #FFFFFF;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 85px 24px 32px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    z-index: 1050;
    
    /* Анімація через GPU */
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
  }

  /* Стан відкритого меню */
  .nav.is-open {
    transform: translateX(0);
  }

  .nav__list {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
    width: 100%;
  }

  .nav__link {
    font-size: 1.35rem;
    font-weight: 700;
    color: #0F172A !important;
    text-shadow: none;
    display: block;
    width: 100%;
  }

  .nav__link::after {
    display: none;
  }

  .nav__mobile-footer {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #E2E8F0;
    width: 100%;
  }

  .nav__mobile-phone {
    font-size: 1.4rem;
    font-weight: 800;
    color: #0F172A;
    text-decoration: none;
  }

  .nav__mobile-address {
    font-size: 0.88rem;
    color: #64748B;
    line-height: 1.4;
    margin: 0;
  }

  .nav__mobile-messengers {
    display: flex;
    gap: 12px;
    margin: 2px 0 8px;
  }

  .nav__mobile-btn {
    width: 100%;
    padding: 15px !important;
    font-size: 1rem !important;
    border-radius: 12px !important;
  }
}

@media (max-width: 600px) {
  .header {
    min-height: 68px;
    padding: 12px 0;
  }

  .header.is-scrolled {
    min-height: 64px;
    padding: 10px 0;
  }

  .logo__img {
    max-height: 38px;
  }

  .nav {
    padding: 80px 20px 24px;
  }

  .nav__list {
    gap: 18px;
  }

  .nav__link {
    font-size: 1.28rem;
  }

  .nav__mobile-phone {
    font-size: 1.3rem;
  }
}