/**
 * SP Cart Slider - Clean Slate
 */

/* Overlay */
.sp-cart-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999999;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s, visibility 0.2s;
}

.sp-cart-drawer-overlay.sp-active {
  visibility: visible;
  opacity: 1;
}

/* Drawer */
.sp-cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  max-width: 100%;
  height: 100%;
  background: #fff;
  z-index: 1000000;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s;
}

.sp-cart-drawer-overlay.sp-active .sp-cart-drawer {
  transform: translateX(0);
}

/* Header */
.sp-cart-drawer-header {
  padding: 16px;
  background: var(--sp-primary, #002868);
  border-bottom: 3px solid var(--sp-accent, #BF0A30);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sp-drawer-title-link {
  font-size: 16px;
  font-weight: 600;
  color: #fff !important;
  background: none !important;
  padding: 0 !important;
  border: none !important;
  text-decoration: none !important;
}

.sp-drawer-title-link:hover {
  color: #fff !important;
  text-decoration: underline !important;
}

.sp-cart-drawer-close {
  background: none !important;
  border: none !important;
  font-size: 32px !important;
  cursor: pointer;
  color: #fff !important;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
}

@media (max-width: 480px) {
  .sp-cart-drawer-close {
    font-size: 40px !important;
    width: 52px !important;
    height: 52px !important;
    min-width: 52px !important;
  }
}

/* Body */
.sp-cart-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.sp-cart-drawer-body.sp-loading {
  opacity: 0.5;
}

/* Progress Bar */
.sp-offers-progress-bar {
  padding: 12px 16px 14px;
  border-bottom: 1px solid #eee;
  background: #fafafa;
}

.sp-offers-progress-bar.sp-offers-progress-loading {
  visibility: hidden;
}

.sp-offers-progress-bar.sp-hidden {
  display: none;
}

.sp-offers-progress-message {
  font-size: 13px !important;
  font-weight: 500 !important;
  color: #000 !important;
  text-align: center;
  margin-bottom: 10px;
}

.sp-offers-progress-track {
  width: 100%;
  height: 8px;
  background: #e5e5e5;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.sp-offers-progress-fill {
  height: 100%;
  background: var(--sp-primary, #002868);
  border-radius: 4px;
  width: 0%;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

/* Shimmer animation on progress bar */
.sp-offers-progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.4) 50%,
    transparent 100%
  );
  animation: sp-progress-shimmer 2s ease-in-out infinite;
}

@keyframes sp-progress-shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Goal reached - navy blue */
.sp-offers-progress-bar.sp-goal-reached .sp-offers-progress-fill {
  background: var(--sp-primary, #002868);
}

.sp-offers-progress-bar.sp-goal-reached .sp-offers-progress-message {
  color: var(--sp-primary, #002868) !important;
}

@keyframes sp-goal-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.sp-offers-progress-bar.sp-goal-reached {
  animation: sp-goal-pop 0.4s ease;
}

/* Cart Items */
.sp-cart-items {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sp-cart-item {
  display: flex;
  gap: 12px;
  position: relative;
  padding-bottom: 16px;
  border-bottom: 1px solid #eee;
}

.sp-cart-item:last-child {
  border-bottom: none;
}

.sp-remove {
  position: absolute;
  top: -4px;
  left: -4px;
  background: #e5e5e5 !important;
  border: none !important;
  font-size: 18px;
  cursor: pointer;
  color: #333 !important;
  width: 24px !important;
  height: 24px !important;
  min-width: 24px !important;
  min-height: 24px !important;
  max-width: 24px !important;
  max-height: 24px !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  z-index: 1;
  box-sizing: border-box !important;
}

.sp-remove:hover {
  background: #ccc !important;
}

@media (max-width: 480px) {
  .sp-remove {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    max-width: 28px !important;
    max-height: 28px !important;
    font-size: 14px;
    top: -6px;
    left: -6px;
  }
}

.sp-item-img img {
  width: 60px;
  height: 60px;
  object-fit: cover;
}

.sp-item-info {
  flex: 1;
}

.sp-item-name {
  font-size: 14px;
  color: #000 !important;
  text-decoration: none !important;
  display: block;
  margin-bottom: 4px;
}

.sp-free-badge {
  font-size: 11px;
  font-style: italic;
  color: #16a34a;
  font-weight: 600;
}

.sp-free-price {
  color: #16a34a !important;
  font-weight: 600;
}

.sp-item-price {
  font-size: 14px;
  margin-bottom: 8px;
}

.sp-item-price del {
  color: #999;
  margin-right: 4px;
}

.sp-item-qty {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sp-item-qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid #ddd;
  border-radius: 20px;
  overflow: hidden;
}

.sp-qty-btn {
  width: 28px;
  height: 28px;
  border: none !important;
  background: #fff !important;
  color: #000 !important;
  cursor: pointer;
  border-radius: 0 !important;
  padding: 0;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 14px;
  line-height: 1;
}

.sp-qty-btn:hover {
  background: #f5f5f5 !important;
}

.sp-cart-qty-readonly {
  font-size: 13px;
  color: #666;
}

.sp-qty-val {
  min-width: 28px;
  height: 28px;
  line-height: 28px;
  text-align: center;
  font-size: 13px;
  border: none;
}

/* Empty */
.sp-cart-empty {
  text-align: center;
  padding: 40px;
  color: #666;
}

.sp-cart-empty-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

/* Footer */
.sp-cart-drawer-footer {
  padding: 16px;
  border-top: none;
  position: relative;
}

.sp-cart-drawer-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--sp-accent, #BF0A30), #E8E8E8 40%, #E8E8E8 60%, var(--sp-primary, #002868));
}

/* Discount / Coupon Accordion */
.sp-discount-section-wrapper {
  border-bottom: 1px solid #eee;
  margin-bottom: 12px;
  padding-bottom: 12px;
}

.sp-discount-section-wrapper:empty {
  display: none;
}

.sp-discount-toggle {
  background: none !important;
  border: none !important;
  padding: 0 !important;
  font-size: 14px !important;
  color: #000 !important;
  cursor: pointer;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  width: 100% !important;
  text-align: left !important;
}

.sp-discount-toggle:hover {
  opacity: 0.7;
}

.sp-arrow {
  font-size: 12px;
  transition: transform 0.2s;
}

.sp-discount-form {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.sp-discount-form input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.sp-discount-form input:focus {
  outline: none;
  border-color: var(--sp-primary, #002868);
}

.sp-apply-coupon {
  background: var(--sp-primary, #002868) !important;
  color: #fff !important;
  border: none !important;
  padding: 8px 16px !important;
  border-radius: 4px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  white-space: nowrap;
}

.sp-apply-coupon:hover {
  background: #001a4a !important;
}

.sp-applied-coupons {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sp-coupon-tag {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #000;
}

.sp-remove-coupon {
  background: none !important;
  border: none !important;
  color: #666 !important;
  font-size: 18px !important;
  cursor: pointer !important;
  padding: 0 !important;
}

.sp-coupon-notice {
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 4px;
  margin-top: 8px;
}
.sp-coupon-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.sp-coupon-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.sp-subtotal {
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
  font-size: 16px;
}

.sp-footer-buttons {
  display: flex;
  flex-direction: row;
  gap: 10px;
}

.sp-continue-shopping,
.sp-checkout-button {
  flex: 1;
  padding: 10px 12px !important;
  cursor: pointer;
  border-radius: 4px !important;
  text-transform: none !important;
  font-weight: 400 !important;
  font-size: 14px !important;
  font-family: inherit !important;
  font-style: normal !important;
  letter-spacing: normal !important;
  line-height: 1.4 !important;
  text-align: center !important;
  text-decoration: none !important;
}

.sp-continue-shopping {
  background: #fff !important;
  border: 1px solid var(--sp-primary, #002868) !important;
  color: var(--sp-primary, #002868) !important;
  order: 1;
}

.sp-continue-shopping:hover {
  background: var(--sp-primary, #002868) !important;
  color: #fff !important;
}

.sp-checkout-button {
  background: var(--sp-primary, #002868) !important;
  border: none !important;
  color: #fff !important;
  order: 2;
}

.sp-checkout-button:hover {
  background: #001a4a !important;
}

/* FBT Carousel */
.sp-fbt-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #eee;
}

.sp-fbt-section h4 {
  font-size: 14px !important;
  font-weight: 600 !important;
  color: #000 !important;
  margin: 0 0 12px 0 !important;
  padding: 0 !important;
}

.sp-fbt-carousel {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sp-fbt-nav {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border: 1px solid #e5e5e5 !important;
  background: #f7f7f7 !important;
  color: #000 !important;
  cursor: pointer;
  border-radius: 0 !important;
  font-size: 18px;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0;
}

.sp-fbt-nav:hover {
  background: #eee !important;
}

.sp-fbt-track {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.sp-fbt-slider {
  display: flex;
  transition: transform 0.4s ease;
}

.sp-fbt-product {
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.sp-fbt-product img {
  width: 60px !important;
  height: 60px !important;
  object-fit: cover;
  flex-shrink: 0;
}

.sp-fbt-info {
  flex: 1;
  min-width: 0;
}

.sp-fbt-info h5 {
  font-size: 13px !important;
  font-weight: 400 !important;
  color: #000 !important;
  margin: 0 0 4px 0 !important;
  padding: 0 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sp-fbt-price {
  font-size: 13px !important;
  color: #000 !important;
}

.sp-fbt-add-to-cart {
  padding: 7px 20px !important;
  background: var(--sp-primary, #002868) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 4px !important;
  cursor: pointer;
  font-size: 12px !important;
  font-weight: 600 !important;
  white-space: nowrap;
}

.sp-fbt-add-to-cart:hover {
  background: #001a4a !important;
}

/* Scroll lock */
body.sp-cart-open {
  overflow: hidden;
}

/* Loading */
.sp-cart-loading-init {
  text-align: center;
  padding: 40px;
  color: #999;
}

/* Add to Cart Button States */
.add_to_cart_button.loading,
.ajax_add_to_cart.loading,
button[type="submit"].loading {
  opacity: 0.6;
  pointer-events: none;
}

.add_to_cart_button.added,
.ajax_add_to_cart.added,
button[type="submit"].added {
  background-color: #22c55e !important;
  border-color: #22c55e !important;
  color: #fff !important;
}

.add_to_cart_button.added::after,
.ajax_add_to_cart.added::after {
  content: " ✓";
}

/* Fly to Cart Animation */
#sp-fly-to-cart {
  position: fixed !important;
  width: 120px !important;
  height: 120px !important;
  background-size: cover !important;
  background-position: center !important;
  background-color: #fff !important;
  border-radius: 8px !important;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4) !important;
  z-index: 9999999 !important;
  pointer-events: none !important;
  opacity: 0;
  transform: scale(1);
  display: block !important;
  visibility: visible !important;
}

#sp-fly-to-cart.sp-flying {
  transition: left 1.6s cubic-bezier(0.2, 1, 0.3, 1),
              top 1.6s cubic-bezier(0.2, 1, 0.3, 1),
              transform 1.6s cubic-bezier(0.2, 1, 0.3, 1),
              opacity 1.6s ease !important;
}

/* Cart icon pulse when item lands */
.sp-cart-pulse {
  animation: sp-cart-pulse 0.4s ease;
}

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