/* frontend/style.css */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,400;0,500;0,700;1,400&display=swap');

body {
  margin: 0;
  font-family: 'Montserrat', sans-serif;
  background: #fdfdfc;
  color: #5C4F49;
}

header {
  text-align: center;
  padding: 1rem;
  background-color: #f2e8df;
  font-size: 1.5rem;
  font-weight: 600;
}

main {
  display: grid;
  gap: 0.75rem;
  padding: 0.75rem;
  padding-bottom: 76px;
  max-width: 800px; /* ограничение максимальной ширины контейнера */
  margin: 0 auto; /* центрируем блок */
  
  grid-template-columns: repeat(2, 1fr); /* по умолчанию 2 колонки */
}

@media (min-width: 768px) {
  main {
    grid-template-columns: repeat(4, 1fr); /* от 768px — 4 колонки */
  }
}



.card {
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
}


.card img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

.card-content {
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #492714;
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}

.card-description {
  font-size: 11px;
  font-weight: 400;
  color: #5C4F49;
  margin: 0.2rem 0;
}

.card-nutrition {
  font-size: 10px;
  font-style: italic;
  font-weight: 400;
  color: #5C4F49;
  margin: 0.2rem 0;
}

.card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.card-weight {
  font-size: 11px;
  font-weight: 500;
  color: #5C4F49;
}

.card-price-add {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  height: 24px;
  margin-top: 0.3rem;
}

.price {
  background: #ffffff;
  color: #492714;
  padding: 0 6px;
  border-radius: 4px;
  font-weight: bold;
  font-size: 12px;
  height: 24px;
  display: flex;
  align-items: center;
}

.add-button {
  background: #EFD2A7;
  color: #492714;
  border: none;
  border-radius: 4px;
  padding: 0 6px;
  font-size: 12px;
  height: 24px;
  display: flex;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

/* Footer */
footer {
  position: fixed;
  bottom: 0;
  width: 100%;
  padding: 1rem;
  background: white;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
  text-align: center;
}

button#cart-button {
  background: #5C4F49;
  color: white;
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 75px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  color: #5C4F49;
  padding: 12px 24px;
  border-radius: 16px;
  box-shadow: 0 4px 15px rgba(92, 79, 73, 0.3);
  font-family: 'Montserrat', sans-serif;
  font-weight: 400;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 1000;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  pointer-events: auto;
}

.add-button svg {
  width: 18px;
  height: 18px;
}

.cart-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  padding: 0.75rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
  z-index: 999;
  font-family: 'Montserrat', sans-serif;
  font-size: 1rem;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;

  box-sizing: border-box;
  max-width: 100vw;
  overflow-x: hidden;
}

.cart-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cart-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-icon svg {
  width: 22px;
  height: 22px;
  stroke: #5C4F49;
  display: block;
}

.cart-info {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  font-size: 1rem;
}

.cart-label {
  font-weight: 500;
}

.cart-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 1;
  min-width: 0;
  font-size: 1rem;
}

#view-cart-button {
  background: #492714;
  color: white;
  border: none;
  border-radius: 999px;
  padding: 0.4rem 1rem;
  font-size: 1rem;
  font-family: 'Montserrat', sans-serif;
  font-weight: 400;
  cursor: pointer;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: transparent;
  margin-bottom: 1.5rem;
  padding: 0;
}

@media (max-width: 600px) {
  .cart-header,
  #checkout-form,
  #cart-items-list {
    max-width: 800px;
    margin: 0 auto;
    padding-left: 16px;
    padding-right: 16px;
    box-sizing: border-box;
  }

  #checkout-form input,
  #checkout-form textarea {
    width: 100%;
    max-width: 100%;
    font-size: 14px;
    padding: 12px 13px;
    box-sizing: border-box;
  }

  #checkout-page,
  #cart-page {
    padding: 0;
  }
}



