/*
 * Bulk Add to Cart for WooCommerce – Frontend Styles
 * v2.0.0
 *
 * Theme-agnostic: works with classic PHP themes and WooCommerce blocks.
 * Checkboxes are injected via JS; CSS provides the visual layer.
 */

/* =============================================
   Product Card – ensure positioning context
   =============================================
   JS also sets position:relative inline, but
   this CSS rule acts as a safety net.            */

ul.products li.product,
.wc-block-grid__products .wc-block-grid__product,
.wc-block-components-product-card {
  position: relative !important;
}

/* =============================================
   Product Checkbox
   ============================================= */

/* Wrapper – sits top-left over the product card */
.batc-checkbox-wrap {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 9999;
  cursor: pointer;
}

/* Circular label with shadow */
.batc-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: #fff;
  border: 2px solid #ccc;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.batc-label:hover {
  border-color: #888;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
  transform: scale(1.08);
}

/* Hide the native checkbox */
.batc-cb {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Custom tick box */
.batc-box {
  display: block;
  width: 16px;
  height: 16px;
  border: 2px solid #bbb;
  border-radius: 3px;
  transition: background 0.15s, border-color 0.15s;
}

/* Checked state */
.batc-cb:checked~.batc-box {
  background: #000;
  border-color: #000;
}

.batc-cb:checked~.batc-box::after {
  content: '';
  display: block;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin: 1px auto 0;
}

/* =============================================
   Card Highlight (checked state)
   ============================================= */

li.product.batc-card-checked,
.wc-block-grid__product.batc-card-checked,
.wc-block-components-product-card.batc-card-checked {
/*   outline: 3px solid #000; */
  /* outline-offset: -3px; */
/*   border-radius: 4px; */
}

/* =============================================
   Select-All Bar
   ============================================= */

.batc-select-all-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  margin-bottom: 16px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.batc-select-all-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  user-select: none;
}

.batc-select-all {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #000;
}

.batc-count {
  font-size: 13px;
  color: #666;
  margin-left: auto;
  white-space: nowrap;
}

/* =============================================
   Floating Action Button
   ============================================= */

.batc-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 99999;
  display: none;
  /* hidden until .batc-visible class */
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  color: #fff;
  border: none;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
  transform: translateY(80px);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s, box-shadow 0.2s;
  font-family: inherit;
  white-space: nowrap;
  line-height: 1;
}

.batc-fab.batc-visible {
  display: inline-flex;
  transform: translateY(0);
  opacity: 1;
}

.batc-fab:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35);
}

.batc-fab:active {
  transform: translateY(0);
}

.batc-fab.batc-busy {
  pointer-events: none;
  opacity: 0.8;
}

/* Spinner while adding */
.batc-fab.batc-busy .batc-fab-icon {
  display: none;
}

.batc-fab.batc-busy::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: batc-spin 0.6s linear infinite;
}

@keyframes batc-spin {
  to {
    transform: rotate(360deg);
  }
}

.batc-fab-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.batc-fab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
}

/* Position variants */
.batc-pos-bottom-left {
  right: auto;
  left: 28px;
}

.batc-pos-bottom-center {
  right: auto;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
}

.batc-pos-bottom-center.batc-visible {
  transform: translateX(-50%) translateY(0);
}

.batc-pos-bottom-center:hover {
  transform: translateX(-50%) translateY(-3px);
}

/* =============================================
   Toast Notification
   ============================================= */

.batc-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 999999;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  max-width: 380px;
  transform: translateX(calc(100% + 40px));
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s;
}

.batc-toast.batc-toast-show {
  transform: translateX(0);
  opacity: 1;
}

.batc-toast-check {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: #16a34a;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}

.batc-toast-body {
  flex: 1;
  min-width: 0;
}

.batc-toast-body strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}

.batc-toast-body p {
  margin: 0;
  font-size: 13px;
  color: #666;
}

.batc-toast-link {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 12px;
  background: #000;
  color: #fff !important;
  text-decoration: none !important;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
}

.batc-toast-link:hover {
  background: #333;
}

.batc-toast-close {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: #aaa;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.batc-toast-close:hover {
  color: #666;
}

/* =============================================
   Mobile
   ============================================= */

@media (max-width: 768px) {
  .batc-checkbox-wrap {
    top: 6px;
    left: 6px;
  }

  .batc-label {
    width: 28px;
    height: 28px;
  }

  .batc-box {
    width: 14px;
    height: 14px;
  }

  .batc-fab {
    bottom: 16px;
    right: 16px;
    left: 16px;
    justify-content: center;
    border-radius: 14px;
  }

  .batc-pos-bottom-left {
    left: 16px;
    right: 16px;
  }

  .batc-pos-bottom-center {
    left: 16px;
    right: 16px;
    transform: translateY(80px);
  }

  .batc-pos-bottom-center.batc-visible {
    transform: translateY(0);
  }

  .batc-toast {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }
}