/* ========================================
HEADER
======================================== */

.header {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 20;
  width: 100%;
}

.header__inner {
  display: grid;
  grid-template-columns: 55% 45%;
  width: 100%;
}

.header__logo {
  width: 74px;
  margin-top: 18px;
  margin-left: var(--content-edge);
}

.header__logo img {
  width: 100%;
  height: auto;
}

.header__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 32px;
  padding-top: 36px;
  padding-right: var(--content-edge);
  padding-left: 30px;
}

.header__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
}

.header__icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.header__cart-button {
  position: relative;
}

.header__cart-count {
  position: absolute;
  top: -8px;
  right: -9px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border: 1px solid var(--white);
  border-radius: 50%;
  color: var(--white);
  background: var(--red);
  font-family: Arial, sans-serif;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
}

@media (max-width: 1200px) {
  .header__inner {
    grid-template-columns: 58% 42%;
  }
}

@media (max-width: 767px) {
  .header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .header__logo {
    width: 62px;
    margin: 14px 0 0 20px;
  }

  .header__actions {
    gap: 18px;
    padding: 20px 20px 0;
  }

  .header__icon {
    width: 24px;
    height: 24px;
    flex-basis: 24px;
  }

  .header__icon img {
    filter: brightness(0);
  }
}

@media (max-width: 420px) {
  .header__logo {
    width: 58px;
    margin-left: 18px;
  }

  .header__actions {
    gap: 15px;
    padding-right: 18px;
  }

  .header__icon {
    width: 22px;
    height: 22px;
    flex-basis: 22px;
  }
}


/* ========================================
DRAWER OVERLAYS
======================================== */

.cart-overlay,
.menu-overlay,
.search-overlay {
  position: fixed;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  background: rgba(17, 17, 17, 0.44);
  transition:
    opacity 0.28s ease,
    visibility 0.28s ease;
}

.cart-overlay,
.menu-overlay {
  z-index: 90;
}

.search-overlay {
  z-index: 110;
  background: rgba(20, 12, 10, 0.48);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.cart-overlay.is-active,
.menu-overlay.is-active,
.search-overlay.is-active {
  opacity: 1;
  visibility: visible;
}


/* ========================================
CART + MENU DRAWERS
======================================== */

.cart-drawer,
.menu-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  width: min(430px, 100%);
  height: 100dvh;
  background: var(--white);
  box-shadow: -18px 0 50px rgba(40, 20, 17, 0.14);
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-drawer.is-active,
.menu-drawer.is-active {
  transform: translateX(0);
}

.drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 86px;
  padding: 0 30px;
  border-bottom: 1px solid rgba(189, 64, 52, 0.13);
}

.drawer__title {
  margin: 0;
  font-size: 30px;
  font-weight: 400;
  line-height: 1;
}

.drawer__close {
  position: relative;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
}

.drawer__close span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 1px;
  background: var(--black);
}

.drawer__close span:first-child {
  transform: translate(-50%, -50%) rotate(45deg);
}

.drawer__close span:last-child {
  transform: translate(-50%, -50%) rotate(-45deg);
}


/* ========================================
CART DRAWER
======================================== */

.cart-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 30px;
}

.cart-drawer__empty {
  margin: 0;
  padding: 30px 0;
  color: rgba(17, 17, 17, 0.55);
  font-size: 16px;
  line-height: 1.5;
}

.cart-item {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 18px;
  padding: 22px 0;
  border-bottom: 1px solid rgba(17, 17, 17, 0.08);
}

.cart-item__image {
  display: block;
  width: 88px;
  height: 98px;
  overflow: hidden;
  background: #f7f2f0;
}

.cart-item__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item__content {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  padding: 3px 0;
}

.cart-item__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.cart-item__title {
  font-size: 17px;
  line-height: 1.3;
  transition: color 0.2s ease;
}

.cart-item__title:hover {
  color: var(--red);
}

.cart-item__remove {
  flex: 0 0 auto;
  color: rgba(17, 17, 17, 0.42);
  font-family: Arial, sans-serif;
  font-size: 24px;
  line-height: 20px;
}

.cart-item__bottom {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 16px;
}

.cart-item__bottom span {
  color: rgba(17, 17, 17, 0.5);
}

.cart-item__bottom strong {
  color: var(--red);
  font-weight: 700;
}

.cart-drawer__footer,
.menu-drawer__bottom {
  padding: 25px 30px 30px;
  background: #fffaf8;
  border-top: 1px solid rgba(189, 64, 52, 0.13);
}

.cart-drawer__subtotal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  font-size: 21px;
}

.cart-drawer__subtotal strong {
  color: var(--red);
  font-size: 22px;
}

.cart-drawer__actions {
  display: grid;
  gap: 10px;
}

.drawer-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 12px 20px;
  border: 1px solid var(--red);
  font-size: 17px;
  line-height: 1;
  transition:
    color 0.2s ease,
    background-color 0.2s ease;
}

.drawer-button--light {
  color: var(--red);
  background: var(--white);
}

