/*
 * dl-card-actions.css — ряд кнопок в карточке товара в сетке
 * (категории, поиск, подборки на главной). Разметка: html/products/types/products.grid.html.
 *
 * Зачем отдельный файл. Правила этого ряда сейчас живут в четырёх местах:
 * styles.css, mobile.css, seller-bridge.css (включая блоки с !important на ≤767 и ≤390 px
 * и правило :has(.dl-restock-btn), которое переносит «Сравнить» на вторую строку)
 * и dl-compare-feedback.css. Файл подключается последним (shop head.html) и перекрывает
 * их в одном месте. !important стоит только там, где его уже поставили раньше, —
 * иначе мобильные блоки seller-bridge.css не перебить. Откат — убрать одну строку <link>.
 *
 * Состояния главной кнопки: «В корзину» — чёрная; «В корзине» — зелёная, ведёт в корзину;
 * «Уведомить» — контурная, товара нет. «Сравнить» — квадрат с иконкой, как в шапке;
 * нажатая — синяя с галочкой. Высота ряда одинаковая во всех состояниях, поэтому цены
 * и кнопки в одной строке сетки стоят на одном уровне.
 */

.drlaunch-theme .product-grid .product-card__actions {
  --dl-ca-h: 40px;
  --dl-ca-gap: 8px;
  --dl-ca-radius: 10px;
  --dl-ca-font: 14px;
  --dl-ca-pad: 12px;
  --dl-ca-ink: #1a1917;
  --dl-ca-ink-hover: #3b3a37;
  --dl-ca-ink-press: #0f0e0d;
  --dl-ca-line: #e0ded9;
  --dl-ca-soft: #f3f2ef;
  --dl-ca-cart-bg: #e8f3e1;
  --dl-ca-cart-ink: #22560f;
  --dl-ca-on-bg: #eaf2fb;
  --dl-ca-on-ink: #185fa5;

  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  gap: var(--dl-ca-gap) !important;
  width: 100%;
  margin-top: 0 !important;
  padding-top: 6px;
}

/* Форма — только обёртка. seller-bridge.css на ≤390 px даёт ей padding 8px 10px и
   min-height 40px с !important: форма разбухает до 60 px, кнопка сжимается */
