/* =========================
   CART.CSS — ONLY CART STYLES
   Подключать ПОСЛЕ style.css
   ========================= */

/* =========================
   CART (FINAL)
   ========================= */

.cart-overlay{
  position:fixed; inset:0;
  background: rgba(11,18,32,.22);
  opacity:0; pointer-events:none;
  transition:.2s ease;
  z-index:90;
  backdrop-filter: blur(2px);
}

.cart{
  position:fixed;
  top:16px;
  right:16px;
  bottom:16px;
  height: calc(100vh - 32px);
  width:min(420px, 92vw);

  /* ✅ УБИРАЕМ “ЕДИНЫЙ БЕЛЫЙ БЛОК” */
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;

  border-radius: 26px;
  border: 0;
  box-shadow: none;

  transform: translateX(120%);
  transition:.25s ease;

  z-index:100;
  display:flex;
  flex-direction:column;

  /* ✅ чтобы внутренние карточки выглядели раздельно */
  overflow: visible;
  padding: 12px;
}

body.cart-open .cart{transform:translateX(0)}
body.cart-open .cart-overlay{opacity:1; pointer-events:auto}

.cart__head{
  padding:14px;
  border-bottom:0;
  display:flex;
  justify-content:space-between;
  align-items:center;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(11,18,32,.10);
  border-radius: 22px;
  box-shadow: 0 18px 40px rgba(11,18,32,.10);
  margin-bottom: 14px;
}
.cart__title{font-weight:950}

.cart__content{
  flex:1;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  padding:0;

  display:flex;
  flex-direction:column;
  gap:5px;

  background: transparent; /* ← ОСТАВИТЬ ТОЛЬКО ЭТО */
}

/* верх: состав заказа */
.cart__itemsWrap{
  display:flex;
  flex-direction:column;
  gap:12px;

  padding:16px;
  background: rgba(255,255,255,.98);
  border: 1px solid rgba(11,18,32,.10);
  border-radius: 22px;

  box-shadow: 0 10px 24px rgba(11,18,32,.06);
}

.cart__divider{
  flex:0 0 auto;
  height:0px;
  margin: 0;
  position: relative;
}

.cart__divider::before{ display:none !important; }

/* низ: контакты */
.cart__checkout{
  flex:0 0 auto;
  padding:16px;

  background: rgba(255,255,255,.98);
  border: 0;
  border-radius: 22px;

  box-shadow: 0 18px 40px rgba(11,18,32,.10);
}

.cart__section-title{
  font-weight:900;
  font-size:18px;
  margin: 6px 0 12px;
}

/* actions: товаров + очистить */
.cart__itemsActions{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin: 0 0 12px;
}
.cart__itemsMeta{
  font-size: 13px;
  color: rgba(98,112,137,.98);
}

/* кнопка очистки */
.cart__clearBtn{
  appearance:none;
  border:1px solid rgba(255, 42, 55, .25);
  color:#ff2a37;

  background: rgba(255,42,55,.06);

  border-radius:6px;

  padding:6px 10px;        /* ⬅ меньше */
  font-size:12px;          /* ⬅ меньше */
  font-weight:700;

  cursor:pointer;
  transition:.18s ease;

  box-shadow:none;         /* ⬅ убрали жирную тень */
}
.cart__clearBtn:hover{
  background: linear-gradient(180deg, rgba(255,42,55,.18), rgba(255,42,55,.10));
  box-shadow: 0 14px 30px rgba(255, 42, 55, .18);
}
.cart__clearBtn:active{ transform: translateY(1px); }

/* поля */
.field{margin-bottom:12px}
.field label{
  display:block;
  font-size:12px;
  color:rgba(98,112,137,.98);
  margin:0 0 6px;
}
.field input, .field textarea{
  width:100%;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(11,18,32,.12);
  background:#fff;
  outline:none;
  transition:.15s ease;
}
.field input:focus, .field textarea:focus{
  border-color: rgba(238,123,22,.34);
  box-shadow: 0 0 0 4px rgba(238,123,22,.14);
}

.check{
  display:flex;
  gap:10px;
  align-items:flex-start;
  font-size:13px;
  color:rgba(98,112,137,.98);
  margin-bottom:12px;
}
.check input{margin-top:3px}

/* список товаров */
.cart__items{
  display:flex;
  flex-direction:column;
  gap:12px;

  max-height: 300px;      /* ✅ лимит на ПК */
  overflow-y: auto;       /* ✅ дальше скролл */
  padding-right: 6px;
  overscroll-behavior: contain;
}