.drawer-button--light:hover {
  color: var(--white);
  background: var(--red);
}

.drawer-button--red {
  color: var(--white);
  background: var(--red);
}

.drawer-button--red:hover {
  background: var(--red-dark);
}


/* ========================================
MENU DRAWER
======================================== */

.menu-drawer__nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  overflow-y: auto;
  padding: 16px 30px;
}

.menu-drawer__nav ul {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.menu-drawer__nav li {
  margin: 0;
  padding: 0;
}

.menu-drawer__nav a {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 30px 18px 0;
  border-bottom: 1px solid rgba(17, 17, 17, 0.08);
  font-size: 21px;
  line-height: 1.2;
  transition:
    color 0.2s ease,
    padding-left 0.2s ease;
}

.menu-drawer__nav a::after {
  content: "→";
  position: absolute;
  right: 0;
  color: var(--red);
  font-size: 22px;
}

.menu-drawer__nav a:hover {
  padding-left: 6px;
  color: var(--red);
}

.menu-drawer__bottom {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu-drawer__bottom a {
  width: max-content;
  max-width: 100%;
  font-size: 17px;
  line-height: 1.4;
  transition: color 0.2s ease;
}

.menu-drawer__bottom a:hover {
  color: var(--red);
}


/* ========================================
SEARCH
======================================== */

.search-panel {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 120;
  width: 100%;
  padding: 26px 0 34px;
  background: linear-gradient(135deg, #fff 0%, #fffaf8 100%);
  border-bottom: 1px solid rgba(189, 64, 52, 0.14);
  box-shadow: 0 18px 50px rgba(42, 23, 19, 0.13);
  transform: translateY(-105%);
  transition: transform 0.34s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-panel.is-active {
  transform: translateY(0);
}

.search-panel__container {
  width: min(var(--container), calc(100% - var(--gutter) * 2));
  margin: 0 auto;
}

.search-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  color: var(--red);
  font-size: 13px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.search-panel__header .drawer__close {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(189, 64, 52, 0.16);
  background: rgba(255, 255, 255, 0.7);
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease;
}

.search-panel__header .drawer__close:hover {
  border-color: rgba(189, 64, 52, 0.4);
  background: var(--white);
}

.search-panel__header .drawer__close span {
  background: var(--red);
}

.search-panel__form {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 68px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(189, 64, 52, 0.18);
  box-shadow: 0 10px 30px rgba(57, 34, 30, 0.07);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.search-panel__form:focus-within {
  border-color: rgba(189, 64, 52, 0.45);
  box-shadow: 0 14px 34px rgba(57, 34, 30, 0.1);
}

.search-panel__input {
  width: 100%;
  height: 68px;
  padding: 0 92px 0 24px;
  border: 0;
  outline: 0;
  color: var(--black);
  background: transparent;
  font: inherit;
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
}

.search-panel__input::placeholder {
  color: rgba(17, 17, 17, 0.35);
}

.search-panel__submit {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  background: var(--red);
  transition: background-color 0.2s ease;
}

.search-panel__submit:hover {
  background: var(--red-dark);
}

.search-panel__submit img {
  width: 25px;
  height: 25px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}


/* ========================================
HEADER DRAWERS MOBILE
======================================== */

@media (max-width: 767px) {
  .cart-drawer,
  .menu-drawer {
    width: min(390px, 92vw);
  }

  .drawer__header {
    min-height: 70px;
    padding: 0 20px;
  }

  .drawer__title {
    font-size: 26px;
  }

  .cart-drawer__body {
    padding: 4px 20px;
  }

  .cart-item {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 14px;
    padding: 18px 0;
  }

  .cart-item__image {
    width: 72px;
    height: 82px;
  }

  .cart-item__title {
    font-size: 15px;
  }

  .cart-item__bottom {
    font-size: 14px;
  }

  .cart-drawer__footer,
  .menu-drawer__bottom {
    padding: 20px;
  }

  .cart-drawer__subtotal {
    margin-bottom: 16px;
    font-size: 18px;
  }

  .cart-drawer__subtotal strong {
    font-size: 19px;
  }

  .drawer-button {
    min-height: 46px;
    font-size: 16px;
  }

  .menu-drawer__nav {
    padding: 12px 20px;
  }

  .menu-drawer__nav a {
    padding: 16px 28px 16px 0;
    font-size: 18px;
  }

  .menu-drawer__nav a:hover {
    padding-left: 4px;
  }

  .menu-drawer__bottom a {
    font-size: 16px;
  }

  .search-panel {
    padding: 18px 0 24px;
  }

  .search-panel__header {
    margin-bottom: 14px;
    font-size: 11px;
  }

  .search-panel__header .drawer__close {
    width: 32px;
    height: 32px;
  }

  .search-panel__form {
    min-height: 56px;
  }

  .search-panel__input {
    height: 56px;
    padding: 0 70px 0 16px;
    font-size: 17px;
  }

  .search-panel__submit {
    width: 56px;
    height: 56px;
  }

  .search-panel__submit img {
    width: 22px;
    height: 22px;
  }
}