.cart-title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  font-size: 20px;
  color: #492714;
  text-transform: uppercase;
  margin: 0 0 1rem 0; /* добавлен отступ снизу */
  text-align: left;
  flex: 1;
}

.cart-back-btn {
  background: none;
  border: none;
  color: #5C4F49;
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3em;
  padding-top: 4px;
}

.cart-back-btn svg {
  margin-left: 2px;
}

#cart-items-list > div {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border-bottom: 1px solid #eee;
}


.cart-item-title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 400;
  font-size: 14px;
  text-transform: capitalize;
  color: #5C4F49;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 0;
  min-width: 40; /* важно для корректного сжатия! */
}


.cart-qty-block {
  display: flex;
  align-items: center;
  border-radius: 0px;
  background: transparent;
  overflow: hidden;
  margin-left: 4px;
  min-width: 88px;
}

.cart-qty-btn {
  background: #eeeeee;
  color: #5C4F49;
  border: 0px;
  width: 22px;
  max-width: 22px;
  height: 22px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-qty-count {
  min-width: 24px;
  text-align: center;
  font-size: 14px;
  font-family: 'Montserrat', sans-serif;
  color: #5C4F49;
  background: transparent;
  font-weight: 500;
}

.cart-item-price {
  width: 75px;
  text-align: right;
  font-size: 14px;
  font-family: 'Montserrat', sans-serif;
  color: #5C4F49;
  font-weight: 400;
}

.cart-remove-btn {
  background: none;
  border: none;
  color: #5C4F49;
  font-size: 22px;
  cursor: pointer;
  margin-left: 4px;
  margin-top: 0px;
  padding: 0; 
}

.cart-continue-btn {
  width: 100%;
  background: #492714;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 14px 0;
  font-size: 16px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
  cursor: pointer;
  margin-top: 5px;
}


#cart-summary span {
  /* Оба span одинаковы, так что можно просто так */
  font-family: 'Montserrat', sans-serif;
}

#cart-subtotal {
  font-weight: 500;
  font-size: 16px;
  letter-spacing: 0.02em;
}

/* CHECKOUT PAGE (DELIVERY FORM) — структурно и в стиле проекта */

/* Контейнер формы */
#checkout-page {
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}

/* Поля формы */
#checkout-form input[type="text"],
#checkout-form input[type="tel"],
#checkout-form input[type="email"],
#checkout-form input[type="number"],
#checkout-form textarea {
  width: 100%;
  background: #faf9f8;
  border: 1.5px solid #e2e2e2;
  border-radius: 10px;
  font-size: 14px;
  color: #5C4F49;
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
  padding: 14px 16px;
  margin-bottom: 12px;
  box-sizing: border-box;
  transition: border-color 0.25s, background 0.18s;
  outline: none;
  appearance: none;
}

#checkout-form input:focus,
#checkout-form textarea:focus {
  background: #fff;
  border-color: #5C4F49;
}

#checkout-form input::placeholder,
#checkout-form textarea::placeholder {
  color: #d3d3d3; /* светло-серый как в Apple */
  font-size: 14px;
  font-weight: 400;
  opacity: 1;
}

/* Custom Switch (Pick up toggle) */
.pickup-switch-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;    /* как у других полей */
  margin-top: 0;          /* убрать лишний верхний отступ */
  font-size: 14px;
  color: #5C4F49;
  font-family: 'Montserrat', sans-serif;
}


.pickup-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  vertical-align: middle;
}

.pickup-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.pickup-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc;
  transition: background 0.25s;
  border-radius: 24px;
}
.pickup-slider:before {
  position: absolute;
  content: "";
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background-color: white;
  transition: .25s;
  border-radius: 50%;
}

.pickup-switch input:checked + .pickup-slider {
  background-color: #5C4F49;
  box-shadow: 0 2px 12px rgba(92,79,73,0.10) inset;
}
.pickup-switch input:checked + .pickup-slider:before {
  transform: translateX(20px);
}