/* строки товаров */
.cart-row{
  display:grid;
  grid-template-columns: 84px 1fr auto;
  align-items:center;
  gap:14px;
  padding:12px;
  position:relative;

  background: rgba(255,255,255,.98);
  border: 1px solid rgba(11,18,32,.08);
  border-radius: 18px;
  box-shadow: 0 16px 34px rgba(11,18,32,.07);
}

.cart-row__img{
  width:84px;
  height:76px;
  flex: 0 0 84px;
  border-radius:18px;
  overflow:hidden;

  background: linear-gradient(180deg, rgba(255,255,255,.99), rgba(238,242,247,.97));
  border:1px solid rgba(11,18,32,.10);

  display:flex;
  align-items:center;
  justify-content:center;

  object-fit: contain;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.96),
    0 10px 20px rgba(11,18,32,.06);

  padding:6px;
}
.cart-row__img--ph{
  background: linear-gradient(180deg, rgba(255,255,255,.99), rgba(238,242,247,.97));
}

.cart-row__img img{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
}


.cart-row__main{min-width:0}
.cart-row__title{
  font-weight:800;
  font-size:15px;
  line-height:1.15;
  margin-bottom:6px;

  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.cart-row__prices{
  font-size:13px;
  color: rgba(11,18,32,.55);
  display:flex;
  gap:6px;
  align-items:center;
}

.cart-row__controls{
  display:flex;
  align-items:center;
  gap:8px;
}

.qtybtn{
  width:28px;
  height:28px;
  border-radius:10px;
  border:1px solid rgba(11,18,32,.12);
  background: rgba(11,18,32,.04);
  cursor:pointer;
  font-weight:900;
  line-height:1;
}
.qtynum{
  width:18px;
  text-align:center;
  font-weight:900;
  font-size:13px;
}

/* пустая корзина */
.cart-empty{
  padding:14px;
  border-radius:18px;
  background: rgba(11,18,32,.04);
  border:1px solid rgba(11,18,32,.08);
}
.cart-empty__title{font-weight:900}

/* скроллбар — на cart__content */
.cart__content::-webkit-scrollbar{ width: 9px; }
.cart__content::-webkit-scrollbar-thumb{
  background: rgba(11,18,32,.18);
  border-radius: 12px;
}
.cart__content::-webkit-scrollbar-track{
  background: rgba(11,18,32,.05);
  border-radius: 12px;
}

/* =========================
   OPTIONAL: FIXED "ИТОГО" FOOTER
   Работает ТОЛЬКО если в HTML есть:
   <div class="cart__footer"><div class="cart__summary">...</div></div>
   ========================= */


.cart__footer{ display:none !important; }

.cart__summary{
  margin:0;
  padding: 12px 14px;

  display:flex;
  justify-content:space-between;
  align-items:center;

  background: rgba(255,255,255,.96);
  border:1px solid rgba(11,18,32,.10);
  border-radius: 18px;
  backdrop-filter: blur(10px);
  box-shadow: 0 -10px 22px rgba(11,18,32,.08);
}


/* =========================
   MOBILE
   ========================= */

@media(max-width:520px){
  .cart{
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    top: 8px; right: 8px; bottom: 8px; left: 8px;
    border-radius: 22px;
  }

  /* ✅ на мобиле показываем ~3 товара, дальше скроллим список */
  .cart__items{
    max-height: 320px;         /* подгони 280–360px если надо */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 6px;
    overscroll-behavior: contain; /* ✅ чтобы скролл не “пробивался” дальше */
  }

  /* футер "итого" на мобиле */
  .cart__footer{
    left:12px;
    right:12px;
    bottom:12px;
  }

  /* товарная строка (объединил в один блок) */
  .cart-row{
  padding:10px;
  grid-template-columns: 72px 1fr;
  grid-template-rows: auto auto;
  align-items:start;
  gap:10px;
}

  .cart-row__img{
  width:72px;
  height:64px;
  flex: 0 0 72px;
}

  .cart-row__title{
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }

  .cart-row__controls{
    grid-column: 1 / -1;
    justify-content:flex-end;
    padding-top:6px;
    gap:10px;
  }

  .qtybtn{ width:34px; height:34px; border-radius:12px; }
  .qtynum{ width:28px; font-size:14px; }
}

/* =========================
   CART PILL (CLEAN)
   ========================= */

.cart-pill{
  display:inline-flex;
  align-items:center;
  gap:12px;

  height:58px;
  padding:0;

  border-radius:18px;
  border:0;
  outline:0;
  -webkit-appearance:none;
  appearance:none;

  background: transparent;
  box-shadow:none;
  filter:none;

  cursor:pointer;
  user-select:none;
  -webkit-tap-highlight-color: transparent;

  transition: transform .12s ease, filter .18s ease;
}

.cart-pill:focus,
.cart-pill:focus-visible,
.cart-pill:active{
  outline:0;
  box-shadow:none;
}

.cart-pill:hover{ transform: translateY(-1px); }
.cart-pill:active{ transform: translateY(0); filter: brightness(.98); }

.cart-pill__icon{
  width:44px;
  height:44px;
  border-radius:14px;
  display:block;

  background:#ff6900;
  box-shadow:none;

  background-image: url("../../img/cart-icon.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 22px 22px;

  position:relative;
  overflow:hidden;
}
.cart-pill__icon::before{ display:none; }

.cart-pill__text{
  display:flex;
  flex-direction:column;
  line-height:1.05;
  align-items:flex-start;
}

.cart-pill__sum{
  font-family:"Unbounded","Manrope",sans-serif;
  font-weight:500;
  font-size:13px;
  letter-spacing:-0.15px;
  font-variant-numeric: tabular-nums;
  color:#111;
  opacity:.9;
}

.cart-pill__qty{
  font-size:12px;
  font-weight:500;
  letter-spacing:-0.1px;
  color:#666;
  opacity:.8;
}

@media (max-width: 520px){
  .cart-pill{ padding:0; margin-right:15px; }
}

/* =========================
   CART TOAST
   ========================= */

.cart-toast{
  position: fixed;
  right: 18px;
  top: 86px;
  bottom: auto;
  width: 320px;
  max-width: calc(100vw - 30px);

  background: #1f2428;
  border: 1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);

  color: #fff;
  border-radius: 18px;
  padding: 12px 14px;

  transform: translateX(120%);
  opacity: 0;
  transition: transform .25s ease, opacity .25s ease;
  z-index: 300;

  touch-action: pan-y;
  box-shadow:
    0 22px 60px rgba(11,18,32,.28),
    0 10px 26px rgba(11,18,32,.18);

  overflow: hidden;
}

.cart-toast.is-show{ transform: translateX(0); opacity: 1; }
.cart-toast.is-dragging{ transition:none; }

.cart-toast__inner{
  position: relative;
  z-index: 1;
  display:flex;
  gap:12px;
  align-items:flex-start;
}

.cart-toast__icon{
  width:40px;
  height:40px;

  background-image: url("../../img/check.png");
  background-repeat:no-repeat;
  background-position:center;
  background-size:28px 28px;

  background-color: transparent;
  border: none;
  box-shadow: none;
}

.cart-toast__title{
  font-family: "Manrope", sans-serif;
  font-weight:600;
  font-size:14px;
  line-height:1.3;
  letter-spacing:0;
  color:#ffffff;
}

.cart-toast__action{
  display:inline;
  margin-top:6px;

  font-size:14px;
  font-weight:600;
  color:#ff8a1a;

  padding:0;
  border:0;
  background:none;
  border-radius:0;

  text-decoration:none;
  transition: opacity .15s ease;
}
.cart-toast__action::after{ display:none; }
.cart-toast__action:hover{ opacity:.7; }

.cart-toast__bar{
  position: relative;
  z-index: 1;
  height:2px;
  margin-top:10px;
  border-radius:999px;
  background: rgba(255,255,255,.12);
  overflow:hidden;
}

.cart-toast.is-show .cart-toast__bar::after{
  content:"";
  display:block;
  height:100%;
  width:100%;
  background: rgba(238,123,22,.9);
  transform: translateX(-100%);
  animation: toastBar 2.2s linear forwards;
}
@keyframes toastBar{ to { transform: translateX(0); } }

@media (max-width: 520px){
  .cart-toast{
    left: 50%;
    right: auto;
    width: calc(100vw - 32px);
    max-width: 360px;
    top: 78px;

    transform: translateX(-50%) translateX(120%);
  }
  .cart-toast.is-show{
    transform: translateX(-50%) translateX(0);
  }
}
/* "Итого" внутри карточки "Состав заказа" */
.cart__summary--items{
  margin-top: 14px;
  box-shadow: none;          /* чтобы было как часть верхней карточки */
  backdrop-filter: none;
}
/* Полное отображение названия товара */
.cart-row__title{
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  overflow-wrap: anywhere;
  line-height: 1.25;
}
/* =========================
   DARK CART THEME (override)
   ВСТАВЬ В САМЫЙ КОНЕЦ cart.css
   ========================= */

:root{
  --cartBg: rgba(20,22,26,.92);
  --cartCard: rgba(26,29,34,.92);
  --cartLine: rgba(255,255,255,.10);
  --cartText: rgba(255,255,255,.92);
  --cartMuted: rgba(255,255,255,.62);
  --cartField: rgba(255,255,255,.06);
}

/* фон секций */
.cart__head,
.cart__itemsWrap,
.cart__checkout,
.cart-row,
.cart__summary,
.cart__summary--items{
  background: var(--cartCard) !important;
  border-color: var(--cartLine) !important;
  color: var(--cartText) !important;
}

/* заголовки */
.cart__title,
.cart__section-title{
  color: var(--cartText) !important;
}

/* вторичный текст */
.cart__itemsMeta,
.cart-row__prices,
.field label,
.check{
  color: var(--cartMuted) !important;
}

/* поля ввода */
.field input,
.field textarea,
.field select{
  background: var(--cartField) !important;
  border-color: var(--cartLine) !important;
  color: var(--cartText) !important;
}
.field input::placeholder,
.field textarea::placeholder{
  color: rgba(255,255,255,.45) !important;
}

/* фокус */
.field input:focus,
.field textarea:focus,
.field select:focus{
  border-color: rgba(255,42,55,.45) !important;
  box-shadow: 0 0 0 4px rgba(255,42,55,.14) !important;
}

/* кнопки +/- */
.qtybtn{
  background: rgba(255,255,255,.08) !important;
  border-color: var(--cartLine) !important;
  color: var(--cartText) !important;
}

/* картинка товара */
.cart-row__img{
  background: linear-gradient(180deg, rgba(255,255,255,.99), rgba(238,242,247,.97)) !important;
  border-color: var(--cartLine) !important;
}

/* чекбокс */
.check input{
  accent-color: #ff2a37;
}

/* кнопка оформить (если у тебя своя — она останется, но будет в тему) */
.cart__checkout button,
.cart__checkout .btn,
.cart__checkout .btn-primary{
  color: #fff !important;
}

/* overlay чуть темнее */
.cart-overlay{
  background: rgba(0,0,0,.55) !important;
}
/* ===== DARK SCROLLBAR FOR CART ===== */

.cart__content{
  scrollbar-width: thin;                /* Firefox */
  scrollbar-color: #555 #1b1e22;        /* thumb / track */
}

/* Chrome / Edge / Safari */
.cart__content::-webkit-scrollbar{
  width: 10px;
}

.cart__content::-webkit-scrollbar-track{
  background: #1b1e22;  /* фон */
  border-radius: 12px;
}

.cart__content::-webkit-scrollbar-thumb{
  background: #555;     /* сам ползунок */
  border-radius: 12px;
  border: 2px solid #1b1e22;
}

.cart__content::-webkit-scrollbar-thumb:hover{
  background: #777;
}
/* =========================
   DELIVERY SWITCH (PRO)
   ========================= */

.delivery-switch {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.delivery-btn {
  flex: 1;
  padding: 12px 14px;

  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.18);

  background: rgba(255,255,255,.06);
  color: #fff;

  font-size: 14px;
  font-weight: 700;
  cursor: pointer;

  transition: all .18s ease;
}

.delivery-btn:hover {
  border-color: rgba(255,42,55,.5);
  transform: translateY(-1px);
}

.delivery-btn.active {
  background: linear-gradient(180deg,#ff2a37,#d81924);
  border-color: #ff2a37;
  box-shadow: 0 8px 20px rgba(255,42,55,.35);
}
/* =========================
   DELIVERY ESTIMATE (UI)
   ========================= */
#deliveryEstimate{
  margin-top: 10px;
}

.delivery-estimate-text{
  padding: 12px 14px;
  border-radius: 14px;

  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.14);

  color: rgba(255,255,255,.92);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;

  display: flex;
  align-items: center;
  gap: 10px;
}

