/* Корзина в стиле шапки (A1), каталога (A2) и футера (A3). Токены — как в header.css. */

.ad-cart {
  --ad-primary: #FBB917;
  --ad-primary-hover: #EDB021;
  --ad-primary-soft: #FFF4D6;
  --ad-ink: #1C222A;
  --ad-dark: #393939;
  --ad-muted: #6A655D;
  --ad-subtle: #959EA9;
  --ad-border: #E6E6E6;
  --ad-surface: #F5F5F3;
  --ad-white: #FFFFFF;
  --ad-sale: #FF5268;
  --ad-success: #2E9E5B;
  --ad-radius-sm: 6px;
  --ad-radius-md: 10px;
  --ad-radius-lg: 16px;
  --ad-focus: 0 0 0 3px rgba(251, 185, 23, .55);

  background: var(--ad-surface);
  color: var(--ad-ink);
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  line-height: 20px;
  padding: 24px 0 64px;
}
.ad-cart *, .ad-cart *::before, .ad-cart *::after { box-sizing: border-box; }
:where(.ad-cart) ul { list-style: none; margin: 0; padding: 0; }
:where(.ad-cart) p { margin: 0; }
:where(.ad-cart) a { color: inherit; text-decoration: none; }
:where(.ad-cart) button { font: inherit; color: inherit; background: none; border: 0; margin: 0; padding: 0; cursor: pointer; }
.ad-cart :focus-visible { outline: none; box-shadow: var(--ad-focus); border-radius: var(--ad-radius-sm); }
.ad-cart .ad-icon { flex-shrink: 0; display: block; }
.ad-cart__sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.ad-cart__container { max-width: 1440px; margin: 0 auto; padding: 0 40px; }
.ad-cart__crumbs { display: flex; align-items: center; gap: 8px; font-size: 12px; line-height: 16px; color: var(--ad-muted); }
.ad-cart__crumbs a:hover { color: var(--ad-ink); text-decoration: underline; text-underline-offset: 3px; }
.ad-cart__crumbs [aria-current] { color: var(--ad-ink); font-weight: 600; }
.ad-cart__crumbs .ad-icon { color: var(--ad-subtle); }
.ad-cart__title { margin: 16px 0 24px; font-size: 36px; line-height: 44px; font-weight: 700; }

/* уведомления WooCommerce (добавлено, удалено, купон) */
.ad-cart .woocommerce-notices-wrapper:empty { display: none; }
.ad-cart .woocommerce-message, .ad-cart .woocommerce-info, .ad-cart .woocommerce-error {
  margin: 0 0 16px; padding: 14px 16px 14px 48px; border: 0; border-radius: var(--ad-radius-md);
  background: var(--ad-white); color: var(--ad-ink); font-size: 14px; line-height: 20px; list-style: none;
  box-shadow: inset 4px 0 0 var(--ad-primary);
}
.ad-cart .woocommerce-error { box-shadow: inset 4px 0 0 var(--ad-sale); }
.ad-cart .woocommerce-message::before, .ad-cart .woocommerce-info::before { color: var(--ad-primary); top: 14px; left: 18px; }
.ad-cart .woocommerce-error::before { color: var(--ad-sale); top: 14px; left: 18px; }
.ad-cart .woocommerce-message a, .ad-cart .woocommerce-info a { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* сетка */
.ad-cart__layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.ad-cart__main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ad-cart__aside { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 16px; }

/* список товаров */
.ad-cart__panel { background: var(--ad-white); border-radius: var(--ad-radius-lg); padding: 8px 24px 24px; }
.ad-cart__panel-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 0; border-bottom: 1px solid var(--ad-border); }
.ad-cart__panel-title { font-size: 18px; line-height: 24px; font-weight: 600; }
.ad-cart__panel-count { margin-left: 8px; font-size: 14px; font-weight: 400; color: var(--ad-subtle); }

