/* Cart Drawer Styles */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: none;
  z-index: 60;
  transition: opacity 0.3s ease;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(420px, 100vw);
  background: var(--panel-2);
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.35);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 70;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.drawer.open {
  transform: translateX(0);
}

.drawer.open ~ .drawer-backdrop {
  display: block;
}

.drawer-header {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  min-height: 70px;
}

.drawer-header strong {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--muted) transparent;
}

.drawer-body::-webkit-scrollbar {
  width: 6px;
}

.drawer-body::-webkit-scrollbar-track {
  background: transparent;
}

.drawer-body::-webkit-scrollbar-thumb {
  background-color: var(--muted);
  border-radius: 3px;
}

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

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

.cart-empty h3 {
  margin: 0 0 8px 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.cart-empty .muted {
  font-size: 14px;
  line-height: 1.5;
}

/* Cart Items */
.cart-item {
  display: flex;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  transition: background-color 0.2s ease;
}

.cart-item:hover {
  background: var(--panel-2);
}

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

.cart-item-image {
  position: relative;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}

.cart-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.cart-discount-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 8px;
  line-height: 1;
}

.cart-item-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cart-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.cart-item-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  flex: 1;
}

.btn-remove {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-remove:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

.btn-remove span {
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
}

.cart-item-variant {
  font-size: 12px;
  color: var(--brand);
  font-weight: 500;
  background: rgba(110, 231, 183, 0.1);
  padding: 4px 8px;
  border-radius: 6px;
  display: inline-block;
  width: fit-content;
}

.cart-item-category {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.cart-item-price {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.cart-item-price .original-price {
  text-decoration: line-through;
  color: var(--muted);
  font-size: 12px;
}

.cart-item-price .current-price {
  color: var(--text);
  font-weight: 500;
}

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

.qty-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
}

.qty-btn {
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  transition: all 0.2s ease;
}

.qty-btn:hover {
  background: var(--brand);
  color: var(--bg);
}

.qty-btn:active {
  transform: scale(0.95);
}

.qty-display {
  min-width: 40px;
  text-align: center;
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
}

.item-total {
  font-size: 16px;
  font-weight: 700;
  color: var(--brand);
}

/* Enhanced Cart Styles */
.cart-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  min-height: 300px;
}

.empty-icon {
  font-size: 48px;
  opacity: 0.6;
  margin-bottom: 16px;
}

.cart-empty-state h3 {
  margin: 0 0 8px 0;
  font-size: 18px;
  color: var(--text);
}

.cart-empty-state .muted {
  margin-bottom: 20px;
  line-height: 1.5;
}

.cart-header-info {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.cart-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-item-count {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}

.cart-total-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--brand);
}

.cart-items-container {
  flex: 1;
  overflow-y: auto;
}

/* Enhanced Cart Item */
.cart-item.enhanced {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: background-color 0.2s ease;
}

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

.item-image {
  position: relative;
  width: 60px;
  height: 60px;
  flex-shrink: 0;
}

.item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.item-discount-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: white;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
}

.item-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.item-name {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  flex: 1;
}

.item-remove {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.item-remove:hover {
  background: var(--danger);
  color: white;
}

.item-variant {
  font-size: 11px;
  color: var(--brand);
  font-weight: 500;
  background: rgba(110, 231, 183, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  width: fit-content;
}

.item-category {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.item-price-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  margin: 2px 0;
}

.item-original-price {
  text-decoration: line-through;
  color: var(--muted);
}

.item-current-price {
  color: var(--text);
  font-weight: 600;
}

.item-unit-label {
  color: var(--muted);
  font-size: 10px;
}

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

.quantity-controls {
  display: flex;
  align-items: center;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.qty-btn {
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  min-width: 28px;
  height: 28px;
}

.qty-btn:not(:disabled):hover {
  background: var(--brand);
  color: var(--bg);
}

.qty-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.qty-btn.clicked {
  transform: scale(0.9);
}

.qty-number {
  padding: 0 8px;
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
  min-width: 20px;
  text-align: center;
}

.item-total {
  text-align: right;
}

.item-total-price {
  font-weight: 700;
  color: var(--text);
  font-size: 13px;
}

.item-savings {
  font-size: 10px;
  color: var(--ok);
  font-weight: 500;
}

.stock-warning {
  font-size: 10px;
  color: var(--danger);
  font-weight: 500;
  margin-top: 2px;
}

/* Enhanced Cart Footer */
.cart-footer-enhanced {
  padding: 20px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}

.cart-totals {
  margin-bottom: 16px;
}

.cart-savings {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 14px;
}

.cart-savings span:first-child {
  color: var(--muted);
}

.savings-amount {
  color: var(--ok);
  font-weight: 600;
}

.cart-subtotal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  padding: 8px 0;
}

.subtotal-amount {
  color: var(--brand);
  font-size: 18px;
}

.checkout-btn {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border: none;
  border-radius: 10px;
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s ease;
  margin-bottom: 12px;
}

.checkout-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(110, 231, 183, 0.4);
}

.checkout-btn:active {
  transform: translateY(0);
}

.checkout-icon {
  font-size: 18px;
}

.cart-secondary-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.btn.small {
  padding: 8px 12px;
  font-size: 12px;
  border-radius: 6px;
}

.btn.danger:hover {
  background: var(--danger);
  color: white;
}

/* Responsive Design */
@media (max-width: 480px) {
  .drawer {
    width: 100vw;
  }
  
  .cart-item {
    padding: 16px;
    gap: 12px;
  }
  
  .cart-item-image {
    width: 60px;
    height: 60px;
  }
  
  .cart-item-title {
    font-size: 14px;
  }
  
  .qty-btn {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }
  
  .qty-display {
    min-width: 32px;
    font-size: 13px;
  }
  
  .cart-item.enhanced {
    padding: 12px 16px;
    gap: 10px;
  }
  
  .item-image {
    width: 50px;
    height: 50px;
  }
  
  .item-name {
    font-size: 13px;
  }
  
  .cart-footer-enhanced {
    padding: 16px;
  }
}

/* Animation for cart count */
.cart-count {
  transition: all 0.3s ease;
}

.cart-count.updated {
  animation: cartBounce 0.4s ease;
}

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

/* Cart Count Animation */
.cart-count.updated {
  animation: cartPulse 0.4s ease;
}

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