.delivery-estimate-text::before{
  content: "⏱️";
  font-size: 16px;
  line-height: 1;
  opacity: .95;
}
/* ===== Today / Tomorrow switch ===== */
.delivery-day-switch{
  display:flex;
  gap:10px;
  margin:8px 0 10px;
}

.delivery-day-btn{
  flex:1;
  height:40px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.06);
  color:rgba(255,255,255,.86);
  font-weight:800;
  cursor:pointer;
  transition:.18s ease;
}

.delivery-day-btn:hover{
  background:rgba(255,255,255,.09);
}

.delivery-day-btn.active{
  background:linear-gradient(180deg, rgba(255,59,72,.95), rgba(255,0,28,.85));
  border-color:rgba(255,59,72,.55);
  box-shadow:0 10px 26px rgba(255,30,60,.28);
  color:#fff;
}
/* Неактивная кнопка */
.btn:disabled {
  background: #b9bcc3 !important;
  color: #fff !important;
  cursor: not-allowed;
  opacity: 0.85;
  box-shadow: none;
}

/* Анимация тряски */
@keyframes btnShake {
  0% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
  100% { transform: translateX(0); }
}

.btn.shake {
  animation: btnShake 0.35s ease;
}
#checkoutForm button[type="submit"]{
  white-space: nowrap;
}
/* ===== 5) Shake cart__itemsWrap when cart is empty ===== */
@keyframes cartItemsShake {
  0%   { transform: translateX(0); }
  15%  { transform: translateX(-6px); }
  30%  { transform: translateX(6px); }
  45%  { transform: translateX(-5px); }
  60%  { transform: translateX(5px); }
  75%  { transform: translateX(-3px); }
  90%  { transform: translateX(3px); }
  100% { transform: translateX(0); }
}