.ad-cart__item {
  display: grid; grid-template-columns: 112px minmax(0, 1fr) auto 120px 40px; align-items: center; gap: 24px;
  padding: 20px 0; border-bottom: 1px solid var(--ad-border);
}
.ad-cart__media {
  display: flex; align-items: center; justify-content: center; width: 112px; height: 112px; padding: 8px;
  border-radius: var(--ad-radius-md); background: var(--ad-surface); overflow: hidden;
}
.ad-cart__media a { display: contents; }
.ad-cart .ad-cart__media img { display: block; width: 100%; height: 100%; max-width: none; object-fit: contain; mix-blend-mode: multiply; }
.ad-cart .ad-cart__info { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; text-align: left; }
.ad-cart__sku { font-size: 12px; line-height: 16px; color: var(--ad-subtle); }
.ad-cart .product-name p.ad-cart__name { display: block; max-width: none; margin: 0; text-align: left; font-size: 15px; line-height: 20px; font-weight: 600; color: var(--ad-ink); }
.ad-cart__name a:hover { text-decoration: underline; text-underline-offset: 3px; }
.ad-cart .variation { display: block; margin: 2px 0 0; font-size: 12px; line-height: 16px; color: var(--ad-muted); }
.ad-cart .variation dt { display: inline; font-weight: 600; margin: 0 4px 0 0; }
.ad-cart .variation dd { display: inline; margin: 0; }
.ad-cart .variation dd::after { content: ''; display: block; }
.ad-cart .product-name .variation dd p { display: inline; max-width: none; margin: 0; text-align: left; font-size: 12px; color: var(--ad-muted); }
.ad-cart__unit { margin-top: 4px; font-size: 13px; color: var(--ad-muted); }
.ad-cart__unit-label { color: var(--ad-subtle); }
.ad-cart .backorder_notification { font-size: 12px; color: var(--ad-muted); }

/* количество: −  [ 2 ]  + */
.ad-cart__qty .quantity { display: inline-flex; align-items: center; height: 44px; border: 1px solid var(--ad-border); border-radius: var(--ad-radius-md); background: var(--ad-white); }
.ad-cart__qty .screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ad-cart .ad-cart__qty .qty {
  width: 44px; height: 42px; padding: 0; margin: 0; border: 0; border-radius: 0; background: transparent;
  text-align: center; font: inherit; font-weight: 600; color: var(--ad-ink); -moz-appearance: textfield;
}
.ad-cart .ad-cart__qty .qty::-webkit-outer-spin-button, .ad-cart .ad-cart__qty .qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ad-cart__step { display: flex; align-items: center; justify-content: center; width: 40px; height: 42px; color: var(--ad-muted); border-radius: var(--ad-radius-md); }
.ad-cart__step:hover:not(:disabled) { color: var(--ad-ink); background: var(--ad-surface); }
.ad-cart__step:disabled { opacity: .35; cursor: default; }

.ad-cart__subtotal { text-align: right; font-size: 18px; line-height: 24px; font-weight: 700; white-space: nowrap; }
.ad-cart__remove { display: flex; justify-content: flex-end; }
.ad-cart .ad-cart__remove-btn {
  display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--ad-radius-md);
  color: var(--ad-subtle) !important; background: transparent !important; font-size: 0; transition: color .15s ease, background-color .15s ease;
}
.ad-cart .ad-cart__remove-btn:hover { color: var(--ad-sale) !important; background: #FFF0F2 !important; }

/* купон и обновление */
.ad-cart__actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 20px; }
.ad-cart__coupon { display: flex; gap: 8px; flex: 1 1 320px; max-width: 440px; }
.ad-cart .coupon .ad-cart__input, .ad-cart .ad-cart__input {
  width: auto !important;
  flex: 1; min-width: 0; height: 44px; padding: 0 16px; border: 1px solid var(--ad-border); border-radius: var(--ad-radius-md);
  background: var(--ad-white); font: inherit; color: var(--ad-ink); transition: border-color .15s ease;
}
.ad-cart .ad-cart__input::placeholder { color: var(--ad-subtle); }
.ad-cart .ad-cart__input:focus { outline: none; border-color: var(--ad-primary); }
.ad-cart.ad-cart--js .ad-cart__update { display: none; }

