/* styles/cart.css — Shared shopping cart styles for all pages */

/* =========================================================
   Shopping Cart Button (Header)
   ========================================================= */
.cart-btn {
  position: relative;
  padding: 8px 12px !important;
  transition: transform 0.3s ease, background-color 0.15s ease;
}
.cart-btn svg {
  transition: transform 0.3s ease;
}
.cart-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #e74c3c;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

@keyframes cartPulse {
  0% { transform: scale(1); }
  30% { transform: scale(1.35); }
  60% { transform: scale(1.1); }
  100% { transform: scale(1); }
}
.cart-btn.cart-pulse {
  animation: cartPulse 0.6s ease;
}
.cart-btn.cart-pulse svg {
  stroke: #f39c12;
}

/* =========================================================
   Heart (Wishlist) Button on Product Cards
   ========================================================= */
.product-heart-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(4px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.product-heart-btn:hover {
  transform: scale(1.15);
  box-shadow: 0 3px 12px rgba(0,0,0,0.18);
  background: #fff;
}
.product-heart-btn svg {
  width: 18px;
  height: 18px;
  stroke: #999;
  fill: none;
  stroke-width: 2;
  transition: stroke 0.2s ease, fill 0.3s ease, transform 0.3s ease;
}
.product-heart-btn.hearted svg {
  stroke: #e91e63;
  fill: #e91e63;
}

@keyframes heartPop {
  0% { transform: scale(1); }
  30% { transform: scale(1.4); }
  60% { transform: scale(0.9); }
  100% { transform: scale(1); }
}
.product-heart-btn.heart-pop svg {
  animation: heartPop 0.4s ease;
}

/* =========================================================
   Shopping Cart Modal
   ========================================================= */
.cart-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 10010;
  transition: opacity 0.25s ease;
  opacity: 0;
}
.cart-overlay.open {
  display: block;
  opacity: 1;
}

.cart-modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  z-index: 10011;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  width: 90%;
  max-width: 560px;
  max-height: 80vh;
  flex-direction: column;
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  overflow: hidden;
}
.cart-modal.open {
  display: flex;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.cart-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid #eee;
  background: #f9faf9;
  border-radius: 16px 16px 0 0;
}
.cart-modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #2c2c2c;
  display: flex;
  align-items: center;
  gap: 10px;
}
.cart-modal-title svg {
  stroke: #072908;
}
.cart-modal-count {
  background: #072908;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}
.cart-modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: #999;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s ease, color 0.15s ease;
}
.cart-modal-close:hover {
  background: #f0f0f0;
  color: #333;
}

.cart-modal-body {
  overflow-y: auto;
  padding: 16px 24px 24px;
  flex: 1;
}

.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 0;
  color: #999;
}
.cart-empty p {
  margin: 8px 0 0;
  font-size: 16px;
  font-weight: 600;
  color: #666;
}
.cart-empty span {
  font-size: 13px;
  color: #aaa;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid #f0f0f0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.cart-item:last-child {
  border-bottom: none;
}

@keyframes cartItemRemove {
  to {
    opacity: 0;
    transform: translateX(30px);
    max-height: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
  }
}
.cart-item.removing {
  animation: cartItemRemove 0.3s ease forwards;
}

.cart-item-image {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 4px;
  flex-shrink: 0;
  background: #fff;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
}
.cart-item-title {
  font-size: 13px;
  font-weight: 600;
  color: #2c2c2c;
  margin: 0 0 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cart-item-title a {
  color: inherit;
  text-decoration: none;
}
.cart-item-title a:hover {
  text-decoration: underline;
  color: #072908;
}
.cart-item-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #888;
}
.cart-item-price {
  font-weight: 700;
  color: #111;
  font-size: 14px;
}
.cart-item-score {
  background: #072908;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}

.cart-item-remove {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  color: #ccc;
  transition: color 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
}
.cart-item-remove:hover {
  color: #e74c3c;
  background: #fef0f0;
}
.cart-item-remove svg {
  width: 18px;
  height: 18px;
}

/* --- Mobile (max 640px) --- */
@media (max-width: 640px) {
  .cart-btn { min-height: 44px; display: flex; align-items: center; }
  .cart-modal { width: calc(100vw - 20px); }
}
