/**
         * Advanced Add to Cart — Frontend Stylesheet
         * All rules scoped to .aatc-* to avoid theme conflicts.
         * @package AdvancedAddToCart
         */

/* ==========================================================================
           Wrapper — block-level, no flex gap (items use margin-bottom individually)
           ========================================================================== */
.aatc-wrapper {
  display: block;
  box-sizing: border-box;
}

.aatc-wrapper *,
.aatc-wrapper * ::before,
.aatc-wrapper * ::after {
  box-sizing: border-box;
}

/* ==========================================================================
           Price — .aatc-price is shared by simple, range, and variation divs.
           Elementor controls target this class for unified styling.
           ========================================================================== */
.aatc-price {
  display: block;
  line-height: 1.4;
  margin-bottom: 12px; /* default, overridden by Elementor control */
  text-align: start;
}

.aatc-price.amount {
  font-weight: inherit;
}

.aatc-price del {
  opacity: 0.6;
}

.aatc-price del.amount {
  text-decoration: line-through;
}

.aatc-price ins {
  text-decoration: none;
}

/* Stock status inside price variation area */
.aatc-stock-status {
  display: block;
  font-size: 18px;
  font-weight: 400;
  line-height: 29px;
  margin-bottom: 32px;
}

.aatc-out-of-stock {
  color: #e2401c;
}

.aatc-in-stock {
  color: #2da44e;
}

.aatc-variation-description {
  margin: 6px 0 0;
  font-size: 0.875em;
  color: #666;
}

/* ==========================================================================
           Variation table
           ========================================================================== */
.aatc-variations-table {
  width: 100%;
  border-collapse: collapse;
}

.aatc-variations-table th,
.aatc-variations-table td {
  text-align: start;
  vertical-align: middle;
}
.aatc-variations-table tr {
  margin-bottom: 32px;
  display: flex;
  align-items: center;
}

.aatc-variations-table th.label {
  white-space: nowrap;
  font-weight: 600;
  padding-left: 32px;
  padding-right: 14px;
}
.pa_size .label {
  margin-left: -76px;
}

.aatc-variations-table td.value {
  width: 100%;
}

.aatc-custom-select {
  position: relative;
  width: 100%;
}

.aatc-custom-select-head {
  height: 48px;
  border: 1px solid #dcdcdc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 48px 0 16px;
  cursor: pointer;
  background: transparent;
  border-left: none;
}

.aatc-custom-select-dropdown {
  display: none;
  border: 1px solid #dcdcdc;
  border-top: none;
  background: #fff;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  z-index: 30;
  margin-top: 4px;
}

.aatc-custom-select.open .aatc-custom-select-dropdown {
  display: block;
}

.aatc-custom-select-arrow {
  display: flex;
  transition: all linear 0.3s;
  transform: rotate(0);
}
.aatc-custom-select.open .aatc-custom-select-arrow {
  transform: rotate(180deg);
}

.aatc-custom-option {
  padding: 14px 16px;
  cursor: pointer;
  transition: 0.2s;
  text-transform: uppercase;
}

.aatc-custom-option:hover {
  background: #f5f5f5;
}

.aatc-custom-option.active {
  font-weight: 700;
}

.aatc-custom-select-value {
  font-size: 14px;
  text-transform: uppercase;
}

/* = === === === === === === === === === === === === === === === === === === === === === === === === =
                Quantity wrapper ===
                === === === === === === === === === === === === === === === === === === === === === === === == */
.aatc-quantity-wrapper {
  display: inline-flex;
  align-items: center;
  border: 1px solid #ddd; /* overridden by Elementor */
  border-radius: 4px; /* overridden by Elementor */
  overflow: hidden;
  background: #fff;
  margin-bottom: 12px; /* default, overridden by Elementor control */
}

/* Input */
.aatc-quantity-input {
  width: 60px; /* overridden by Elementor */
  height: 44px; /* overridden by Elementor */
  border: none;
  outline: none;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: #333;
  background: transparent;
  padding: 0 4px;
  -moz-appearance: textfield;
}

.aatc-quantity-input::-webkit-outer-spin-button,
.aatc-quantity-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* +/- buttons */
.aatc-qty-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 38px; /* overridden by Elementor */
  height: 44px; /* overridden by Elementor */
  border: none;
  background: #f0f0f0;
  color: #444;
  font-size: 20px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  padding: 0;
  transition: background 0.2s, color 0.2s;
}

