/* assets/css/cart.css
   Корзина (cart.php) — аккуратно, жирные “плашки” итогов, clear справа сверху.
   ВАЖНО:
   - НЕ используем .cart-btn (занят в header.css под иконку корзины).
   - Кнопки страницы: .cartpage-btn*
*/

:root{
  --cart-text:#111;
  --cart-muted:#666;
  --cart-line: rgba(0,0,0,.10);

  --cart-accent: #ff6a00;  /* оранжевый */
  --cart-success: #2f6b5e; /* зелёный */
  --cart-bg:#fff;

  --cart-card:#fff;
  --cart-shadow: 0 6px 18px rgba(0,0,0,.06);
  --cart-radius:14px;
}

/* Page */
.cart-page{
  padding: 10px 0 18px;
  background: var(--cart-bg);
  color: var(--cart-text);
}

.cart-header{
  padding: 6px 0 10px;
}

.cart-header__top{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.cart-title{
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
  font-weight: 950;
  letter-spacing: -0.01em;
}

/* Clear справа сверху */
.cart-clear-top{
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 900;
  font-size: 13px;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.cart-clear-top:hover{ text-decoration: underline; }

/* =========================================================
   TOP META: жирные “плашки” Товаров / Сумма
   ========================================================= */
.cart-meta{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.cart-meta__pill{
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(0,0,0,.03);
  border: 1px solid rgba(0,0,0,.08);
}

.cart-meta__label{
  font-size: 12px;
  color: rgba(0,0,0,.62);
  font-weight: 900;
}

.cart-meta__val{
  font-size: 16px;
  color: rgba(0,0,0,.92);
  font-weight: 950;
  letter-spacing: -0.01em;
}

/* Empty */
.cart-empty{
  padding: 14px 12px;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: var(--cart-radius);
  background: #fafafa;
}

.cart-empty__title{
  font-size: 15px;
  font-weight: 950;
  margin-bottom: 4px;
}

.cart-empty__text{
  font-size: 14px;
  color: var(--cart-muted);
}

.cart-empty__actions{
  margin-top: 12px;
}

/* List */
.cart-list{
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

/* Item card */
.cart-item{
  background: var(--cart-card);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: var(--cart-radius);
  box-shadow: var(--cart-shadow);
  overflow: hidden;

  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 10px;
}

.cart-item__media{
  display: block;
  background: #fafafa;
  border-right: 1px solid rgba(0,0,0,.06);
  text-decoration: none;
}

.cart-item__img{
  display:block;
  width: 96px;
  height: 96px;
  object-fit: contain;
  padding: 10px;
  background:#fff;
}

.cart-item__noimg{
  width: 96px;
  height: 96px;
  background: #f0f0f0;
}

.cart-item__body{
  padding: 10px 10px 12px;
  min-width: 0;
}

.cart-item__name{
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;

  font-size: 14px;
  line-height: 1.35;
  font-weight: 950;
  color: #111;
  text-decoration: none;
}
.cart-item__name:hover{ text-decoration: underline; }

.cart-item__brand{
  margin-top: 4px;
  font-size: 13px;
  color: var(--cart-muted);
  line-height: 1.25;
}

/* Row: price | qty | sum */
.cart-item__row{
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: end;
}

.cart-price__label,
.cart-qty__label,
.cart-sum__label{
  font-size: 12px;
  color: rgba(0,0,0,.58);
  font-weight: 900;
  margin-bottom: 4px;
}

.cart-price__val,
.cart-sum__val{
  font-size: 15px;
  font-weight: 950;
  letter-spacing: -0.01em;
}

/* Qty pill */
.cart-qty__controls{
  display: grid;
  grid-template-columns: 34px 54px 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.16);
  overflow: hidden;
  background: #fff;
}

.cart-qty__btn{
  border: 0;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: #111;
  -webkit-tap-highlight-color: transparent;
}
.cart-qty__btn:active{ transform: translateY(0.5px); }

.cart-qty__input{
  border: 0;
  outline: none;
  text-align: center;
  font-size: 14px;
  font-weight: 950;
  color: #111;
  width: 100%;
  appearance: textfield;
}
.cart-qty__input::-webkit-outer-spin-button,
.cart-qty__input::-webkit-inner-spin-button{
  -webkit-appearance: none;
  margin: 0;
}

/* Actions under row */
.cart-item__actions{
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Link-like button */
.cart-link{
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(0,0,0,.65);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.cart-link:hover{ text-decoration: underline; }

.cart-link--danger{
  color: rgba(200,0,0,.72);
}
.cart-link--danger:hover{
  color: rgba(200,0,0,.85);
}

/* Trash icon */
.cart-link__icon--trash{
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  transform: translateY(2px);
  opacity: .9;

  background:
    linear-gradient(currentColor,currentColor) 2px 3px/10px 2px no-repeat,  /* крышка */
    linear-gradient(currentColor,currentColor) 5px 1px/4px 2px no-repeat,   /* ручка */
    linear-gradient(currentColor,currentColor) 3px 5px/8px 9px no-repeat;   /* корпус */
  border-radius: 2px;
}

/* Helper text */
.p-msg{
  min-height: 16px;
  font-size: 12.5px;
  color: var(--cart-muted);
}

/* =========================================================
   FOOTER: summary + checkout (без кнопки очистки)
   ========================================================= */
.cart-footer{
  margin-top: 12px;
  padding: 10px 0 2px;

  display: flex;
  align-items: center;
  gap: 12px;
}

.cart-footer__summary{
  display: inline-flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.cart-footer__sumline{
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(0,0,0,.03);
  border: 1px solid rgba(0,0,0,.08);
}

.cart-footer__label{
  font-size: 12px;
  color: rgba(0,0,0,.62);
  font-weight: 900;
}

.cart-footer__val{
  font-size: 16px;
  color: rgba(0,0,0,.92);
  font-weight: 950;
  letter-spacing: -0.01em;
}

.cart-footer__right{
  margin-left: auto;
  display: flex;
  align-items: center;
}

/* Buttons (page-only) */
.cartpage-btn{
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.14);
  background: #fff;
  color: #111;
  font-size: 14px;
  font-weight: 950;
  text-decoration: none;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  -webkit-tap-highlight-color: transparent;
  transition: transform .06s ease, box-shadow .15s ease, border-color .15s ease, filter .15s ease;
}

.cartpage-btn:hover{
  border-color: rgba(0,0,0,.20);
  box-shadow: 0 6px 16px rgba(0,0,0,.06);
}

.cartpage-btn:active{
  transform: translateY(1px);
}

.cartpage-btn--primary{
  border-color: rgba(0,0,0,0);
  background: var(--cart-accent);
  color: #fff;
}
.cartpage-btn--primary:hover{ filter: brightness(.96); }

.cartpage-btn--success{
  border-color: rgba(0,0,0,0);
  background: var(--cart-success);
  color: #fff;
}
.cartpage-btn--success:hover{ filter: brightness(.96); }

/* Flash states from JS */
.cart-item.is-warn{ outline: 2px solid rgba(255,106,0,.35); }
.cart-item.is-ok{ outline: 2px solid rgba(47,107,94,.28); }

/* =========================================================
   Mobile
   ========================================================= */
@media (max-width: 420px){
  .cart-header__top{
    align-items: flex-start;
  }

  /* “Очистить” остаётся справа и не ломает заголовок */
  .cart-clear-top{
    padding-top: 2px;
    font-size: 13px;
  }

  .cart-item{
    grid-template-columns: 88px 1fr;
  }

  .cart-item__img,
  .cart-item__noimg{
    width: 88px;
    height: 88px;
  }

  .cart-item__row{
    grid-template-columns: 1fr;
    gap: 10px;
  }


/* sticky footer */
/* sticky footer */
.cart-footer{
  position: sticky;
  bottom: 0;

  background: rgba(248,248,250,.96);

  border-top: 1px solid rgba(0,0,0,.08);
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 24px rgba(0,0,0,.06);
  z-index: 5;

  padding: 10px;
  border-radius: 16px 16px 0 0;

  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;

  /* необязательно */
  backdrop-filter: blur(6px);
}

  .cart-footer__right{
    margin-left: 0;
  }

  .cartpage-btn{
    width: 100%;
  }
}

/* =========================
   CART: delete (Удалить) — минималистично, но заметно
   ========================= */

.cart-item__actions .btnRemove{
  color: rgba(200,0,0,.82);
  font-weight: 900;
  text-decoration: none;
}

.cart-item__actions .btnRemove:hover{
  color: rgba(200,0,0,.95);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cart-item__actions .btnRemove:active{
  transform: translateY(1px);
}

.cart-item__actions .btnRemove:focus-visible{
  outline: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cartpage-btn--ghost{
  background: #fff;
  border: 1px solid rgba(0,0,0,.12);
  color: #111;
}

.cartpage-btn--ghost:hover{
  background: rgba(0,0,0,.03);
}

.cart-footer__right{
  display: grid;
  gap: 10px;
}

@media (max-width: 420px){
  .cart-qty__controls{
    width: min(140px, 76vw);
    grid-template-columns: 44px 1fr 44px;
  }
}