:root {
  /* --wps-cart-brand-50: #fffbeb;
  --wps-cart-brand-100: #fef3c7;
  --wps-cart-brand-200: #fde68a;
  --wps-cart-brand-300: #fcd34d;
  --wps-cart-brand-400: #fbbf24;
  --wps-cart-brand-500: #f59e0b;
  --wps-cart-brand-600: #d97706;
  --wps-cart-brand-700: #b45309;
  --wps-cart-brand-800: #92400e;
  --wps-cart-brand-900: #78350f;
  --wps-cart-brand-950: #451a03; */
}

/* ========================================
   Floating Cart Button
   ======================================== */
.cart-floating-button {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--wps-cart-brand-600), var(--wps-cart-brand-500));
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-floating-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2), 0 3px 6px rgba(0, 0, 0, 0.15);
  background: linear-gradient(135deg, var(--wps-cart-brand-700), var(--wps-cart-brand-600));
}

.cart-floating-button:active {
  transform: translateY(0);
}

.cart-floating-button .cart-icon {
  width: 28px;
  height: 28px;
}

.cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: white;
  font-size: 12px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Animations */
@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.2);
  }
}

@keyframes bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  25% {
    transform: translateY(-10px);
  }

  50% {
    transform: translateY(-5px);
  }

  75% {
    transform: translateY(-7px);
  }
}

.cart-badge.pulse {
  animation: pulse 0.6s ease-in-out;
}

.cart-floating-button.bounce {
  animation: bounce 0.6s ease-in-out;
}

/* ========================================
   Cart Sidebar
   ======================================== */
.cart-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  pointer-events: none;
}

.cart-sidebar.is-open {
  pointer-events: auto;
}

/* Overlay */
.cart-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
  backdrop-filter: blur(2px);
}

.cart-sidebar.is-open .cart-overlay {
  opacity: 1;
}

/* Panel */
.cart-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 400px;
  height: 100%;
  background: white;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-sidebar.is-open .cart-panel {
  transform: translateX(0);
}

/* Header */
.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  background: white;
  position: sticky;
  top: 0;
  z-index: 10;
}

.cart-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
}

.cart-close {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 0.5rem;
  margin: -0.5rem;
  border-radius: 0.5rem;
  transition: all 0.2s;
}

.cart-close:hover {
  background: #f3f4f6;
  color: #111827;
}

/* Content */
.cart-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

/* Cart Items */
.cart-items {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cart-item {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: #f9fafb;
  border-radius: 0.5rem;
  position: relative;
}

.cart-item-image {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: 0.375rem;
  overflow: hidden;
  background: white;
}

.cart-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item-placeholder {
  width: 100%;
  height: 100%;
  background: #e5e7eb;
}

.cart-item-details {
  flex: 1;
  min-width: 0;
}

.cart-item-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #111827;
  margin: 0 0 0.5rem 0;
  line-height: 1.4;
}

.cart-item-name a {
  color: inherit;
  text-decoration: none;
}

.cart-item-name a:hover {
  color: var(--wps-cart-brand-600);
}

.cart-item-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.875rem;
}

.cart-item-quantity {
  color: #6b7280;
}

.cart-item-price {
  color: var(--wps-cart-brand-600);
  font-weight: 600;
}

.cart-item-remove {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: white;
  border: 1px solid #e5e7eb;
  color: #6b7280;
  cursor: pointer;
  padding: 0.375rem;
  border-radius: 0.375rem;
  transition: all 0.2s;
}

.cart-item-remove:hover {
  background: #fee2e2;
  border-color: #fecaca;
  color: #dc2626;
}

/* Highlight animation for newly added items */
@keyframes highlightFade {
  0% {
    background: #fef3c7;
    transform: scale(1.02);
  }

  50% {
    background: #fef3c7;
  }

  100% {
    background: #f9fafb;
    transform: scale(1);
  }
}

.cart-item-highlight {
  animation: highlightFade 2s ease-in-out;
  position: relative;
}

.cart-item-highlight::before {
  content: '';
  position: absolute;
  top: 0;
  left: -4px;
  width: 4px;
  height: 100%;
  background: var(--wps-cart-brand-500);
  border-radius: 2px;
  animation: fadeOut 2s ease-in-out forwards;
}

@keyframes fadeOut {
  0% {
    opacity: 1;
  }

  70% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

/* Hide WooCommerce 'View Cart' link that appears after AJAX add to cart */
a.added_to_cart {
  display: none !important;
}

/* Footer */
.cart-footer {
  border-top: 1px solid #e5e7eb;
  padding: 1.5rem;
  background: white;
  position: sticky;
  bottom: 0;
}

.cart-subtotal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 1.125rem;
  font-weight: 700;
}

.cart-subtotal-label {
  color: #111827;
}

.cart-subtotal-amount {
  color: var(--wps-cart-brand-600);
}

.cart-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 0.5rem;
  text-decoration: none;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
  text-align: center;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--wps-cart-brand-600), var(--wps-cart-brand-500));
  color: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--wps-cart-brand-700), var(--wps-cart-brand-600));
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

.btn-secondary {
  background: white;
  color: #374151;
  border: 1px solid #d1d5db;
}

.btn-secondary:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

/* Empty State */
.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
  min-height: 300px;
}

.cart-empty-icon {
  width: 64px;
  height: 64px;
  color: #d1d5db;
  margin-bottom: 1rem;
}

.cart-empty-text {
  font-size: 1rem;
  color: #6b7280;
  margin: 0 0 1.5rem 0;
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 767px) {
  .cart-panel {
    max-width: 100%;
  }

  .cart-floating-button {
    bottom: 1.5rem;
    right: 1.5rem;
    width: 56px;
    height: 56px;
  }

  .cart-floating-button .cart-icon {
    width: 24px;
    height: 24px;
  }
}

@media (max-width: 480px) {

  .cart-header,
  .cart-content,
  .cart-footer {
    padding: 1rem;
  }

  .cart-item {
    padding: 0.75rem;
  }

  .cart-item-image {
    width: 60px;
    height: 60px;
  }
}

/* ========================================
   Admin bar adjustment
   ======================================== */
body.admin-bar .cart-panel {
  top: 32px; /* default WP admin bar height on desktop */
  height: calc(100% - 32px);
}

@media (max-width: 782px) {
  /* taller admin bar on small screens */
  body.admin-bar .cart-panel {
    top: 46px;
    height: calc(100% - 46px);
  }
}

/* ========================================
   Cart Modal
   ======================================== */
.cart-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.cart-modal.is-open {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}

.cart-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.cart-modal-panel {
  position: relative;
  width: 90%;
  max-width: 450px;
  background: white;
  border-radius: 1rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-modal.is-open .cart-modal-panel {
  transform: scale(1);
}

.cart-modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cart-modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
}

.cart-modal-close {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.375rem;
  transition: all 0.2s;
}

.cart-modal-close:hover {
  background: #f9fafb;
  color: #111827;
}

.cart-modal-body {
  padding: 1.5rem;
  color: #4b5563;
  font-size: 1rem;
  line-height: 1.5;
}

.cart-modal-footer {
  padding: 1.25rem 1.5rem;
  background: #f9fafb;
}

@media (max-width: 480px) {
  .cart-modal-panel {
    width: 95%;
  }
}