.aatc-qty-btn:hover {
  background: #2271 b1;
  color: #fff;
}

.aatc-qty-btn:focus-visible {
  outline: 2px solid #2271b1;
  outline-offset: -2px;
}

.aatc-qty-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* = === === === === === === === === === === === === === === === === === === === === === === === === =
                        Add to Cart button ===
                        === === === === === === === === === === === === === === === === === === === === === === === == */
.aatc-add-to-cart-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px; /* overridden by Elementor */
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  color: #fff;
  background: #2271b1;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  transition: background 0.3s, transform 0.3s, box-shadow 0.3s;
  text-decoration: none;
  margin-bottom: 0;
}

.aatc-add-to-cart-btn:hover:not(:disabled):not(.aatc-loading):not(.aatc-disabled) {
  background: #135e96;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.aatc-add-to-cart-btn:active:not(:disabled):not(.aatc-disabled) {
  transform: translateY(0);
}

.aatc-add-to-cart-btn:focus-visible {
  outline: 2px solid #2271b1;
  outline-offset: 3px;
}

/* Disabled/ out-of-stock */
.aatc-add-to-cart-btn:disabled,
.aatc-add-to-cart-btn.aatc-disabled {
  background: #8ab0cf;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  pointer-events: none;
}

/* Loading state */
.aatc-add-to-cart-btn.aatc-loading {
  cursor: default;
  pointer-events: none;
}

.aatc-add-to-cart-btn.aatc-loading.aatc-btn-text {
  opacity: 0;
  visibility: hidden;
}

.aatc-add-to-cart-btn.aatc-loading.aatc-btn-loading {
  opacity: 1;
  visibility: visible;
}

/* Success state */
.aatc-add-to-cart-btn.aatc-added {
  background: #2da44e;
}

/* Hidden loading layer */
.aatc-btn-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s;
}

/* Spinner */
.aatc-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  border-top-color: #fff;
  animation: aatc-spin 0.7 s linear infinite;
}

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

/* ==========================================================================
                       Toast notification
                       ========================================================================== */
.aatc-toast-container {
  position: fixed;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  /* position set via JS from data-toast-cfg */
}

.aatc-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 280px; /* overridden by Elementor */
  max-width: 420px;
  padding: 14px 16px; /* overridden by Elementor */
  border-radius: 8px; /* overridden by Elementor */
  font-size: 14px;
  line-height: 1.5;
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  pointer-events: auto;
  animation: aatc-toast-in 0.35 s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.aatc-toast.aatc-toast-success {
  background: #1d6a38;
}
.aatc-toast.aatc-toast-error {
  background: #c0392b;
}
.aatc-toast.aatc-toast-info {
  background: #1a73e8;
}

.aatc-toast.aatc-toast-hiding {
  animation: aatc-toast-out 0.3s ease forwards;
}

.aatc-toast-icon {
  flex-shrink: 0;
  font-size: 18px;
  line-height: 1.5;
}

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

.aatc-toast-message {
  display: block;
  font-weight: 500;
}

.aatc-toast-link {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: #fff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.2 s;
}

.aatc-toast-link:hover {
  background: rgba(255, 255, 255, 0.35);
  color: #fff;
}

.aatc-toast-close {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.75);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  margin-left: 4px;
  transition: color 0.2 s;
  align-self: flex-start;
}

.aatc-toast-close:hover {
  color: #fff;
}

@keyframes aatc-toast-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes aatc-toast-out {
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.95);
  }
}

/* ==========================================================================
                       Elementor editor placeholder
                       ========================================================================== */
.aatc-editor-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  padding: 16px;
  background: #f8f8f8;
  border: 2px dashed #c5c5c5;
  border-radius: 6px;
  text-align: center;
  color: #666;
  font-size: 13px;
}

/* = === === === === === === === === === === === === === === === === === === === === === === === === =
                            Responsive ===
                            === === === === === === === === === === === === === === === === === === === === === === === == */
@media (max-width: 480px) {
  .aatc-add-to-cart-btn {
    width: 100%;
    justify-content: center;
  }

  .aatc-toast-container {
    left: 12px !important;
    right: 12px !important;
    bottom: 12px;
  }

  .aatc-toast {
    max-width: 100%;
    min-width: 0;
  }
}