/* кнопки */
.ad-cart .ad-cart__btn, .ad-cart .coupon .ad-cart__btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 20px; margin: 0;
  border: 1px solid transparent; border-radius: var(--ad-radius-md); font: inherit; font-weight: 600; font-size: 14px; line-height: 20px;
  text-decoration: none; cursor: pointer; transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.ad-cart .ad-cart__btn--block { display: flex; width: 100%; }
.ad-cart .ad-cart__btn--primary { background: var(--ad-primary); color: var(--ad-ink); }
.ad-cart .ad-cart__btn--primary:hover { background: var(--ad-primary-hover); color: var(--ad-ink); }
.ad-cart .ad-cart__btn--dark { background: var(--ad-dark); color: var(--ad-white); }
.ad-cart .ad-cart__btn--dark:hover { background: var(--ad-ink); color: var(--ad-white); }
.ad-cart .coupon .ad-cart__btn--outline, .ad-cart .ad-cart__btn--outline { background: var(--ad-white); border-color: var(--ad-border); color: var(--ad-ink); }
.ad-cart .coupon .ad-cart__btn--outline:hover, .ad-cart .ad-cart__btn--outline:hover { border-color: var(--ad-primary); background: var(--ad-primary-soft); }
.ad-cart .ad-cart__btn--ghost { background: transparent; color: var(--ad-muted); text-decoration: underline; text-underline-offset: 3px; padding: 0 8px; }
.ad-cart .ad-cart__btn:disabled, .ad-cart .ad-cart__btn[disabled] { opacity: .5; cursor: default; }

.ad-cart__continue { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; font-weight: 600; }
.ad-cart__continue:hover { text-decoration: underline; text-underline-offset: 3px; }

/* итоги */
.ad-cart .cart-collaterals { width: 100%; float: none; }
.ad-cart .cart-collaterals .cart_totals { width: 100%; float: none; }
.ad-cart__totals { background: var(--ad-white); border-radius: var(--ad-radius-lg); padding: 24px; }
.ad-cart__totals-title { margin-bottom: 16px !important; font-size: 18px; line-height: 24px; font-weight: 600; }
/* строки итогов на flex: «название — сумма», доставка — блоком на всю ширину */
.ad-cart .ad-cart__totals-table, .ad-cart .ad-cart__totals-table tbody { display: block; width: 100%; margin: 0; border: 0; border-radius: 0; }
.ad-cart .ad-cart__totals-table tr { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; border: 0; }
.ad-cart .ad-cart__totals-table th, .ad-cart .ad-cart__totals-table td { display: block; }
.ad-cart .ad-cart__totals-table td { white-space: nowrap; }
.ad-cart .ad-cart__totals-table tr.woocommerce-shipping-totals { flex-direction: column; align-items: stretch; gap: 0; }
.ad-cart .ad-cart__totals-table .woocommerce-shipping-totals td { white-space: normal; }
.ad-cart .ad-cart__totals-table tr.order-total { margin-top: 8px; border-top: 1px solid var(--ad-border); }
.ad-cart .ad-cart__totals-table th, .ad-cart .ad-cart__totals-table td {
  padding: 8px 0; border: 0; background: none; vertical-align: top; font-size: 14px; line-height: 20px;
}
.ad-cart .ad-cart__totals-table th { text-align: left; font-weight: 400; color: var(--ad-muted); }
.ad-cart .ad-cart__totals-table td { text-align: right; font-weight: 600; }
.ad-cart .ad-cart__totals-table td::before { display: none; }
.ad-cart .ad-cart__totals-table .cart-discount td { color: var(--ad-success); }
.ad-cart .ad-cart__totals-table .order-total th, .ad-cart .ad-cart__totals-table .order-total td {
  padding-top: 16px; color: var(--ad-ink);
}
.ad-cart .ad-cart__totals-table .order-total th { font-size: 16px; font-weight: 600; }
.ad-cart .ad-cart__totals-table .order-total td { font-size: 24px; line-height: 32px; font-weight: 700; }
.ad-cart .ad-cart__totals-table #shipping_method { margin: 0; padding: 0; list-style: none; text-align: right; }

