/**
 * ECOMOM HONEY - CART DRAWER STYLES
 * Beautiful sliding cart panel with smooth animations
 */

/* ===================================
   CART DRAWER OVERLAY
   =================================== */
.cart-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 9998;
}

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

/* ===================================
   CART DRAWER
   =================================== */
.cart-drawer {
  position: fixed;
  top: 0;
  right: -450px;
  width: 450px;
  height: 100vh;
  background: linear-gradient(135deg, #fef9e7 0%, #f5f0e1 100%);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

/* Minimized state */
.cart-drawer.minimized {
  right: -400px;
  width: 50px;
}

.cart-drawer.minimized .cart-drawer-body,
.cart-drawer.minimized .cart-drawer-footer,
.cart-drawer.minimized .cart-drawer-title h3,
.cart-drawer.minimized .cart-drawer-actions .cart-close-btn {
  display: none;
}

/* ===================================
   DRAWER HEADER
   =================================== */
.cart-drawer-header {
  background: linear-gradient(135deg, #d4a574 0%, #b8860b 100%);
  color: white;
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.cart-drawer-header.item-added {
  animation: headerPulse 0.6s ease;
}

@keyframes headerPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); background: linear-gradient(135deg, #e5b685 0%, #c99a1c 100%); }
}

.cart-drawer-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cart-icon {
  font-size: 1.5rem;
  animation: cartBounce 0.5s ease;
}

@keyframes cartBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.cart-drawer-title h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  font-family: 'Playfair Display', serif;
}

.cart-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  background: white;
  color: #b8860b;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  animation: badgePop 0.3s ease;
}

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

.cart-drawer-actions {
  display: flex;
  gap: 0.5rem;
}

.cart-drawer-actions button {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.cart-drawer-actions button:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.cart-drawer-actions button:active {
  transform: scale(0.95);
}

/* ===================================
   DRAWER BODY (SCROLLABLE ITEMS)
   =================================== */
.cart-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

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

.cart-drawer-body::-webkit-scrollbar-track {
  background: rgba(212, 165, 116, 0.1);
}

.cart-drawer-body::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, #d4a574, #b8860b);
  border-radius: 4px;
}

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

/* Empty state */
.cart-empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #8b6914;
}

.empty-cart-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.cart-empty-state p {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0.5rem 0;
}

.cart-empty-state small {
  font-size: 0.875rem;
  opacity: 0.7;
}

/* ===================================
   CART ITEM
   =================================== */
.cart-drawer-item {
  display: flex;
  gap: 1rem;
  background: white;
  border-radius: 12px;
  padding: 0.75rem;
  box-shadow: 0 2px 8px rgba(212, 165, 116, 0.1);
  transition: all 0.2s ease;
  animation: itemSlideIn 0.3s ease;
}

@keyframes itemSlideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.cart-drawer-item:hover {
  box-shadow: 0 4px 12px rgba(212, 165, 116, 0.2);
  transform: translateY(-2px);
}

.cart-item-image {
  width: 70px;
  height: 70px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #f5f0e1;
}

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

.cart-item-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.25rem;
}

.cart-item-details h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
  line-height: 1.3;
}

.cart-item-price {
  font-size: 0.875rem;
  color: #8b6914;
  margin: 0;
}

.cart-item-total {
  display: flex;
  align-items: center;
  font-size: 1rem;
  font-weight: 700;
  color: #b8860b;
}

/* ===================================
   DRAWER FOOTER
   =================================== */
.cart-drawer-footer {
  border-top: 2px solid rgba(212, 165, 116, 0.2);
  padding: 1.5rem;
  background: white;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

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

.cart-subtotal-amount {
  font-size: 1.5rem;
  font-weight: 700;
  color: #b8860b;
}

.cart-view-btn,
.cart-continue-btn {
  width: 100%;
  padding: 0.875rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 0.5rem;
}

.cart-view-btn {
  background: linear-gradient(135deg, #d4a574 0%, #b8860b 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(212, 165, 116, 0.3);
}

.cart-view-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(212, 165, 116, 0.4);
}

.cart-continue-btn {
  background: white;
  color: #b8860b;
  border: 2px solid #d4a574;
}

.cart-continue-btn:hover {
  background: #fef9e7;
  transform: translateY(-2px);
}

/* ===================================
   RESPONSIVE
   =================================== */
@media (max-width: 768px) {
  .cart-drawer {
    width: 100%;
    right: -100%;
  }
  
  .cart-drawer.minimized {
    right: calc(-100% + 50px);
  }
}

@media (max-width: 480px) {
  .cart-drawer-header {
    padding: 1rem;
  }
  
  .cart-drawer-title h3 {
    font-size: 1.125rem;
  }
  
  .cart-drawer-footer {
    padding: 1rem;
  }
  
  .cart-item-image {
    width: 60px;
    height: 60px;
  }
}

/* ===================================
   DRAWER BODY & ITEMS
   =================================== */
.cart-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: #fef9e7;
}

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

