.xcodee-mini-cart-wrapper {
  position: relative;
  display: inline-block;
}

.xcodee-mini-cart-trigger:after {
  bottom: 100%;
  margin-bottom: 0;
  height: 0.8em;
  width: 0.8em;
  left: 50%;
  transform: translateX(-50%);
  top: -0.6em;
  content: " ";
  position: absolute;
  pointer-events: none;
  border-width: 2px;
  border-style: solid;
  border-top-left-radius: 10em;
  border-top-right-radius: 10em;
  border-bottom: 0;
}

.xcodee-mini-cart-trigger {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #0071bd;
  cursor: pointer;
  padding: 12px;
  border-color: #0071bd;
  transition: all 0.3s ease;
  border-width: 1px 1px 1px 1px;
  color: #0071bd;
  width: 20px;
  border-radius: 0em 0em 0.3em 0.3em;
  height: 20px;
  min-width: 20px;
}

.xcodee-mini-cart-trigger:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 113, 189, 0.3);
}

/* Sidebar Overlay */
.xcodee-cart-sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 9998;
  backdrop-filter: blur(4px);
}

.xcodee-mini-cart-wrapper.active .xcodee-cart-sidebar-overlay {
  opacity: 1;
  visibility: visible;
}

/* Sidebar */
.xcodee-cart-sidebar {
  position: fixed;
  top: 0;
  right: -450px;
  width: 450px;
  max-width: 90vw;
  height: 100vh;
  background: #fff;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.xcodee-mini-cart-wrapper.active .xcodee-cart-sidebar {
  right: 0;
}

.xcodee-cart-sidebar-left {
  right: auto;
  left: -450px;
}

.xcodee-mini-cart-wrapper.active .xcodee-cart-sidebar-left {
  left: 0;
}

/* Header */
.xcodee-cart-sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
}

.xcodee-cart-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.xcodee-cart-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #333;
}

.xcodee-cart-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 10px;
  background: #0071bd;
  color: #fff;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}

.xcodee-cart-header-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.xcodee-clear-all {
  color: #0071bd;
  text-decoration: underline;
  font-size: 14px;
  transition: color 0.2s ease;
}

.xcodee-clear-all:hover {
  color: #005a94;
  text-decoration: underline;
}