/* доставка: заголовок и содержимое друг под другом, на всю ширину панели */
.ad-cart .ad-cart__totals-table .woocommerce-shipping-totals th,
.ad-cart .ad-cart__totals-table .woocommerce-shipping-totals td { display: block; width: 100%; text-align: left; }
.ad-cart .ad-cart__totals-table .woocommerce-shipping-totals th { padding-bottom: 4px; }
.ad-cart .ad-cart__totals-table .woocommerce-shipping-totals td { padding-top: 0; font-weight: 400; }
.ad-cart .woocommerce-shipping-totals #shipping_method { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.ad-cart .woocommerce-shipping-totals #shipping_method li { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 600; }
.ad-cart .woocommerce-shipping-totals #shipping_method input[type="radio"] { width: 18px; height: 18px; margin: 0; accent-color: var(--ad-primary); }
.ad-cart .woocommerce-shipping-totals #shipping_method label { margin: 0; font-weight: 600; }
.ad-cart .woocommerce-shipping-destination { margin: 8px 0 0 !important; font-size: 12px; line-height: 16px; color: var(--ad-muted); }
.ad-cart .woocommerce-shipping-destination strong { color: var(--ad-ink); font-weight: 600; }
.ad-cart .ad-ship { margin: 8px 0 0; }
.ad-cart .ad-ship__toggle { display: inline-block; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--ad-ink); text-decoration: underline; text-underline-offset: 3px; }
.ad-cart .ad-ship__toggle:hover { color: var(--ad-muted); }
.ad-cart .ad-ship__form { margin-top: 12px; padding: 16px; border-radius: var(--ad-radius-md); background: var(--ad-surface); }
.ad-cart .ad-ship__field + .ad-ship__field { margin-top: 10px; }
.ad-cart .ad-ship__field { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; width: 100%; float: none; }
.ad-cart .ad-ship__label { margin: 0; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--ad-muted); }
.ad-cart .ad-ship .ad-ship__input, .ad-cart .ad-ship .input-text, .ad-cart .ad-ship select {
  width: 100%; height: 44px; padding: 0 14px; margin: 0; border: 1px solid var(--ad-border); border-radius: var(--ad-radius-md);
  background: var(--ad-white); font: inherit; font-size: 14px; color: var(--ad-ink); text-align: left; box-shadow: none;
}
.ad-cart .ad-ship .ad-ship__input:focus, .ad-cart .ad-ship .input-text:focus { outline: none; border-color: var(--ad-primary); }
.ad-cart .ad-ship .ad-ship__input::placeholder { color: var(--ad-subtle); }
/* select2 (WooCommerce заменяет им список стран) */
.ad-cart .ad-ship .select2-container { width: 100% !important; text-align: left; }
.ad-cart .ad-ship .select2-container .select2-selection--single {
  height: 44px; border: 1px solid var(--ad-border); border-radius: var(--ad-radius-md); background: var(--ad-white);
}
.ad-cart .ad-ship .select2-container .select2-selection--single .select2-selection__rendered { padding: 0 36px 0 14px; line-height: 42px; color: var(--ad-ink); font-size: 14px; }
.ad-cart .ad-ship .select2-container .select2-selection--single .select2-selection__arrow { height: 42px; right: 8px; }
.ad-cart .ad-ship__actions { margin: 14px 0 0; }
.ad-cart .ad-ship__actions .ad-cart__btn { width: 100%; height: 44px; padding: 0 16px; font-size: 14px; }
.ad-cart .woocommerce-remove-coupon { margin-left: 6px; font-size: 12px; font-weight: 400; color: var(--ad-subtle); text-decoration: underline; }
.ad-cart__checkout { padding: 16px 0 0 !important; }
.ad-cart .wc-proceed-to-checkout .checkout-button { height: 52px; margin: 0; font-size: 16px; }

