/* ═══════════════════════════════════════════════════════
   CART.CSS — Стилі кошика · Твоє Світло
   // CART_LOGIC: При міграції на WooCommerce замінити
   //   на woocommerce-cart.css / mini-cart стилі теми
═══════════════════════════════════════════════════════ */

/* ── Анімація pulse для кнопки "В кошик" ── */
@keyframes cart-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(46,139,71,0); }
  50%       { box-shadow: 0 0 0 6px rgba(46,139,71,.28); }
}

/* ── Кнопка "В кошик" ── */
.btn-cart {
  background: #fff;
  color: var(--green-600);
  border: 2px solid var(--green-600);
  border-radius: 8px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  font-family: var(--font);
  transition: background .2s, color .2s, box-shadow .2s;
  animation: cart-pulse 2.2s ease-in-out infinite;
}
.btn-cart:hover {
  background: var(--green-50);
  border-color: var(--green-700);
  color: var(--green-700);
  animation: none;
  box-shadow: 0 0 0 4px rgba(46,139,71,.2);
}
.btn-cart.added {
  background: var(--green-600);
  color: #fff;
  border-color: var(--green-600);
  animation: none;
  box-shadow: none;
}

/* ── Обгортка двох кнопок у картці ── */
.card-btns {
  display: flex;
  flex-direction: row;
  gap: 6px;
  width: 100%;
}
.card-btns .btn {
  flex: 1;
  min-width: 0;
  text-align: center;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Кнопка кошика в хедері ── */
.cart-icon-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 22px;
  line-height: 1;
  transition: background .2s;
  flex-shrink: 0;
}
.cart-icon-btn:hover { background: var(--green-50); }

/* ── Бейдж лічильника ── */
.cart-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  background: #e53e3e;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 17px;
  height: 17px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  pointer-events: none;
  transform: translate(6px, -4px);
  font-family: var(--font);
}
.cart-badge:empty { display: none; }

/* ── Напівпрозорий оверлей ── */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s, visibility .3s;
}
.cart-overlay.open { opacity: 1; visibility: visible; }

/* ── Бокова панель (drawer) ── */
.cart-drawer {
  position: fixed;
  top: 0; right: 0;
  width: 420px;
  max-width: 100vw;
  height: 100%;
  background: #fff;
  box-shadow: -8px 0 48px rgba(0,0,0,.18);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.cart-drawer.open { transform: translateX(0); }

/* ── Шапка drawer ── */
.cart-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cart-drawer__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1);
}
.cart-drawer__close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--text-2);
  font-size: 18px;
  line-height: 1;
  transition: background .2s, color .2s;
}
.cart-drawer__close:hover { background: var(--green-50); color: var(--green-600); }

/* ── Прокручуваний список товарів ── */
.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Порожній кошик ── */
.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 100%;
  color: var(--text-3);
  font-size: 15px;
  text-align: center;
}
.cart-empty__icon { font-size: 52px; opacity: .45; line-height: 1; }

/* ── Один товар у кошику ── */
.cart-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  align-items: start;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.cart-item:last-child { border-bottom: none; padding-bottom: 0; }

.cart-item__img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--green-25);
  display: block;
  flex-shrink: 0;
}
.cart-item__info { min-width: 0; }
.cart-item__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 4px;
  line-height: 1.35;
  word-break: break-word;
}
.cart-item__price {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 8px;
}
.cart-item__subtotal {
  font-size: 13px;
  font-weight: 700;
  color: #16a34a;
}

/* ── Контроль кількості ── */
.cart-item__qty {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.cart-item__qty-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-1);
  transition: background .2s, border-color .2s, color .2s;
  font-weight: 700;
  line-height: 1;
  padding: 0;
}
.cart-item__qty-btn:hover {
  background: var(--green-50);
  border-color: var(--green-600);
  color: var(--green-600);
}
.cart-item__qty-num {
  font-size: 15px;
  font-weight: 600;
  min-width: 22px;
  text-align: center;
  color: var(--text-1);
}

/* ── Кнопка видалення ── */
.cart-item__remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #aaa;
  font-size: 16px;
  padding: 4px;
  border-radius: 4px;
  line-height: 1;
  transition: background .2s, color .2s;
  flex-shrink: 0;
  margin-top: 2px;
}
.cart-item__remove:hover { background: #fff5f5; color: #e53e3e; }

/* ── Підсумок і оформлення ── */
.cart-footer {
  border-top: 2px solid var(--border);
  padding: 16px 20px 24px;
  flex-shrink: 0;
}
.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
  gap: 8px;
}
.cart-total__label { font-size: 15px; color: var(--text-2); }
.cart-total__sum {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: -.025em;
}
.cart-checkout-btn {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  background: var(--green-600);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background .2s;
  font-family: var(--font);
}
.cart-checkout-btn:hover:not(:disabled) { background: var(--green-700); }
.cart-checkout-btn:disabled { opacity: .45; cursor: default; }

/* ── Форма оформлення ── */
.cart-checkout-form {
  display: none;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}
.cart-checkout-form.show { display: flex; }
.cart-checkout-form input,
.cart-checkout-form textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-1);
  background: #fff;
  transition: border-color .2s;
  box-sizing: border-box;
}
.cart-checkout-form input:focus,
.cart-checkout-form textarea:focus {
  outline: none;
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgba(46,139,71,.12);
}
.cart-checkout-form textarea { resize: vertical; min-height: 68px; }
.cart-form-submit {
  padding: 12px;
  font-size: 15px;
  font-weight: 700;
  background: var(--green-600);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background .2s;
  font-family: var(--font);
}
.cart-form-submit:hover { background: var(--green-700); }

/* ── Повідомлення успіху ── */
.cart-form-success {
  display: none;
  text-align: center;
  padding: 16px;
  background: var(--green-25);
  border: 1px solid var(--green-100);
  border-radius: 8px;
  color: var(--green-700);
  font-weight: 600;
  font-size: 15px;
  margin-top: 12px;
  line-height: 1.5;
}
.cart-form-success.show { display: block; }

/* ── Мобільна адаптація ── */
@media (max-width: 480px) {
  .cart-drawer { width: 100vw; }

  /* На мобільному кнопки — стовпчик */
  .card-btns {
    flex-direction: column;
  }
}