.drlaunch-theme .product-grid .product-card__actions > form.add-to-cart {
  display: flex !important;
  flex: 1 1 auto !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Главная кнопка: В корзину / В корзине / Уведомить */
.drlaunch-theme .product-grid .product-card__actions .btn.js-add-button,
.drlaunch-theme .product-grid .product-card__actions > .btn.dl-in-cart-btn,
.drlaunch-theme .product-grid .product-card__actions > .btn.dl-restock-btn {
  display: inline-flex !important;
  flex: 1 1 auto !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  height: var(--dl-ca-h) !important;
  min-height: var(--dl-ca-h) !important;
  padding: 0 var(--dl-ca-pad) !important;
  border: 1px solid var(--dl-ca-ink) !important;
  border-radius: var(--dl-ca-radius) !important;
  font-family: Manrope, system-ui, sans-serif !important;
  font-size: var(--dl-ca-font) !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  text-align: center;
  text-decoration: none !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.drlaunch-theme .product-grid .product-card__actions .dl-in-cart-btn__text,
.drlaunch-theme .product-grid .product-card__actions .dl-restock-btn__text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* В корзину */
.drlaunch-theme .product-grid .product-card__actions .btn.js-add-button {
  background: var(--dl-ca-ink) !important;
  border-color: var(--dl-ca-ink) !important;
  color: #fff !important;
}
.drlaunch-theme .product-grid .product-card__actions .btn.js-add-button:active {
  background: var(--dl-ca-ink-press) !important;
  border-color: var(--dl-ca-ink-press) !important;
}

/* В корзине — товар уже добавлен, кнопка ведёт в корзину, а не добавляет второй */
.drlaunch-theme .product-grid .product-card__actions > .btn.dl-in-cart-btn {
  background: var(--dl-ca-cart-bg) !important;
  border-color: var(--dl-ca-cart-bg) !important;
  color: var(--dl-ca-cart-ink) !important;
}

/* Уведомить — товара нет, это не покупка, поэтому не чёрная */
.drlaunch-theme .product-grid .product-card__actions > .btn.dl-restock-btn {
  background: #fff !important;
  border-color: var(--dl-ca-ink) !important;
  color: var(--dl-ca-ink) !important;
}

.drlaunch-theme .product-grid .product-card__actions .dl-in-cart-btn__icon,
.drlaunch-theme .product-grid .product-card__actions .dl-restock-btn__icon {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  background-color: currentColor;
  -webkit-mask: var(--dl-ca-icon) center / 16px 16px no-repeat;
  mask: var(--dl-ca-icon) center / 16px 16px no-repeat;
}
.drlaunch-theme .product-grid .product-card__actions .dl-in-cart-btn__icon {
  --dl-ca-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.4l3.1 3.1L13 4.6' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.drlaunch-theme .product-grid .product-card__actions .dl-restock-btn__icon {
  --dl-ca-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9M10.3 21a1.94 1.94 0 0 0 3.4 0' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Сравнить — квадратная кнопка с иконкой из шапки. Текст остаётся в разметке
   для экранных дикторов и для drlaunch-wa.js, который его переключает. */
.drlaunch-theme .product-grid .product-card__actions .js-add-compare-button {
  position: relative;
  display: inline-flex !important;
  flex: 0 0 var(--dl-ca-h) !important;
  align-items: center !important;
  justify-content: center !important;
  width: var(--dl-ca-h) !important;
  min-width: var(--dl-ca-h) !important;
  max-width: var(--dl-ca-h) !important;
  height: var(--dl-ca-h) !important;
  min-height: var(--dl-ca-h) !important;
  padding: 0 !important;
  background: #fff !important;
  border: 1px solid var(--dl-ca-line) !important;
  border-radius: var(--dl-ca-radius) !important;
  color: var(--dl-ca-ink) !important;
  overflow: visible !important;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.drlaunch-theme .product-grid .product-card__actions .js-add-compare-button::after {
  content: none !important;
}
.drlaunch-theme .product-grid .product-card__actions .js-add-compare-button .b-compare__text {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  display: block !important;
}
.drlaunch-theme .product-grid .product-card__actions .js-add-compare-button .b-compare__icon {
  display: block !important;
  width: 20px;
  height: 20px;
  background-color: currentColor;
  -webkit-mask: url("/wa-data/public/site/themes/drlaunch/assets/icons/compare.svg") center / 20px 20px no-repeat;
  mask: url("/wa-data/public/site/themes/drlaunch/assets/icons/compare.svg") center / 20px 20px no-repeat;
}

/* Нажатая: товар в сравнении */
.drlaunch-theme .product-grid .product-card__actions .js-add-compare-button.active,
.drlaunch-theme .product-grid .product-card__actions .js-add-compare-button.is-on {
  background: var(--dl-ca-on-bg) !important;
  border-color: var(--dl-ca-on-ink) !important;
  color: var(--dl-ca-on-ink) !important;
}
.drlaunch-theme .product-grid .product-card__actions .js-add-compare-button.active::before,
.drlaunch-theme .product-grid .product-card__actions .js-add-compare-button.is-on::before {
  content: "";
  position: absolute;
  top: -5px;
  right: -5px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--dl-ca-on-ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.3l2.5 2.5L12 5.2' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px 12px no-repeat;
  box-shadow: 0 0 0 2px #fff;
}

@media (hover: hover) {
  .drlaunch-theme .product-grid .product-card__actions .btn.js-add-button:hover {
    background: var(--dl-ca-ink-hover) !important;
    border-color: var(--dl-ca-ink-hover) !important;
  }
  .drlaunch-theme .product-grid .product-card__actions > .btn.dl-in-cart-btn:hover {
    border-color: var(--dl-ca-cart-ink) !important;
  }
  .drlaunch-theme .product-grid .product-card__actions > .btn.dl-restock-btn:hover {
    background: var(--dl-ca-soft) !important;
  }
  .drlaunch-theme .product-grid .product-card__actions .js-add-compare-button:hover {
    border-color: var(--dl-ca-ink) !important;
  }
  .drlaunch-theme .product-grid .product-card__actions .js-add-compare-button.active:hover,
  .drlaunch-theme .product-grid .product-card__actions .js-add-compare-button.is-on:hover {
    border-color: var(--dl-ca-on-ink) !important;
    background: #dde9f7 !important;
  }
}

/* Телефон: две колонки, карточка 160–180 px. Касание — 44 px */
@media (max-width: 767px) {
  .drlaunch-theme .product-grid .product-card__actions {
    --dl-ca-h: 44px;
    --dl-ca-gap: 6px;
    --dl-ca-radius: 6px;
    --dl-ca-font: 13px;
    --dl-ca-pad: 8px;
    --dl-ca-line: #c9c7c2;
    padding-top: 4px;
  }
}
@media (max-width: 400px) {
  .drlaunch-theme .product-grid .product-card__actions {
    --dl-ca-font: 12px;
    --dl-ca-pad: 6px;
  }
  .drlaunch-theme .product-grid .product-card__actions .dl-in-cart-btn__icon,
  .drlaunch-theme .product-grid .product-card__actions .dl-restock-btn__icon {
    display: none !important;
  }
}
/* Самые узкие телефоны (320 px): карточка 141 px, на текст главной кнопки остаётся 59 px,
   а «Уведомить» при 12 px занимает 64. Уменьшаем шрифт и отступы, касание оставляем 44 px */
@media (max-width: 359px) {
  .drlaunch-theme .product-grid .product-card__actions {
    --dl-ca-font: 11px;
    --dl-ca-pad: 4px;
  }
}
/* Складной телефон в сложенном виде (280 px): карточка 121 px, при 11 px на текст остаётся 43 px,
   а «В корзину» нужно 53. Касание здесь 36 px — компромисс, иначе надписи не помещаются */
@media (max-width: 319px) {
  .drlaunch-theme .product-grid .product-card__actions {
    --dl-ca-h: 36px;
    --dl-ca-gap: 4px;
    --dl-ca-font: 10px;
    --dl-ca-pad: 2px;
  }
}

/* Избранное (/search/?wishlist=true/) выводит ту же сетку и получает тот же ряд.
   Строчный макет .dl-wishlist-products из styles.css на живом сайте не применяется
   (перебит seller-bridge.css) — сравнение там видно и сейчас, прячем его не мы. */
