/* Cart Manager Styles */
:root {
  --cart-z-index: 1000;
  --cart-sidebar-width: 380px;
  --cart-overlay-bg: rgba(0, 0, 0, 0.6);
  --cart-border-radius: 12px;
  --cart-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  --cart-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Cart Icon and Count Badge */
.cart-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--cart-transition);
}

.cart-icon:hover {
  transform: translateY(-1px);
}

.cart-icon.bounce {
  animation: cartBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes cartBounce {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.2) translateY(-4px); }
}

.cart-count {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 20px;
  height: 20px;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--brand, #e11d48);
  color: white;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  padding: 2px 4px;
  box-shadow: 0 2px 8px rgba(var(--brand-rgb, 225, 29, 72), 0.4);
  animation: fadeInScale 0.3s ease-out;
}

.cart-count.visible {
  display: flex;
}

@keyframes fadeInScale {
  0% { opacity: 0; transform: scale(0.5); }
  100% { opacity: 1; transform: scale(1); }
}

/* Cart Overlay */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: var(--cart-overlay-bg);
  backdrop-filter: blur(4px);
  z-index: var(--cart-z-index);
  opacity: 0;
  visibility: hidden;
  transition: var(--cart-transition);
}

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

/* Cart Sidebar */
.cart-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--cart-sidebar-width);
  height: 100vh;
  background: white;
  box-shadow: var(--cart-shadow);
  z-index: calc(var(--cart-z-index) + 1);
  transform: translateX(100%);
  transition: var(--cart-transition);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

/* Cart Header */
.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: white;
}

.cart-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text, #1f2937);
}

.cart-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted, #6b7280);
  transition: var(--cart-transition);
}

.cart-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text, #1f2937);
}

/* Cart Items Container */
.cart-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* Empty Cart State */
.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  height: 100%;
}

.cart-empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.cart-empty h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text, #1f2937);
}

.cart-empty p {
  margin: 0;
  color: var(--muted, #6b7280);
  font-size: 0.9rem;
}

/* Cart Items List */
.cart-items-list {
  padding: 8px 0;
}

.cart-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  transition: var(--cart-transition);
}

.cart-item:hover {
  background: rgba(0, 0, 0, 0.02);
}

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

/* Item Image */
.item-image {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
}

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

/* Item Details */
.item-details {
  flex: 1;
  min-width: 0;
}

.item-name {
  margin: 0 0 4px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text, #1f2937);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.item-variant {
  margin: 0 0 4px;
  font-size: 0.8rem;
  color: var(--muted, #6b7280);
  font-weight: 500;
}

.item-complements {
  margin: 0 0 6px;
  font-size: 0.75rem;
  color: var(--brand, #e11d48);
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.complement-list {
  font-style: italic;
  flex: 1;
}

.complement-price {
  font-weight: 600;
  color: var(--brand, #e11d48);
  font-size: 0.8rem;
}

.item-price {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--brand, #e11d48);
}

.total-with-complements {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--success, #059669);
  margin-top: 2px;
}

/* Item Controls */
.item-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* Quantity Controls */
.quantity-controls {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 6px;
  overflow: hidden;
}

.qty-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: white;
  color: var(--text, #1f2937);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--cart-transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qty-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.qty-btn:active {
  background: rgba(0, 0, 0, 0.1);
}

.qty-display {
  min-width: 32px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text, #1f2937);
  background: rgba(0, 0, 0, 0.02);
  border-left: 1px solid rgba(0, 0, 0, 0.08);
  border-right: 1px solid rgba(0, 0, 0, 0.08);
}

/* Remove Button */
.remove-btn {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--muted, #6b7280);
  cursor: pointer;
  transition: var(--cart-transition);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.remove-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* Cart Footer */
.cart-footer {
  background: white;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding: 20px 24px 24px;
}

.cart-total-section {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.cart-total-label {
  font-size: 0.9rem;
  color: var(--muted, #6b7280);
  margin-bottom: 4px;
}

.cart-total {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text, #1f2937);
  margin: 0;
}

.checkout-btn {
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--brand, #e11d48), var(--accent-2, #be185d));
  color: white;
  border: none;
  border-radius: var(--cart-border-radius);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--cart-transition);
  box-shadow: 0 4px 12px rgba(var(--brand-rgb, 225, 29, 72), 0.3);
}

.checkout-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(var(--brand-rgb, 225, 29, 72), 0.4);
}

.checkout-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  :root {
    --cart-sidebar-width: 100vw;
  }
  
  .cart-sidebar {
    width: 100vw;
    border-radius: 0;
  }
  
  .cart-item {
    padding: 12px 16px;
  }
  
  .cart-header {
    padding: 16px 20px 12px;
  }
  
  .cart-footer {
    padding: 16px 20px 20px;
  }
  
  .item-image {
    width: 50px;
    height: 50px;
  }
  
  .item-name {
    font-size: 0.85rem;
  }

  .item-complements {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .total-with-complements {
    font-size: 0.75rem;
  }
}

/* Custom Scrollbar for Cart */
.cart-content::-webkit-scrollbar {
  width: 4px;
}

.cart-content::-webkit-scrollbar-track {
  background: transparent;
}

.cart-content::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 2px;
}

.cart-content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* Loading States */
.cart-item.loading {
  opacity: 0.6;
  pointer-events: none;
}

.cart-item.removing {
  animation: slideOut 0.3s ease-in-out forwards;
}

@keyframes slideOut {
  0% { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(100%); }
}

/* Success animations */
.cart-item.added {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  0% { opacity: 0; transform: translateX(-20px); }
  100% { opacity: 1; transform: translateX(0); }
}