/* ===========================================================
   Side Cart (Sliding Mini Cart) — Rawaat Al-Naseem
   =========================================================== */

/* ===== Body scroll lock when cart is open ===== */
body.rn-no-scroll {
  overflow: hidden;
}

/* ===== Overlay (dark background behind the drawer) ===== */
.rn-side-cart-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  pointer-events: none;
}
.rn-side-cart-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ===== Side cart drawer ===== */
.rn-side-cart {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  max-width: 400px;
  height: 100vh;
  height: 100dvh;
  background: var(--rn-white, #ffffff);
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
  z-index: 99999;
  transform: translateX(-100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  visibility: hidden;
  font-family: 'Cairo', sans-serif;
}
.rn-side-cart.is-open {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}

/* RTL: drawer slides in from the right side */
html[dir="rtl"] .rn-side-cart {
  left: auto;
  right: 0;
  transform: translateX(100%);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
}
html[dir="rtl"] .rn-side-cart.is-open {
  transform: translateX(0);
}

/* ===== MOBILE — drawer takes half the screen instead of full width ===== */
@media (max-width: 600px) {
  .rn-side-cart {
    width: 70vw;
    max-width: 70vw;
    min-width: 260px;
  }
  /* Tighten inner spacing for the narrower panel */
  .rn-side-cart-header,
  .rn-side-cart-content,
  .rn-side-cart-total,
  .rn-side-cart-actions {
    padding-left: 12px;
    padding-right: 12px;
  }
  .rn-side-cart-item {
    gap: 8px;
  }
  .rn-sc-thumb {
    width: 50px;
    height: 50px;
  }
  .rn-side-cart-item-name {
    font-size: 12px;
  }
  /* On a narrow panel, stack the action buttons vertically */
  .rn-side-cart-actions {
    flex-direction: column;
  }
}

/* ===== Header of the drawer ===== */
.rn-side-cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--rn-cream-border, #f0e8e0);
  flex-shrink: 0;
}
.rn-side-cart-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: var(--rn-text-black, #1a1a1a);
}
.rn-side-cart-close {
  background: var(--rn-beige-soft, #f5ece2);
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  color: var(--rn-text-dark, #333);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  padding: 0;
}
.rn-side-cart-close:hover {
  background: var(--rn-beige, #ead5c5);
}

/* ===== Scrollable content area ===== */
.rn-side-cart-content {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
}

/* ===== Empty state ===== */
.rn-side-cart-empty {
  text-align: center;
  padding: 40px 20px;
  margin: auto 0;
}
.rn-side-cart-empty p {
  color: var(--rn-text-muted, #888);
  font-size: 15px;
  margin: 0 0 18px;
}
.rn-side-cart-shop-link {
  display: inline-block;
  background: var(--rn-beige, #ead5c5);
  color: var(--rn-text-black, #1a1a1a);
  padding: 11px 26px;
  border-radius: var(--rn-radius-xl, 30px);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  transition: background 0.2s ease;
}
.rn-side-cart-shop-link:hover {
  background: var(--rn-beige-hover, #ddc4b0);
}

/* ===== Items list ===== */
.rn-side-cart-items {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
}
.rn-side-cart-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rn-cream-border, #f0e8e0);
  position: relative;
}
.rn-side-cart-item:last-child {
  border-bottom: none;
}

/* Thumbnail */
.rn-sc-thumb {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  display: block;
  border-radius: var(--rn-radius-sm, 8px);
  overflow: hidden;
  background: var(--rn-beige-soft, #f5ece2);
}
.rn-sc-thumb img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  display: block;
  margin: 0 !important;
  border-radius: 0 !important;
}

/* Item info */
.rn-side-cart-item-info {
  flex: 1 1 auto;
  min-width: 0;
  padding-left: 4px;
  padding-right: 4px;
}
.rn-side-cart-item-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--rn-text-black, #1a1a1a);
  margin-bottom: 6px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rn-side-cart-item-name a {
  color: inherit;
  text-decoration: none;
}
.rn-side-cart-item-name a:hover {
  color: var(--rn-pink-dark, #c97b7b);
}
.rn-side-cart-item-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--rn-pink-dark, #c97b7b);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.rn-side-cart-item-price .rn-sc-qty {
  color: var(--rn-text-muted, #888);
  font-weight: 600;
  font-size: 12px;
}
.rn-side-cart-item-price .woocommerce-Price-amount {
  unicode-bidi: plaintext;
  white-space: nowrap;
}

/* Remove button */
.rn-side-cart-remove {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--rn-beige-soft, #f5ece2);
  color: var(--rn-text-dark, #333);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}
.rn-side-cart-remove:hover {
  background: var(--rn-pink-dark, #c97b7b);
  color: #fff;
}

/* ===== Totals row ===== */
.rn-side-cart-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-top: 1px solid var(--rn-cream-border, #f0e8e0);
  background: var(--rn-beige-soft, #f5ece2);
  font-size: 15px;
  font-weight: 800;
  color: var(--rn-text-black, #1a1a1a);
  flex-shrink: 0;
}
.rn-side-cart-total-amount {
  color: var(--rn-pink-dark, #c97b7b);
  font-weight: 900;
  unicode-bidi: plaintext;
}
.rn-side-cart-total-amount .woocommerce-Price-amount {
  unicode-bidi: plaintext;
  white-space: nowrap;
}

/* ===== Action buttons ===== */
.rn-side-cart-actions {
  display: flex;
  gap: 10px;
  padding: 16px 20px 20px;
  flex-shrink: 0;
  background: var(--rn-white, #ffffff);
  border-top: 1px solid var(--rn-cream-border, #f0e8e0);
}
.rn-side-cart-view,
.rn-side-cart-checkout {
  flex: 1 1 50%;
  text-align: center;
  padding: 12px 10px;
  border-radius: var(--rn-radius-xl, 30px);
  font-weight: 800;
  font-size: 14px;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.15s ease;
  font-family: 'Cairo', sans-serif;
}
.rn-side-cart-view {
  background: var(--rn-beige-soft, #f5ece2);
  color: var(--rn-text-black, #1a1a1a);
  border: 1.5px solid var(--rn-beige, #ead5c5);
}
.rn-side-cart-view:hover {
  background: var(--rn-beige, #ead5c5);
}
.rn-side-cart-checkout {
  background: var(--rn-beige, #ead5c5);
  color: var(--rn-text-black, #1a1a1a);
  box-shadow: 0 4px 12px rgba(234, 213, 197, 0.4);
}
.rn-side-cart-checkout:hover {
  background: var(--rn-beige-hover, #ddc4b0);
  transform: translateY(-1px);
}