/* ==========================================================================
   FEATURE: SHOPPING CART & FLOATING WIDGET
   ========================================================================== */

/* 1. FLOATING CART WIDGET ("كارت طايرة في الجنب") */
.floating-cart-widget {
  position: fixed;
  bottom: 28px;
  left: 28px;
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #FB3E38 0%, #D9221C 100%);
  color: #FFFFFF;
  padding: 10px 18px;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(251, 62, 56, 0.45), 0 2px 8px rgba(0, 0, 0, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

[dir="ltr"] .floating-cart-widget {
  left: auto;
  right: 28px;
}

.floating-cart-widget:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 14px 35px rgba(251, 62, 56, 0.55), 0 4px 12px rgba(0, 0, 0, 0.15);
  border-color: rgba(255, 255, 255, 0.5);
}

.floating-cart-widget:active {
  transform: translateY(-1px) scale(0.98);
}

.floating-cart-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  flex-shrink: 0;
}

.floating-cart-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #FFFFFF;
  color: var(--primary-red, #FB3E38);
  font-size: 11px;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

[dir="ltr"] .floating-cart-badge {
  right: -5px;
  left: auto;
}

.floating-cart-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.floating-cart-title {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.9;
  letter-spacing: 0.3px;
}

.floating-cart-total {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.floating-cart-widget.cart-bump {
  animation: floatingCartBump 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes floatingCartBump {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* 2. CART DRAWER OVERLAY */
.cart-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 1100;
  display: none;
}

.cart-drawer-overlay.active {
  display: block;
}

.cart-drawer-content {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  max-width: 420px;
  background: #FFFFFF;
  box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  z-index: 1101;
  animation: drawerSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[dir="ltr"] .cart-drawer-content {
  left: auto;
  right: 0;
}

@keyframes drawerSlideIn {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

[dir="ltr"] .cart-drawer-content {
  animation: drawerSlideInRtl 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes drawerSlideInRtl {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.cart-drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color, #E2E8F0);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-drawer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #FAFAFA;
  border-radius: 12px;
  border: 1px solid var(--border-color, #E2E8F0);
  position: relative;
}

.cart-drawer-item.cart-item-frozen {
  border-color: #BAE6FD;
  background: #F0F9FF;
}

.cart-drawer-item img {
  width: 55px;
  height: 55px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  padding: 4px;
}

.qty-btn-s {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.cart-drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color, #E2E8F0);
  background: #FFFFFF;
}

.btn-primary-website {
  width: 100%;
  background: var(--primary-red, #FB3E38);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  padding: 12px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(251, 62, 56, 0.3);
  transition: background 0.15s ease;
}

.btn-primary-website:hover {
  background: var(--hover-red, #E02822);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .floating-cart-widget {
    bottom: 20px;
    left: 16px;
    padding: 8px 14px;
  }
  [dir="ltr"] .floating-cart-widget {
    left: auto;
    right: 16px;
  }
  .floating-cart-title {
    display: none;
  }
  .cart-drawer-content {
    max-width: 100%;
  }
}