/* Блок саммари (subtotal/delivery/total) как в корзине */
#checkout-summary {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0;
  font-weight: 500;
  font-size: 16px;
  color: #5C4F49;
  margin-bottom: 1rem;
  margin-top: 1rem;
  border-radius: 10px;
}
#checkout-summary .summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
  font-size: 16px;
}
#checkout-summary .summary-row.total {
  font-weight: 600;
}

/* Кнопка "Place Order" — используем .cart-continue-btn */
/* .cart-continue-btn уже есть — ничего менять не надо */

/* Плавная анимация для инпутов, switch, toggle */

.address-wrapper {
  position: relative;
  width: 100%;
  margin-bottom: 12px;
}

.address-wrapper input[type="text"] {
  width: 100%;
  padding-right: 50px;  /* место под кнопку */
  background: #faf9f8;
  border: 1.5px solid #e2e2e2;
  border-radius: 10px;
  font-size: 14px;
  color: #5C4F49;
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
  height: 48px;          /* фиксируем высоту! */
  box-sizing: border-box;
  transition: border-color 0.25s, background 0.18s;
}

.address-wrapper button {
  position: absolute;
  top: 0;
  right: 0;
  height: 48px;           /* такая же, как у input */
  width: 48px;
  background-color: #5C4F49;
  border: none;
  border-radius: 0 10px 10px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: background 0.18s;
  padding: 0;             /* убираем лишний padding */
}

.address-wrapper button svg {
  display: block;
}

.address-wrapper input[type="text"]:focus + button,
.address-wrapper button:focus {
  background: #492714;
}

@media (max-width: 600px) {
  .address-wrapper input[type="text"], .address-wrapper button {
    height: 44px;
    font-size: 13px;
  }
  .address-wrapper button {
    width: 44px;
  }
}



.switch-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 14px;
  color: #5C4F49;
  font-family: 'Montserrat', sans-serif;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  vertical-align: middle;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc;
  transition: background 0.25s;
  border-radius: 24px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background-color: white;
  transition: .25s;
  border-radius: 50%;
}
.switch input:checked + .slider {
  background-color: #5C4F49;
  box-shadow: 0 2px 12px rgba(92,79,73,0.10) inset;
}
.switch input:checked + .slider:before {
  transform: translateX(20px);
}

.cart-bottom-sticky {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 600px;
  background: white !important;
  z-index: 99;
  box-shadow: 0 -2px 16px 0 rgba(92,79,73,0.08);
  padding: 16px 1.25rem 16px 1.25rem !important;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  border-radius: 10px;
  box-sizing: border-box;
}


@media (max-width: 650px) {
  .cart-bottom-sticky {
    max-width: 100vw;
    left: 0;
    transform: none;
  }
}

@media (min-width: 801px) {
  .cart-bottom-sticky {
    bottom: 20px;  
    max-width: 400px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.08);
  }
}


/* Если разделительная линия нужна только на чекауте — добавляй класс divider только там */
.cart-bottom-divider {
  width: 100%;
  height: 2px;
  background: #ffffff;
  margin: 0 0 14px 0;
  border-radius: 2px;
  box-shadow: 0 1px 0 #fff inset;
  display: none; /* по дефолту скрыто */
}

/* summary block — left/right, column, gap */
#cart-summary,
#checkout-summary {
  display: flex;
  flex-direction: column;
  margin-top: 0;
  margin-bottom: 0;
  gap: 4px;
  padding: 0 0 0.6rem 0;
  font-size: 16px;
}

#cart-summary .summary-row,
#checkout-summary .summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Montserrat', sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: #5C4F49;
}


#cart-summary .summary-row.total,
#checkout-summary .summary-row.total {
  font-weight: 600;
  font-size: 16px;
  margin-top: 2px;
  color: #492714;
}

