/* ==============================================
   ADV Add Cart V2.0 - Base Styles
   Unique selectors to avoid conflicts with FAAC plugin
   ============================================== */

/* Wrapper */
.advcart-v2-wrapper {
  position: relative;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.advcart-v2-wrapper * {
  box-sizing: border-box;
}

/* ==============================================
   VARIATIONS
   ============================================== */

.advcart-v2-variations {
  margin-bottom: 1em;
}

.advcart-v2-variation-row {
  margin-bottom: 1em;
}

.advcart-v2-variation-row label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5em;
  font-size: 14px;
}

.advcart-v2-variation-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.advcart-v2-variable-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  background-color: #f5f5f5;
  color: #333333;
  border: 1px solid #ddd;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 14px;
  user-select: none;
  min-width: 60px;
  text-align: center;
}

.advcart-v2-variable-item:hover {
  background-color: #e0e0e0;
  border-color: #bbb;
  transform: translateY(-1px);
}

.advcart-v2-variable-item.advcart-selected {
  background-color: #000000;
  color: #ffffff;
  border-color: #000000;
}

/* Variation button styles */
.advcart-v2-variable-item.advcart-var-rounded {
  border-radius: 8px;
}

.advcart-v2-variable-item.advcart-var-pill {
  border-radius: 50px;
}

/* ==============================================
   PRICE DISPLAY
   ============================================== */

.advcart-v2-price-wrapper {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1em;
}

.advcart-v2-price {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
}

/* Critical: Override WooCommerce inline styles */
.advcart-v2-price del,
.advcart-v2-price del *,
.advcart-v2-price del span,
.advcart-v2-price del .woocommerce-Price-amount,
.advcart-v2-price del .woocommerce-Price-amount * {
  color: inherit !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  font-family: inherit !important;
}

.advcart-v2-price ins,
.advcart-v2-price ins *,
.advcart-v2-price ins span,
.advcart-v2-price ins .woocommerce-Price-amount,
.advcart-v2-price ins .woocommerce-Price-amount *,
.advcart-v2-price > .woocommerce-Price-amount,
.advcart-v2-price > .woocommerce-Price-amount * {
  color: inherit !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  font-family: inherit !important;
}

/* Regular/Strikethrough price */
.advcart-v2-price del {
  color: #999999;
  text-decoration: line-through;
  margin-right: 8px;
  font-weight: 400;
  display: inline-block;
}

/* Sale/Current price */
.advcart-v2-price ins {
  text-decoration: none;
  color: #e74c3c;
  font-weight: 700;
  display: inline-block;
}

/* When no sale (single price) - use sale price styling */
.advcart-v2-price:not(:has(del)) {
  color: #e74c3c;
  font-weight: 700;
}

/* Hide screen reader text */
.advcart-v2-price .screen-reader-text {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
}

/* ==============================================
   SALE BADGE
   ============================================== */

.advcart-v2-sale-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  background-color: #e74c3c;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  border-radius: 3px;
  white-space: nowrap;
  line-height: 1.2;
}

.advcart-v2-sale-badge.inline {
  margin-left: 8px;
}

.advcart-v2-sale-badge.badge {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 10;
}

/* ==============================================
   CART CONTROLS
   ============================================== */

.advcart-v2-controls {
  position: relative;
  margin-top: 1em;
}

.advcart-v2-add-cart {
  position: relative;
  width: 100%;
  margin: 0.5em 0;
}

/* Spinner Overlay */
.advcart-v2-spinner-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              visibility 0s linear 0.3s; /* Delay visibility until after fade */
  z-index: 10;
  border-radius: inherit; /* Inherits from button/qty wrapper */
}

.advcart-v2-spinner-overlay.advcart-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              visibility 0s linear 0s; /* No delay on show */
}

/* Success checkmark - hidden by default */
.advcart-v2-success-check {
  position: absolute;
  font-size: 40px;
  color: #22c55e;
  opacity: 0;
  visibility: hidden;
  transform: scale(0);
  pointer-events: none;
}

/* Default Spinner */
.advcart-v2-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top: 3px solid #fff;
  border-radius: 50%;
  animation: advcart-spin 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

@keyframes advcart-spin {
  to { transform: rotate(360deg); }
}

/* Add Button */
.advcart-v2-add-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100% !important; /* Force 100% width */
  height: 44px;
  padding: 0 1.2em;
  background-color: #000000;
  color: #ffffff;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 0;
}

.advcart-v2-add-btn:hover {
  background-color: #333333;
  transform: translateY(-1px);
}

.advcart-v2-add-btn:active {
  transform: translateY(0) scale(0.98);
}

.advcart-v2-btn-text {
  flex: 1;
  text-align: left;
}

.advcart-v2-btn-icon {
  font-size: 1.4em;
  font-weight: 400;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-left: 8px;
}

.advcart-v2-add-btn:hover .advcart-v2-btn-icon {
  transform: translateX(3px);
}

/* Quantity Controls */
.advcart-v2-qty-wrap {
  display: flex;
  align-items: center;
  width: 100%;
  height: 44px;
  overflow: hidden;
}

.advcart-v2-qty-minus,
.advcart-v2-qty-plus {
  width: 44px;
  height: 100%;
  background-color: #000000;
  color: #ffffff;
  border: none;
  cursor: pointer;
  font-size: 20px;
  font-weight: 700;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  border-radius: 0 !important; /* No radius on buttons - wrapper clips them */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

.advcart-v2-qty-minus:hover,
.advcart-v2-qty-plus:hover {
  background-color: #333333;
}

.advcart-v2-qty-minus:active,
.advcart-v2-qty-plus:active {
  background-color: #555555;
  transform: scale(0.95);
}

.advcart-v2-qty {
  flex: 1;
  text-align: center;
  border: none;
  background: #ffffff;
  font-size: 16px;
  font-weight: 600;
  pointer-events: none;
  padding: 0 8px;
  min-width: 0;
  color: #000000;
  line-height: 1;
}

/* ==============================================
   RESPONSIVE
   ============================================== */

@media (max-width: 768px) {
  .advcart-v2-variation-options {
    gap: 6px;
  }

  .advcart-v2-variable-item {
    padding: 6px 12px;
    font-size: 13px;
    min-width: 50px;
  }

  .advcart-v2-price {
    font-size: 16px;
  }

  .advcart-v2-add-btn {
    height: 40px;
    font-size: 13px;
  }

  .advcart-v2-qty-wrap {
    height: 40px;
  }

  .advcart-v2-qty-minus,
  .advcart-v2-qty-plus {
    width: 40px;
  }
}

/* ==============================================
   ELEMENTOR EDITOR COMPATIBILITY
   ============================================== */

.elementor-editor-active .advcart-v2-wrapper {
  min-height: 100px;
}