/* помощь */
.ad-cart__help { display: flex; flex-direction: column; gap: 12px; padding: 24px; border-radius: var(--ad-radius-lg); background: var(--ad-primary-soft); }
.ad-cart__help-title { font-size: 16px; line-height: 24px; font-weight: 700; }
.ad-cart__help-text { font-size: 13px; line-height: 18px; color: var(--ad-muted); }
.ad-cart__help-phone { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; }
.ad-cart__help-phone .ad-icon { color: var(--ad-primary-hover); }

/* пустая корзина */
.ad-cart__empty {
  display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 640px; margin: 0 auto;
  padding: 48px 32px; border-radius: var(--ad-radius-lg); background: var(--ad-white); text-align: center;
}
.ad-cart__empty-icon { display: flex; align-items: center; justify-content: center; width: 72px; height: 72px; border-radius: 50%; background: var(--ad-primary-soft); color: var(--ad-ink); }
.ad-cart .ad-cart__empty-title { margin-top: 8px; font-size: 24px; line-height: 32px; font-weight: 700; }
.ad-cart .ad-cart__empty-title::before { display: none; }
.ad-cart__empty-text { color: var(--ad-muted); }
.ad-cart__empty .ad-cart__btn { margin-top: 8px; }
.ad-cart__empty-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; width: 100%; margin-top: 24px !important; padding-top: 24px !important; border-top: 1px solid var(--ad-border); }
.ad-cart__empty-link { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--ad-border); border-radius: var(--ad-radius-md); font-weight: 600; text-align: left; transition: border-color .15s ease, background-color .15s ease; }
.ad-cart__empty-link span { flex: 1; }
.ad-cart__empty-link .ad-icon--chevron-right { color: var(--ad-subtle); }
.ad-cart__empty-link:hover { border-color: var(--ad-primary); background: var(--ad-primary-soft); }

/* состояние загрузки во время AJAX-обновления WooCommerce */
.ad-cart .blockUI.blockOverlay { background: rgba(255, 255, 255, .6) !important; border-radius: var(--ad-radius-lg); }

/* адаптив */
@media (max-width: 1199.98px) {
  .ad-cart__container { padding: 0 24px; }
  .ad-cart__layout { grid-template-columns: minmax(0, 1fr) 320px; }
  .ad-cart__item { grid-template-columns: 96px minmax(0, 1fr) auto 40px; grid-template-areas: "media info info remove" "media qty subtotal subtotal"; row-gap: 12px; }
  .ad-cart__media { grid-area: media; width: 96px; height: 96px; }
  .ad-cart__info { grid-area: info; }
  .ad-cart__qty { grid-area: qty; }
  .ad-cart__subtotal { grid-area: subtotal; }
  .ad-cart__remove { grid-area: remove; align-self: start; }
}
@media (max-width: 1023.98px) {
  .ad-cart__layout { grid-template-columns: minmax(0, 1fr); }
  .ad-cart__aside { position: static; }
}
@media (max-width: 767.98px) {
  .ad-cart { padding-top: 16px; }
  .ad-cart__container { padding: 0 16px; }
  .ad-cart__title { font-size: 28px; line-height: 36px; margin-bottom: 16px; }
  .ad-cart__panel { padding: 4px 16px 16px; }
  .ad-cart__item { grid-template-columns: 80px minmax(0, 1fr) 40px; grid-template-areas: "media info remove" "foot foot foot"; align-items: start; gap: 12px; padding: 16px 0; }
  .ad-cart__media { width: 80px; height: 80px; }
  /* количество слева и сумма справа делят одну строку */
  .ad-cart__qty { grid-area: foot; justify-self: start; align-self: center; }
  .ad-cart__subtotal { grid-area: foot; justify-self: end; align-self: center; }
  .ad-cart__subtotal { align-self: center; font-size: 16px; }
  .ad-cart__coupon { max-width: none; }
  .ad-cart__empty { padding: 32px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .ad-cart * { transition: none !important; }
}