/* padding-bottom для контента cart и checkout чтобы не перекрывало нижний блок */
#checkout-form,
#cart-page {
  padding-bottom: 180px;
}



/* Кнопка */
.cart-continue-btn, #checkout-submit {
  margin-top: 6px;
  width: 100%;
  border-radius: 13px;
  font-size: 18px;
  font-weight: 600;
  box-shadow: 0 4px 18px rgba(73,39,20,0.10);
  background: #492714;
  color: #fff;
  padding: 16px 0;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

.cart-continue-btn:hover, #checkout-submit:hover {
  background: #5C4F49;
}

.cart-bottom-cart {
  padding: 12px 1.25rem 12px 1.25rem !important;
}
.cart-bottom-checkout {
  padding: 12px 1.25rem 12px 1.25rem !important;
}

.cart-bottom-cart, .cart-bottom-checkout {
  padding: 16px 1.25rem 16px 1.25rem !important; /* для гарантии */
}

.cart-continue-btn, #checkout-submit {
  margin-top: 16px !important; /* увеличить отступ сверху */
}

/* Header Styles */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background-color: #ffffff;
  padding: 8px 16px;
  z-index: 1000;
  font-family: 'Montserrat', sans-serif;
  transition: box-shadow 0.3s ease;
  box-sizing: border-box;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 800px;
  margin: 0 auto;
  box-sizing: border-box;
}

.logo {
  flex: 0 0 auto; /* лого не сжимается */
  display: flex;
  align-items: center;
}

.logo svg {
  height: 28px;
  display: block;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 16px;
  padding-bottom: 16px;
  flex: 0 1 auto; /* разрешаем навигации сжиматься до минимального размера */
  justify-content: flex-end;
}

.nav-link {
  font-size: 12px;
  font-weight: 600;
  color: #5C4F49;
  line-height: 15px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap; /* не переносим ссылки */
  transition: opacity 0.2s;
}

.nav-link:hover {
  opacity: 0.7;
}

main {
  padding-top: 64px;
}

#cart-page,
#checkout-page {
  padding-top: 68px; /* 64px высота site-header + небольшой отступ */
}

.menu-category-title {
  grid-column: 1 / -1;
  font-size: 18px;
  font-weight: 500;
  color: #5C4F49;
  text-transform: uppercase;
  margin-top: 1.5rem;
  margin-bottom: 0.25rem;
  letter-spacing: 0.5px;
}

#checkout-success {
  margin-top: 16px;
  padding: 0 1.25rem;
  font-size: 15px;
  line-height: 1.6;
  color: #5C4F49;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

/* Toggle Inside / Delivery */
.view-toggle {
  /* Занять всю ширину грида */
  grid-column: 1 / -1;
  display: inline-flex;
  width: 100%;
  background: #ffffff;
  border: 1px solid #5C4F49;
  border-radius: 10px;
  overflow: visible;        /* чтобы активный таб мог “наезжать” */
}

.view-toggle__btn {
  flex: 1;
  padding: 0.75rem 1rem;
  /* Montserrat Medium 16px на десктопе */
  font: 500 14px 'Montserrat', sans-serif;
  color: #492714;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
  z-index: 1;

  /* Новое: центрируем содержимое и убираем подчёркивание для ссылок */
  display: flex;
  justify-content: center;
  align-items: center;
  text-decoration: none;
}

.view-toggle__btn--active {
  background: #5C4F49;
  color: #ffffff;
  position: relative;
  margin-right: -1px;       /* немного “заехать” на соседний таб */
  z-index: 2;
}

/* Скругления по краям сохраняются */
.view-toggle__btn:first-child {
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
}
.view-toggle__btn:last-child {
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}

/* Мобильная адаптация */
@media (max-width: 800px) {
  .view-toggle__btn {
    padding: 0.5rem 0.75rem;
    /* Montserrat Medium 14px на мобильных */
    font: 500 14px 'Montserrat', sans-serif;
  }
}