.cart__itemsWrap.shake {
  animation: cartItemsShake .35s ease;
}

body.cart-open{
  position: fixed;
  left: 0;
  right: 0;
  overflow: hidden;
  width: 100%;
}
.is-invalid{
  border-color:#ff2a37 !important;
  box-shadow:0 0 0 4px rgba(255,42,55,.18) !important;
}
.cart-close-btn{
  width:42px;
  height:42px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:12px;
  background:transparent;
  border:none;
  cursor:pointer;
  transition:.2s ease;
}

.cart-close-btn img{
  width:20px;
  height:20px;
  pointer-events:none;
}

.cart-close-btn:hover{
  background:rgba(0,0,0,.05);
}
/* ===== CART PILL SHAKE ON ADD ===== */
@keyframes cartShake {
  0%   { transform: translateX(0) rotate(0); }
  15%  { transform: translateX(-3px) rotate(-2deg); }
  30%  { transform: translateX(3px) rotate(2deg); }
  45%  { transform: translateX(-2px) rotate(-1deg); }
  60%  { transform: translateX(2px) rotate(1deg); }
  75%  { transform: translateX(-1px) rotate(-.5deg); }
  100% { transform: translateX(0) rotate(0); }
}

/* класс, который будем навешивать */
.cart-pill.is-shake,
[data-cart-open].is-shake{
  animation: cartShake .35s ease;
}
/* =========================
   MOBILE cart counter badge
   ========================= */
@media (max-width:900px){

  /* кнопка — якорь для бейджа */
  .cart-pill{
    position: relative;
  }

  /* прячем сумму на мобиле */
  .cart-pill__sum{ display:none !important; }

  /* контейнер "qty" превращаем в позиционируемый бейдж */
  .cart-pill__qty{
    position:absolute;
    top:-2px;     /* двигай: -6..-14 */
    right:-2px;   /* двигай: -6..-14 */
    font-size:0;
    line-height:0;
    pointer-events:none;
    opacity:1;
  }

  /* сам круг */
  .cart-pill__qty [data-cart-count]{
    display:inline-flex;
    align-items:center;
    justify-content:center;

    width: 30px;      /* больше круг: 32/34 */
    height: 30px;
    border-radius: 50%;

    font-size: 13px;
    font-weight: 800;
    line-height: 1;

    color:#ff2a37;
    background:#fff;
    border:2px solid #ff2a37;
    box-shadow: 0 8px 18px rgba(255,42,55,.35);
  }
}
/* ✅ если товаров 0 — прячем бейдж полностью */
@media (max-width:900px){
  .cart-pill__qty [data-cart-count]:empty{
    display:none !important;
  }
}