/* Cart Sidebar Styles */
.cart-sidebar {
  position: fixed;
  top: 0;
  right: -400px;
  width: 380px;
  max-width: 90vw;
  height: 100vh;
  background-color: #fff;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  overflow-y: auto;
  overflow-x: hidden;
  transition: right 0.3s ease;
  box-sizing: border-box;
}

.cart-sidebar.open {
  right: 0;
}

.cart-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.cart-overlay.show {
  display: block;
  opacity: 1;
}

body.cart-open {
  overflow: hidden;
}

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #eee;
}

.cart-header h2 {
  margin: 0;
  font-size: 20px;
}

.close-cart {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #666;
}

.cart-items {
  padding: 20px;
  box-sizing: border-box;
  /* max-height: calc(100vh - 250px); */
  /* overflow-y: auto; */
}

.cart-item {
  display: flex;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #eee;
}

.cart-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.cart-item-image {
  width: 80px;
  height: 80px;
  margin-right: 15px;
}

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

.cart-item-details {
  flex: 1;
}

.cart-item-title {
  margin: 0 0 5px 0;
  font-size: 16px;
  font-weight: 500;
}

.cart-item-price {
  margin-bottom: 10px;
  font-weight: 600;
  color: var(--primary-color, #4a90e2);
}

.sale-price {
  color: #e74c3c;
  margin-right: 5px;
}

.original-price {
  text-decoration: line-through;
  color: #999;
  font-size: 14px;
}

.cart-item-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.cart-quantity {
  display: flex;
  align-items: center;
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
}

.quantity-decrease,
.quantity-increase {
  width: 32px;
  height: 32px;
  background: #f5f5f5;
  border: none;
  cursor: pointer;
  font-size: 16px;
}

.quantity-decrease:hover,
.quantity-increase:hover {
  background: #e0e0e0;
}

.cart-quantity input {
  width: 40px;
  height: 32px;
  text-align: center;
  border: none;
  border-left: 1px solid #ddd;
  border-right: 1px solid #ddd;
}

.remove-item {
  background: none;
  border: none;
  color: #e74c3c;
  cursor: pointer;
  font-size: 14px;
}

.cart-summary {
  padding: 20px;
  background-color: #f9f9f9;
  border-top: 1px solid #eee;
  border-bottom: 1px solid #eee;
  box-sizing: border-box;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

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

.summary-row.total {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #ddd;
  font-weight: 600;
  font-size: 18px;
}

.cart-actions {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-sizing: border-box;
}

.btn-view-cart,
.btn-checkout {
  display: block;
  padding: 12px;
  text-align: center;
  border-radius: 4px;
  text-decoration: none;
  transition: background-color 0.2s;
  font-weight: 500;
}

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

.btn-view-cart:hover {
  background-color: #e0e0e0;
}

.btn-checkout {
  background-color: #e44040;
  color: white;
  border: none;
}

.btn-checkout:hover {
  background-color: #e44040;
}

.cart-empty {
  text-align: center;
  padding: 30px 20px;
}

.empty-cart-icon {
  font-size: 40px;
  color: #ccc;
  margin-bottom: 15px;
}

.cart-empty p {
  margin-bottom: 20px;
  color: #666;
}

.btn-primary {
  display: inline-block;
  padding: 10px 20px;
  background-color: #e44040;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.btn-primary:hover {
  background-color: #c9302c;
}

.cart-loading {
  text-align: center;
  padding: 30px 0;
}

.spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top-color: #e44040;
  animation: spin 1s ease-in-out infinite;
  margin-bottom: 15px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Animation for cart link */
.cart-bounce {
  animation: bounce 0.5s ease;
}

@keyframes bounce {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
}

/* Responsive styles */
@media (max-width: 480px) {
  .cart-sidebar {
    width: 100%;
    right: -100%;
  }

  .cart-item {
    flex-direction: column;
  }

  .cart-item-image {
    margin-bottom: 10px;
    margin-right: 0;
  }
}

/* Badge notification for cart icon */
.cart-added-notification {
  position: absolute;
  top: -5px;
  right: -5px;
  background-color: var(--accent-color, #ff4500);
  color: white;
  font-size: 12px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse 1s infinite;
}

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

/* Cart backdrop */
.cart-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
}

.cart-backdrop.show {
  display: block;
}

/* Animation for cart items */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cart-sidebar-item {
  animation: fadeIn 0.3s ease-out;
}

/* Sale price styling */
.sale-price {
  color: #e74c3c;
  font-weight: bold;
  margin-right: 5px;
}

.original-price {
  text-decoration: line-through;
  color: #7f8c8d;
  font-size: 0.9em;
}

/* Cart Loading State */
.cart-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  color: #666;
  text-align: center;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top-color: var(--primary-color, #e44040);
  animation: spin 1s ease-in-out infinite;
  margin: 15px auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
