/**
 * TC Multi Add To Cart v3.7.0
 * Updated: Added cart update feedback animation
 */

:root {
  --tcmae-primary: #2563eb;
  --tcmae-primary-hover: #1d4ed8;
  --tcmae-text: #1f2937;
  --tcmae-text-muted: #6b7280;
  --tcmae-border: #e5e7eb;
  --tcmae-bg: #ffffff;
  --tcmae-success: #10b981;
  --tcmae-error: #ef4444;
  --tcmae-radius: 6px;
}

/* Cart update feedback animation */
.tcmae-cart-updated {
  animation: tcmae-cart-pulse 0.6s ease-out;
}

@keyframes tcmae-cart-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.tcmae-wrap {
  width: 100%;
  font-family: inherit;
  box-sizing: border-box;
  position: relative;
}

.tcmae-wrap *, .tcmae-wrap *::before, .tcmae-wrap *::after {
  box-sizing: border-box;
}

/* Grid */
.tcmae-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Row - Inline */
.tcmae-layout-inline .tcmae-row {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  gap: 8px;
}

.tcmae-layout-inline .tcmae-row > * {
  flex: 0 0 auto;
}

.tcmae-layout-inline .tcmae-info {
  flex: 0 1 auto;
  min-width: 0;
}

.tcmae-layout-inline .tcmae-footer {
  display: none;
}

/* Row - Horizontal */
.tcmae-layout-horizontal .tcmae-row {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--tcmae-bg);
  border: 1px solid var(--tcmae-border);
  border-radius: var(--tcmae-radius);
}

.tcmae-layout-horizontal .tcmae-info {
  flex: 1 1 100px;
  min-width: 80px;
}

/* Row - Vertical */
.tcmae-layout-vertical .tcmae-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 12px;
  background: var(--tcmae-bg);
  border: 1px solid var(--tcmae-border);
  border-radius: var(--tcmae-radius);
}

/* Disabled */
.tcmae-row-disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Image */
.tcmae-image {
  width: 40px;
  flex: 0 0 40px;
}

.tcmae-image img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
}

/* Info */
.tcmae-info {
  min-width: 0;
}

.tcmae-name {
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.3;
  color: var(--tcmae-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tcmae-sku {
  font-size: 0.75rem;
  color: var(--tcmae-text-muted);
}

.tcmae-stock {
  font-size: 0.75rem;
  margin-top: 2px;
}

.tcmae-in-stock { color: var(--tcmae-success); }
.tcmae-out-of-stock { color: var(--tcmae-error); }

/* Price */
.tcmae-price {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--tcmae-text);
  white-space: nowrap;
}

.tcmae-price del {
  opacity: 0.5;
  font-size: 0.85em;
  margin-right: 2px;
}

.tcmae-price ins {
  text-decoration: none;
  color: var(--tcmae-error);
}

/* Quantity Wrapper */
.tcmae-qty-wrap {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--tcmae-border);
  border-radius: var(--tcmae-radius);
  overflow: hidden;
  background: var(--tcmae-bg);
}

/* Quantity Buttons */
.tcmae-qty-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  border: none;
  cursor: pointer;
  font-size: 18px;
  font-weight: 400;
  color: var(--tcmae-text);
  transition: all 0.15s ease;
  padding: 0;
  line-height: 1;
  user-select: none;
}

.tcmae-qty-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

.tcmae-qty-btn:hover {
  background: #e5e7eb;
}

.tcmae-qty-btn:active {
  background: #d1d5db;
}

.tcmae-qty-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Quantity Input */
.tcmae-qty {
  width: 50px;
  height: 36px;
  border: none;
  border-left: 1px solid var(--tcmae-border);
  border-right: 1px solid var(--tcmae-border);
  padding: 0 4px;
  font-weight: 600;
  font-size: 1rem;
  text-align: center;
  color: var(--tcmae-text);
  background: transparent;
  -moz-appearance: textfield;
}

.tcmae-qty::-webkit-outer-spin-button,
.tcmae-qty::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.tcmae-qty:focus {
  outline: none;
  background: #f0f9ff;
}

/* No buttons */
.tcmae-qty-no-buttons .tcmae-qty {
  border: none;
  border-radius: var(--tcmae-radius);
}

/* Button */
.tcmae-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  font-weight: 600;
  font-size: 0.875rem;
  color: #ffffff;
  background: var(--tcmae-primary);
  border: none;
  border-radius: var(--tcmae-radius);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tcmae-submit:hover {
  background: var(--tcmae-primary-hover);
}

.tcmae-submit:active {
  transform: scale(0.98);
}

.tcmae-submit.tcmae-loading {
  opacity: 0.7;
  pointer-events: none;
}

/* Footer */
.tcmae-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

/* Total */
.tcmae-total-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #f8fafc;
  border-radius: 6px;
  flex-grow: 1;
}

.tcmae-total-label {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--tcmae-text-muted);
}

.tcmae-total-amount {
  font-weight: 700;
  font-size: 1rem;
  color: var(--tcmae-text);
}

/* Popup */
.tcmae-popup {
  position: fixed;
  z-index: 99999;
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 16px 24px;
  background: var(--tcmae-success);
  color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  animation: tcmae-fade-in 0.3s ease;
  max-width: 320px;
}

.tcmae-popup.tcmae-popup-visible {
  display: flex;
}

.tcmae-popup.tcmae-popup-error {
  background: var(--tcmae-error);
}

.tcmae-popup.tcmae-popup-hiding {
  animation: tcmae-fade-out 0.3s ease forwards;
}

@keyframes tcmae-fade-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes tcmae-fade-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-10px); }
}

.tcmae-popup-top-left { top: 20px; left: 20px; }
.tcmae-popup-top-center { top: 20px; left: 50%; transform: translateX(-50%); }
.tcmae-popup-top-right { top: 20px; right: 20px; }
.tcmae-popup-bottom-left { bottom: 20px; left: 20px; }
.tcmae-popup-bottom-center { bottom: 20px; left: 50%; transform: translateX(-50%); }
.tcmae-popup-bottom-right { bottom: 20px; right: 20px; }
.tcmae-popup-center { top: 50%; left: 50%; transform: translate(-50%, -50%); }

.tcmae-popup-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tcmae-popup-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.tcmae-popup-text {
  font-weight: 600;
  font-size: 0.9375rem;
}

.tcmae-popup-link {
  font-size: 0.8125rem;
  color: inherit;
  opacity: 0.9;
  text-decoration: underline;
}

.tcmae-popup-link:hover {
  opacity: 1;
}

/* Responsive */
@media (max-width: 480px) {
  .tcmae-popup {
    left: 10px !important;
    right: 10px !important;
    max-width: none;
    transform: none !important;
  }
}