.cart-drawer-item {
  display: flex;
  gap: 0.75rem;
  background: white;
  border-radius: 12px;
  padding: 0.75rem;
  box-shadow: 0 2px 8px rgba(212, 165, 116, 0.1);
  transition: all 0.2s ease;
  animation: itemSlideIn 0.3s ease;
}

@keyframes itemSlideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.cart-drawer-item:hover {
  box-shadow: 0 4px 12px rgba(212, 165, 116, 0.2);
  transform: translateY(-1px);
}

.item-image-wrapper {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(135deg, #f5f0e1, #fef9e7);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.item-image-fallback {
  font-size: 2rem;
  text-align: center;
}

.item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.item-name {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #2d5016;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-price {
  font-size: 0.85rem;
  color: #b8860b;
  font-weight: 600;
}

.item-qty-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.qty-btn {
  width: 24px;
  height: 24px;
  border: 1px solid #d4a574;
  background: white;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: #b8860b;
  transition: all 0.2s ease;
}

.qty-btn:hover {
  background: #d4a574;
  color: white;
  transform: scale(1.1);
}

.qty-display {
  font-size: 0.9rem;
  font-weight: 600;
  color: #333;
  min-width: 20px;
  text-align: center;
}

.item-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem;
}

.item-total {
  font-size: 1rem;
  font-weight: 700;
  color: #b8860b;
}

.item-remove-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: #e74c3c;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
}

.item-remove-btn:hover {
  background: #fee;
  transform: scale(1.1) rotate(90deg);
}

/* ===================================
   DRAWER FOOTER
   =================================== */
.cart-drawer-footer {
  border-top: 2px solid rgba(212, 165, 116, 0.2);
  padding: 1.25rem;
  background: white;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

.cart-drawer-totals {
  margin-bottom: 1rem;
}

.cart-subtotal-row,
.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}

.cart-subtotal-row {
  font-size: 0.95rem;
  color: #666;
  border-bottom: 1px solid #f0f0f0;
}

.cart-total-row {
  font-size: 1.125rem;
  font-weight: 700;
  color: #2d5016;
}

.cart-total-row span:last-child {
  color: #b8860b;
  font-size: 1.375rem;
}

.cart-checkout-btn,
.cart-view-full-btn {
  width: 100%;
  padding: 0.875rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 0.5rem;
}

.cart-checkout-btn {
  background: linear-gradient(135deg, #2d5016, #4a7c59);
  color: white;
  box-shadow: 0 4px 12px rgba(45, 80, 22, 0.3);
}

.cart-checkout-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(45, 80, 22, 0.4);
}

.cart-view-full-btn {
  background: white;
  color: #b8860b;
  border: 2px solid #d4a574;
}

.cart-view-full-btn:hover {
  background: #fef9e7;
  transform: translateY(-2px);
}

/* ===================================
   EMPTY STATE
   =================================== */
.cart-drawer-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
  height: 100%;
}

.cart-drawer-empty .empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.cart-drawer-empty h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  color: #2d5016;
  margin: 0 0 0.5rem 0;
}

.cart-drawer-empty p {
  color: #666;
  margin: 0 0 1.5rem 0;
  font-size: 0.95rem;
}

.continue-shopping-btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  background: linear-gradient(135deg, #d4a574, #b8860b);
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(212, 165, 116, 0.3);
}

.continue-shopping-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(212, 165, 116, 0.4);
}

/* ===================================
   LOADING STATE
   =================================== */
.cart-drawer-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
  height: 100%;
}

.loading-spinner {
  font-size: 3rem;
  animation: spin 2s linear infinite;
}

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

.cart-drawer-loading p {
  margin-top: 1rem;
  color: #666;
  font-size: 0.95rem;
}

/* ===================================
   ANIMATIONS & TRANSITIONS
   =================================== */
@keyframes slideInRight {
  from {
    right: -450px;
  }
  to {
    right: 0;
  }
}

@keyframes slideOutRight {
  from {
    right: 0;
  }
  to {
    right: -450px;
  }
}
