/* =========================================
   ISTREV — عربة تسوق جانبية (Cart Drawer)
========================================= */

.cart-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
  z-index: 9998;
}

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

.cart-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  width: min(400px, 92vw);
  background: #fff;
  box-shadow: -6px 0 24px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

html[dir="ltr"] .cart-drawer {
  right: auto;
  left: 0;
  box-shadow: 6px 0 24px rgba(0, 0, 0, 0.15);
  transform: translateX(-100%);
}

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

body.cart-drawer-locked {
  overflow: hidden;
}

.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid #eee;
}

.cart-drawer-header h2 {
  margin: 0;
  font-size: 18px;
}

.cart-drawer-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #666;
  padding: 4px 8px;
}

.cart-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
}

.cart-drawer-empty {
  color: #888;
  text-align: center;
  margin-top: 40px;
  font-size: 14px;
}

.cart-drawer-item {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid #f0f0f0;
}

.cart-drawer-item-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  background: #f2f2f2;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.cart-drawer-item-thumb-empty {
  display: block;
}

.cart-drawer-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cart-drawer-item-info strong {
  font-size: 13.5px;
  line-height: 1.4;
}

.cart-drawer-item-info small {
  color: #888;
  font-size: 11.5px;
}

.cart-drawer-item-price {
  font-weight: 700;
  font-size: 13px;
  margin-top: 2px;
}

.cart-drawer-item-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.cart-drawer-remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: #999;
  padding: 2px;
}

.cart-drawer-remove-btn:hover {
  color: #b00020;
}

.cart-drawer-qty-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 2px 10px;
}

.cart-drawer-qty-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  line-height: 1;
  padding: 0;
}

.cart-drawer-qty-stepper span {
  min-width: 14px;
  text-align: center;
  font-size: 12.5px;
}

.cart-drawer-footer {
  padding: 16px 20px 20px;
  border-top: 1px solid #eee;
}

.cart-drawer-subtotal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  margin-bottom: 14px;
}

.cart-drawer-subtotal-row strong {
  font-size: 17px;
}

.cart-drawer-checkout-btn {
  display: block;
  text-align: center;
  background: #111214;
  color: #fff;
  padding: 13px;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
  font-size: 15px;
}

.cart-drawer-view-cart-link {
  display: block;
  text-align: center;
  margin-top: 10px;
  font-size: 13px;
  color: #555;
  text-decoration: underline;
}

@media (max-width: 480px) {
  .cart-drawer {
    width: 100vw;
  }
}
