/**
 * Brixius Trading - action loader
 *
 * Feedback for actions that submit and reload: updating a cart quantity,
 * removing a line, adding to cart. Without it those read as a frozen page,
 * because nothing changes until the server responds.
 *
 * Visual language matches the existing page preloader in header.php:
 * a ring with a navy top edge, rotating.
 */

.bdk-busy {
  position: relative;
}

.bdk-busy__veil {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: saturate(80%) blur(1px);
  animation: bdk-busy-in .12s ease-out both;
}

/* full-page variant, for navigations away from the cart */
.bdk-busy__veil--page {
  position: fixed;
  background: rgba(255, 255, 255, .8);
  z-index: 99999;
}

.bdk-busy__ring {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(0, 0, 0, .15);
  border-top-color: #013E8A;
  animation: bdk-busy-spin .9s linear infinite;
}

.bdk-busy__label {
  margin-left: 14px;
  font-family: "Nunito Sans", sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #013E8A;
  letter-spacing: .01em;
}

/* keep the spinner in view on a long cart rather than centred far below */
.bdk-busy__veil--sticky .bdk-busy__inner {
  position: sticky;
  top: 40vh;
  display: flex;
  align-items: center;
}

.bdk-busy__inner {
  display: flex;
  align-items: center;
}

/* buttons that triggered the action */
.bdk-busy-btn {
  opacity: .65 !important;
  pointer-events: none !important;
  cursor: progress !important;
}

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

@keyframes bdk-busy-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .bdk-busy__ring { animation-duration: 2.4s; }
  .bdk-busy__veil { animation: none; }
}

/* ---- product-list cards (shop, TILKØB, upsells) ----
   The list button draws its label in ::after (app.css). WooCommerce's own
   .loading / .added rules also style ::after (icon font, spin, offset), which
   scrambles that label, so they are neutralised and replaced here. */

.woocommerce div.product.card .add_to_cart_button.loading::after,
.woocommerce div.product.card .add_to_cart_button.added::after {
  font-family: inherit !important;
  font-weight: inherit !important;
  animation: none !important;
  top: auto !important;
  vertical-align: baseline !important;
}

.woocommerce div.product.card .add_to_cart_button.loading::after,
.woocommerce div.product.card .add_to_cart_button.bdk-busy-btn::after {
  content: "TILFØJER …";
}

.woocommerce div.product.card .add_to_cart_button.added::after {
  content: "LÆG I KURV";
}

/* Added: same navy button, same cart icon and label, plus a check on the
   right - like TILFØJ TIL KURV on the product page. Stays until reload.
   The button grows by 16px for the check so the label isn't squeezed. */
.woocommerce div.product.card .add_to_cart_button.bdk-added {
  width: 130px;
}

.woocommerce div.product.card .add_to_cart_button.bdk-added::after {
  content: "LÆG I KURV";
  width: 120px;
  padding-right: 24px;
  background-image: url(../icon/cart-icon.png), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-size: 21px, 12px;
  background-position: 4px 2px, right 7px center;
}

@media (max-width: 1600px) {
  .woocommerce div.product.card .add_to_cart_button.bdk-added { width: 114px; }
  .woocommerce div.product.card .add_to_cart_button.bdk-added::after {
    width: 114px;
    background-size: 19px, 11px;
  }
}