.xcodee-cart-close {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 5px;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.xcodee-cart-close:hover {
  color: #0071bd;
}

/* Cart Items */
.xcodee-cart-sidebar-items {
  flex: 1;
  overflow-y: auto;
  padding: 20px 25px;
}

.xcodee-cart-item {
  display: flex;
  gap: 15px;
  padding: 15px 0;
  border-bottom: 1px solid #f0f0f0;
}

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

.xcodee-cart-item-thumbnail {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #f5f5f5;
}

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

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

.xcodee-cart-item-title {
  margin: 0 0 8px 0;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
  color: #333;
}

.xcodee-cart-item-title a {
  color: #333;
  text-decoration: none;
}

.xcodee-cart-item-title a:hover {
  color: #0071bd;
}

.xcodee-cart-item-quantity-price {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  gap: 15px;
}

/* Quantity Selector */
.xcodee-quantity-selector {
  display: flex;
  align-items: center;
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
}

.xcodee-qty-minus,
.xcodee-qty-plus {
  width: 32px;
  height: 32px;
  background: #f5f5f5;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  color: #333;
  transition: background 0.2s ease;
}

.xcodee-qty-minus:hover,
.xcodee-qty-plus:hover {
  background: #e0e0e0;
}

.xcodee-qty-input {
  width: 50px;
  height: 32px;
  border: none;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  background: #fff;
  padding: 0;
  -moz-appearance: textfield;
}

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

.xcodee-cart-item-price {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
}

.xcodee-cart-item-remove {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 5px;
  color: #999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
  flex-shrink: 0;
  align-self: center;
  margin-top: 5px;
}

.xcodee-cart-item-remove:hover {
  color: #ff4444;
}

/* Empty Cart */
.xcodee-cart-empty {
  text-align: center;
  padding: 60px 20px;
}

.xcodee-cart-empty p {
  margin: 0 0 20px 0;
  color: #666;
  font-size: 16px;
}

.xcodee-shop-btn {
  display: inline-block;
  padding: 12px 24px;
  background: #0071bd;
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  transition: background 0.3s ease;
}

.xcodee-shop-btn:hover {
  background: #005a94;
  color: #fff;
  text-decoration: none;
}

/* Coupon Code */
.xcodee-cart-coupon {
  padding: 20px 25px;
  border-top: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.xcodee-coupon-input {
  flex: 1;
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
}

.xcodee-coupon-input:focus {
  outline: none;
  border-color: #0071bd;
}

.xcodee-coupon-apply {
  padding: 12px 24px;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  transition: all 0.2s ease;
}

.xcodee-coupon-apply:hover {
  background: #e0e0e0;
  border-color: #ccc;
}

/* Order Summary */
.xcodee-cart-summary {
  padding: 20px 25px;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
}

.xcodee-cart-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 15px;
  color: #666;
}

.xcodee-cart-summary-row:last-child {
  margin-bottom: 0;
}

.xcodee-cart-total {
  font-size: 18px;
  color: #333;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid #e0e0e0;
}

.xcodee-summary-value {
  font-weight: 600;
  color: #333;
}

.xcodee-cart-total .xcodee-summary-value {
  font-weight: 700;
  font-size: 20px;
}

/* Action Buttons */
.xcodee-cart-actions {
  padding: 20px 25px;
  display: flex;
  flex-direction: row;
  gap: 12px;
  flex-shrink: 0;
}

.xcodee-view-cart-btn,
.xcodee-checkout-btn {
  width: 100%;
  padding: 14px 24px;
  text-align: center;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 15px;
  transition: all 0.3s ease;
  display: block;
}

.xcodee-view-cart-btn {
  background: #fff;
  color: #333;
  border: 1px solid #ddd;
}

.xcodee-view-cart-btn:hover {
  background: #f5f5f5;
  border-color: #ccc;
  text-decoration: none;
  color: #333;
}

.xcodee-checkout-btn {
  background: #0071bd;
  color: #fff;
  border: 1px solid #0071bd;
}

.xcodee-checkout-btn:hover {
  background: #005a94;
  border-color: #005a94;
  text-decoration: none;
  color: #fff;
}

/* Scrollbar */
.xcodee-cart-sidebar-items::-webkit-scrollbar {
  width: 6px;
}

.xcodee-cart-sidebar-items::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.xcodee-cart-sidebar-items::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.xcodee-cart-sidebar-items::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* Responsive */
@media (max-width: 768px) {
  .xcodee-cart-sidebar {
    width: 100vw;
    max-width: 100vw;
    right: -100vw;
  }

  .xcodee-mini-cart-wrapper.active .xcodee-cart-sidebar {
    right: 0;
  }

  .xcodee-cart-sidebar-left {
    left: -100vw;
  }

  .xcodee-mini-cart-wrapper.active .xcodee-cart-sidebar-left {
    left: 0;
  }
}

/* Loading States */
.xcodee-cart-sidebar-loading::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.xcodee-cart-sidebar-loading::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 3px solid #f0f0f0;
  border-top-color: #0071bd;
  border-radius: 50%;
  animation: xcodee-spin 0.8s linear infinite;
  z-index: 101;
}

/* Loading state on cart item - shows spinner on thumbnail */
.xcodee-cart-item.loading {
  opacity: 0.7;
  pointer-events: none;
  position: relative;
}

.xcodee-cart-item.loading .xcodee-cart-item-thumbnail {
  position: relative;
  overflow: hidden;
}

.xcodee-cart-item.loading .xcodee-cart-item-thumbnail::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.xcodee-cart-item.loading .xcodee-cart-item-thumbnail::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  border: 3px solid rgba(0, 113, 189, 0.2);
  border-top-color: #0071bd;
  border-radius: 50%;
  animation: xcodee-spin 0.8s linear infinite;
  z-index: 11;
}

/* Loading state on remove button */
.xcodee-cart-item-remove.loading {
  opacity: 0.5;
  pointer-events: none;
  position: relative;
}

.xcodee-cart-item-remove.loading svg {
  opacity: 0;
}

.xcodee-cart-item-remove.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 68, 68, 0.2);
  border-top-color: #ff4444;
  border-radius: 50%;
  animation: xcodee-spin 0.6s linear infinite;
}

/* Loading state on cart item */
.xcodee-cart-item.loading {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

.xcodee-cart-item.removing {
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

/* Loading state on trigger */
.xcodee-mini-cart-trigger.loading {
  position: relative;
  color: transparent;
}

.xcodee-mini-cart-trigger.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: xcodee-spin 0.6s linear infinite;
}

/* Spinner animation */
@keyframes xcodee-spin {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Position relative for loading indicators */
.xcodee-quantity-selector {
  position: relative;
}

.xcodee-cart-item {
  transition: opacity 0.3s ease;
}

/* Loading state on coupon apply button */
.xcodee-coupon-apply.loading {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
  color: transparent;
}

.xcodee-coupon-apply.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border: 2px solid rgba(51, 51, 51, 0.2);
  border-top-color: #333;
  border-radius: 50%;
  animation: xcodee-spin 0.6s linear infinite;
}

/* Smooth transitions for loading states */
.xcodee-qty-minus,
.xcodee-qty-plus,
.xcodee-cart-item-remove,
.xcodee-coupon-apply {
  transition: opacity 0.2s ease;
}
