/* ========================================
   YAKSHARAT - Premium Cart System v3
   Image + Price Breakdown + Inline Selectors
   ======================================== */

/* ─── Overlay ─── */
.cart-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0); backdrop-filter: blur(0px);
  opacity: 0; visibility: hidden;
  transition: all 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}
.cart-overlay.open {
  opacity: 1; visibility: visible;
  background: rgba(10,26,20,0.55);
  backdrop-filter: blur(12px) saturate(1.2);
}

/* ─── Sidebar ─── */
.cart-sidebar {
  position: fixed; top: 0; right: 0; width: 460px; max-width: 94vw; height: 100vh;
  background: #fff; z-index: 10000;
  display: flex; flex-direction: column;
  box-shadow: -12px 0 60px rgba(0,0,0,0.12);
  transform: translateX(105%);
  transition: transform 0.55s cubic-bezier(0.32, 0.72, 0, 1);
}
.cart-sidebar.open { transform: translateX(0); }

/* ─── Header ─── */
.cart-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 14px;
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.cart-header-left { display: flex; align-items: center; gap: 12px; }
.cart-header-icon {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, #10b981, #059669);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px;
  box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}
.cart-header h3 { font-size: 16px; color: #064e3b; font-weight: 700; margin: 0; }
.cart-count { font-size: 11px; color: #6b7280; }
.cart-close {
  width: 36px; height: 36px; border-radius: 10px; border: 1.5px solid #e5e7eb;
  background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: #9ca3af; font-size: 14px;
  transition: all 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.cart-close:hover { background: #fef2f2; color: #ef4444; border-color: #fca5a5; transform: rotate(90deg); }

/* ─── Items ─── */
.cart-items {
  flex: 1; overflow-y: auto; padding: 12px 18px;
  scroll-behavior: smooth;
}
.cart-items::-webkit-scrollbar { width: 4px; }
.cart-items::-webkit-scrollbar-thumb { background: #d1fae5; border-radius: 4px; }

/* ─── Empty ─── */
.cart-empty {
  text-align: center; padding: 50px 20px;
  animation: cartEmptyFade 0.6s ease;
}
@keyframes cartEmptyFade { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.cart-empty .empty-icon {
  width: 72px; height: 72px; border-radius: 20px; margin: 0 auto 16px;
  background: linear-gradient(135deg, rgba(16,185,129,0.1), rgba(16,185,129,0.03));
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: #a7f3d0;
  animation: emptyFloat 3s ease-in-out infinite;
}
@keyframes emptyFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.cart-empty p { font-size: 15px; color: #6b7280; font-weight: 600; margin-bottom: 4px; }
.cart-empty .empty-sub { font-size: 12px; color: #9ca3af; margin-bottom: 20px; }

/* ─── Cart Item Card ─── */
.cart-item {
  padding: 14px; margin-bottom: 10px;
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 14px;
  position: relative;
  animation: cartCardSlide 0.45s cubic-bezier(0.32, 0.72, 0, 1) both;
  transition: all 0.3s ease;
}
.cart-item:hover { background: #fff; border-color: #d1fae5; box-shadow: 0 4px 16px rgba(0,0,0,0.04); }
.cart-item:nth-child(1) { animation-delay: 0.05s; }
.cart-item:nth-child(2) { animation-delay: 0.1s; }
.cart-item:nth-child(3) { animation-delay: 0.15s; }
.cart-item:nth-child(4) { animation-delay: 0.2s; }

@keyframes cartCardSlide {
  from { opacity: 0; transform: translateX(40px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
.cart-item.removing {
  animation: cartCardRemove 0.35s ease forwards;
}
@keyframes cartCardRemove {
  to { opacity: 0; transform: translateX(60px) scale(0.9); max-height: 0; padding: 0; margin: 0; overflow: hidden; }
}

/* ─── Item with Image ─── */
.cart-item-row { display: flex; gap: 12px; margin-bottom: 10px; }
.cart-item-img {
  width: 72px; height: 72px; border-radius: 10px; overflow: hidden; flex-shrink: 0;
  border: 2px solid #e2e8f0; position: relative; background: #f1f5f9;
}
.cart-item-img img { width: 100%; height: 100%; object-fit: cover; }
.cart-item-img .img-count-badge {
  position: absolute; bottom: 2px; right: 2px;
  background: rgba(0,0,0,0.6); color: #fff; font-size: 9px; font-weight: 700;
  padding: 1px 4px; border-radius: 4px;
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 14px; font-weight: 700; color: #1e293b; line-height: 1.3; margin-bottom: 4px; }
.cart-item-cat { font-size: 10px; color: #9ca3af; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }

/* ─── Price Breakdown ─── */
.cart-price-breakdown {
  display: flex; flex-wrap: wrap; gap: 4px 8px; margin-bottom: 8px;
  padding: 6px 8px; background: #f0fdf4; border-radius: 8px; border: 1px solid #d1fae5;
}
.cart-price-line {
  display: flex; align-items: center; gap: 3px; font-size: 10px; color: #6b7280;
}
.cart-price-line .pl-label { color: #9ca3af; }
.cart-price-line .pl-value { font-weight: 600; color: #374151; }
.cart-price-line .pl-extra { color: #059669; font-weight: 600; }
.cart-price-line .pl-zero { color: #d1d5db; }

/* ─── Remove Button ─── */
.cart-item-remove {
  position: absolute; top: 10px; right: 10px;
  background: none; border: none; color: #d1d5db; cursor: pointer; font-size: 12px;
  padding: 4px 6px; border-radius: 6px;
  transition: all 0.25s;
}
.cart-item-remove:hover { color: #ef4444; background: #fef2f2; transform: scale(1.1); }

/* ─── Inline Size Selector ─── */
.cart-sizes { display: flex; gap: 4px; margin-bottom: 8px; }
.cart-size-btn {
  flex: 1; padding: 6px 4px; border-radius: 8px; border: 1.5px solid #e5e7eb;
  background: #fff; cursor: pointer; text-align: center;
  font-family: 'Outfit', sans-serif; font-size: 11px; font-weight: 600;
  transition: all 0.2s ease;
}
.cart-size-btn:hover { border-color: #10b981; }
.cart-size-btn.active {
  border-color: #10b981; background: #ecfdf5; color: #059669;
  box-shadow: 0 0 0 2px rgba(16,185,129,0.1);
}

/* ─── Inline Planter Selector ─── */
.cart-planter-wrap { margin-bottom: 8px; }
.cart-planter-label { font-size: 10px; font-weight: 600; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.cart-planter-options { display: flex; gap: 4px; flex-wrap: wrap; }
.cart-planter-chip {
  padding: 4px 10px; border-radius: 20px; border: 1.5px solid #e5e7eb;
  background: #fff; cursor: pointer; font-size: 10px; font-weight: 600;
  font-family: 'Outfit', sans-serif; color: #6b7280;
  transition: all 0.2s ease; white-space: nowrap;
}
.cart-planter-chip:hover { border-color: #a78bfa; color: #7c3aed; }
.cart-planter-chip.active {
  border-color: #7c3aed; background: #f5f3ff; color: #7c3aed;
}

/* ─── Inline Color Selector ─── */
.cart-colors { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.cart-color-label { font-size: 10px; font-weight: 600; color: #9ca3af; margin-right: 4px; }
.cart-color-dot {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid #e5e7eb;
  cursor: pointer; transition: all 0.2s ease; position: relative;
}
.cart-color-dot:hover { transform: scale(1.2); }
.cart-color-dot.active {
  border-color: #1e293b;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #1e293b;
  transform: scale(1.15);
}

/* ─── Bottom Row ─── */
.cart-item-bottom { display: flex; align-items: center; justify-content: space-between; }
.cart-item-price {
  font-size: 18px; font-weight: 800;
  background: linear-gradient(135deg, #10b981, #059669);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.cart-item-unit { font-size: 10px; color: #9ca3af; }

/* ─── Qty Controls ─── */
.cart-qty-controls {
  display: flex; align-items: center;
  border: 1.5px solid #e5e7eb; border-radius: 10px; overflow: hidden; background: #fff;
}
.cart-qty-btn {
  width: 32px; height: 32px; border: none; background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 11px;
  color: #6b7280; transition: all 0.2s;
}
.cart-qty-btn:hover { background: #10b981; color: #fff; }
.cart-qty-btn:active { transform: scale(0.9); }
.cart-qty-value {
  width: 34px; text-align: center; font-size: 13px; font-weight: 700;
  border: none; background: transparent; color: #1e293b;
  font-family: 'Outfit', sans-serif;
}

/* ─── Footer ─── */
.cart-footer {
  padding: 16px 20px 20px; border-top: 1px solid #e2e8f0;
  background: #fafbfc; flex-shrink: 0;
  animation: footerSlideUp 0.4s ease;
}
@keyframes footerSlideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.cart-summary { margin-bottom: 14px; }
.cart-summary-row { display: flex; justify-content: space-between; font-size: 13px; color: #9ca3af; padding: 4px 0; }
.cart-summary-row span:last-child { font-weight: 500; color: #6b7280; }
.free-tag { color: #10b981 !important; font-weight: 600 !important; font-size: 12px; }
.cart-total {
  font-size: 16px; font-weight: 700; color: #1e293b;
  border-top: 2px dashed #e5e7eb; padding-top: 10px; margin-top: 6px;
  display: flex; justify-content: space-between;
}
.cart-total span:last-child {
  font-size: 20px; font-weight: 800;
  background: linear-gradient(135deg, #10b981, #059669);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

/* Buy Now */
.cart-buy-btn {
  width: 100%; padding: 14px; font-size: 14px; font-weight: 700; border-radius: 12px;
  margin-bottom: 8px; cursor: pointer; border: none;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff; display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 4px 16px rgba(245,158,11,0.3);
  transition: all 0.3s ease; position: relative; overflow: hidden;
  font-family: 'Outfit', sans-serif;
}
.cart-buy-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(245,158,11,0.4); }
.cart-buy-btn:active { transform: translateY(0) scale(0.98); }
.cart-buy-btn::after {
  content: ''; position: absolute; top: -50%; left: -100%; width: 30px; height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transform: rotate(25deg); transition: left 0.5s ease;
}
.cart-buy-btn:hover::after { left: 120%; }

.cart-continue-btn {
  width: 100%; padding: 11px; font-size: 12px; border: 1.5px solid #e5e7eb; border-radius: 12px;
  background: #fff; cursor: pointer; color: #9ca3af; font-weight: 500;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all 0.25s; font-family: 'Outfit', sans-serif;
}
.cart-continue-btn:hover { border-color: #10b981; color: #10b981; background: #f0fdf4; }

/* ─── Toast ─── */
.cart-toast {
  position: fixed; bottom: 32px; left: 50%;
  transform: translateX(-50%) translateY(140px);
  background: rgba(30,41,59,0.95); backdrop-filter: blur(16px);
  color: #fff; padding: 14px 24px 14px 16px; border-radius: 16px;
  font-size: 13px; font-weight: 500; z-index: 10001;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.2);
  transition: transform 0.5s cubic-bezier(0.32, 0.72, 0, 1);
  pointer-events: none; max-width: 92vw;
}
.cart-toast.show { transform: translateX(-50%) translateY(0); }
.toast-icon {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  display: flex; align-items: center; justify-content: center; font-size: 12px;
  animation: toastPop 0.4s cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes toastPop {
  0% { transform: scale(0) rotate(-180deg); }
  60% { transform: scale(1.2) rotate(10deg); }
  100% { transform: scale(1) rotate(0); }
}

/* ─── Fly to Cart ─── */
.fly-to-cart {
  position: fixed; z-index: 99999; pointer-events: none;
  width: 48px; height: 48px; border-radius: 14px; overflow: hidden;
  box-shadow: 0 8px 24px rgba(16,185,129,0.3);
  border: 2px solid rgba(16,185,129,0.5); background: #fff;
}
.fly-to-cart img { width: 100%; height: 100%; object-fit: cover; }

/* ─── Badge Bounce ─── */
@keyframes badgeBounce {
  0% { transform: scale(1); } 30% { transform: scale(1.4); } 60% { transform: scale(0.9); } 100% { transform: scale(1); }
}
.badge-bounce { animation: badgeBounce 0.4s ease; }

/* ─── Add to cart button ─── */
.add-cart-btn { position: relative; overflow: hidden; }
.add-cart-btn::after {
  content: ''; position: absolute; top: -50%; left: -100%; width: 30px; height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transform: rotate(25deg); transition: left 0.5s ease;
}
.add-cart-btn:hover::after { left: 120%; }
.add-cart-btn.added {
  background: #10b981 !important; color: #fff !important;
  animation: btnPulse 0.4s ease;
}
@keyframes btnPulse { 0% { transform: scale(1); } 50% { transform: scale(0.92); } 100% { transform: scale(1); } }

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .cart-sidebar { width: 100%; max-width: 100%; }
  .cart-header { padding: 14px 16px 12px; }
  .cart-items { padding: 10px 14px; }
  .cart-footer { padding: 14px 16px 18px; }
  .cart-item { padding: 12px; }
  .cart-item-img { width: 60px; height: 60px; }
}
@media (max-width: 480px) {
  .cart-item { padding: 10px; border-radius: 12px; }
  .cart-item-name { font-size: 13px; }
  .cart-item-price { font-size: 16px; }
  .cart-size-btn { font-size: 10px; padding: 5px 3px; }
  .cart-planter-chip { font-size: 9px; padding: 3px 8px; }
  .cart-color-dot { width: 20px; height: 20px; }
  .cart-qty-btn { width: 28px; height: 28px; font-size: 10px; }
  .cart-qty-value { width: 28px; font-size: 12px; }
  .cart-price-breakdown { padding: 4px 6px; }
  .cart-item-img { width: 54px; height: 54px; }
}
