:root {
  --menu-width-mobile: 85vw;
  --menu-width-tablet: 220px;
  --menu-width-desktop: 260px;
  --transition-time: 660ms;
  --backdrop-color: rgba(0, 0, 0, 0.45);
  --menu-bg: #ffe235;
  --accent: #0066cc;
  --z-menu: 9999;
}

html,
body {
  margin: 0;
  height: 100%;
}

a {
  text-decoration: none;
  color: inherit;
  font-family: "Roboto", sans-serif;
}

.logo img {
  height: 15vh;
  width: auto;
  display: flex;
}

/* ---------------- HEADER ---------------- */
header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 12px 12px 20px;
  background: #ffe235;
  position: relative;
  z-index: calc(var(--z-menu) - 1);
  justify-content: space-between;
  flex: 1 0 auto;
}

/* Desktop nav (hidden on mobile) */
.desktop-nav {
  display: flex;
  margin-left: 20px;
}

.desktop-nav a {
  font-size: 22px;
  color: #222;
  padding: 6px 10px;
  border-radius: 6px;
  transition: 0.2s;
}

.desktop-nav a:hover {
  background: rgba(0, 0, 0, 0.05);
}

.active-page {
  font-weight: 700;
  color: #000;
}

/* --------- Hamburger (visible only on mobile) -------- */
.hamburger {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.hamburger .lines {
  width: 28px;
  height: 22px;
  position: relative;
}

.hamburger .lines span {
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  background: #111;
  border-radius: 3px;
  transition: transform var(--transition-time), opacity var(--transition-time);
}

.hamburger .lines span:nth-child(1) {
  top: 0;
}
.hamburger .lines span:nth-child(2) {
  top: 9px;
}
.hamburger .lines span:nth-child(3) {
  bottom: 0;
}

.hamburger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}
.hamburger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.hamburger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

/* ----------- MOBILE ONLY ----------- */
@media (max-width: 768px) {
  .header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    order: 3; /* Дії праворуч */
    padding-right: 10px;
  }

  .cart-icon {
    order: 1; /* Кошик перший */
  }

  .hamburger {
    order: 2; /* Бургер другий */
    display: inline-flex;
  }

  .desktop-nav {
    display: none;
  }
}

/* ----------- DESKTOP ONLY ----------- */
@media (min-width: 769px) {
  .header-actions {
    display: flex;
    align-items: center;
    padding-right: 20px;
  }

  .hamburger {
    display: none !important;
  }

  .desktop-nav {
    display: flex;
    order: 1; /* Меню перше */
    margin-right: 10px;
  }

  .cart-icon {
    order: 2; /* Кошик другий */
  }
}

/* ------------------- SLIDE MENU ------------------- */
.backdrop {
  position: fixed;
  inset: 0;
  background: transparent;
  pointer-events: none;
  transition: background var(--transition-time);
  z-index: 9998 !important;
}

.backdrop.visible {
  background: var(--backdrop-color);
  pointer-events: auto;
}

nav#menu {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: var(--menu-width-mobile);
  max-width: 100%;
  transform: translateX(110%);
  transition: transform var(--transition-time) cubic-bezier(0.2, 0.9, 0.2, 1);
  background: var(--menu-bg);
  box-shadow: -10px 0 25px rgba(0, 0, 0, 0.12);
  padding: 60px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999 !important;
}

nav#menu.open {
  transform: translateX(0);
}

#menu a.menu-item {
  display: block !important;
  font-size: 18px;
  padding: 12px 10px;
  border-radius: 8px;
  color: #111;
}

#menu a.menu-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

.menu-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 14px;
  color: #555;
}
