/* ═══════════════════════════════════════════════════════════════
   Nasij — Cart Drawer
   Single-scroll layout: items → address → payment → confirm
   ═══════════════════════════════════════════════════════════════ */

/* ── Cart Button Badge ──────────────────────────────────────── */
.cart-btn {
  position: relative;
  font-size: 18px;
}

.cart-badge {
  position: absolute;
  top: -5px;
  left: -5px;
  background: #e8744d;
  color: #fff;
  font-family: 'Tajawal', sans-serif;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  pointer-events: none;
}

/* ── Overlay ────────────────────────────────────────────────── */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 58, 0.45);
  backdrop-filter: blur(4px);
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.cart-overlay.cart-open {
  opacity: 1;
  pointer-events: auto;
}

/* ── Drawer shell ───────────────────────────────────────────── */
.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 100vw;
  height: 100dvh;
  background: #f7f1e3;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -8px 0 48px rgba(20, 20, 58, 0.14);
  overflow: hidden;
}

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

/* ── Main view & done view ──────────────────────────────────── */
#cartMainView {
  height: 100%;
  overflow: hidden;
}

#cartMainView:not([hidden]) {
  display: flex;
  flex-direction: column;
}

#cartDoneView {
  height: 100%;
}

#cartDoneView:not([hidden]) {
  display: flex;
}

/* ── Header ─────────────────────────────────────────────────── */
.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(20, 20, 58, 0.1);
  flex-shrink: 0;
}

.cart-title {
  font-family: 'Rakkas', serif;
  font-size: 22px;
  font-weight: 400;
  color: #14143a;
  margin: 0;
}

.cart-close {
  background: rgba(20, 20, 58, 0.07) !important;
  border: none !important;
  border-radius: 50% !important;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  color: #14143a;
  transition: background 0.2s !important;
  flex-shrink: 0;
}
.cart-close:hover { background: rgba(20, 20, 58, 0.15) !important; }

/* ── Scrollable body ────────────────────────────────────────── */
.cart-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(20,20,58,0.12) transparent;
}

/* ── Section blocks ─────────────────────────────────────────── */
.cart-section {
  padding: 22px 24px 18px;
}

.cart-section-label {
  font-family: 'Tajawal', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: rgba(20, 20, 58, 0.45);
  text-transform: uppercase;
  margin-bottom: 16px;
}

.cart-divider {
  height: 1px;
  background: rgba(20, 20, 58, 0.09);
  margin: 0 24px;
}

/* ── Cart items ─────────────────────────────────────────────── */
.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 0;
  color: rgba(20, 20, 58, 0.35);
  font-family: 'Tajawal', sans-serif;
  text-align: center;
}
.cart-empty-icon { font-size: 40px; }
.cart-empty p    { font-size: 15px; font-weight: 500; margin: 0; color: #14143a; }
.cart-empty small{ font-size: 12px; }

.cart-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid rgba(20, 20, 58, 0.06);
}
.cart-item:last-child { border-bottom: none; }

.cart-item-img {
  width: 64px;
  height: 78px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  background: #ede4ce;
}
.cart-item-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cart-item-icon {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
}

.cart-item-info { flex: 1; min-width: 0; }
.cart-item-title {
  font-family: 'Rakkas', serif;
  font-size: 15px;
  color: #14143a;
  margin: 0 0 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cart-item-dis {
  font-family: 'Tajawal', sans-serif;
  font-size: 11px;
  color: rgba(20,20,58,0.45);
  margin: 0 0 5px;
}
.cart-item-price {
  font-family: 'Tajawal', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #e8744d;
  margin: 0;
}

.cart-item-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.cart-qty {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(20,20,58,0.06);
  border-radius: 9999px;
  padding: 4px 8px;
}
.cart-qty span {
  font-family: 'Tajawal', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #14143a;
  min-width: 16px;
  text-align: center;
}
.cart-qty-btn {
  background: none !important;
  border: none !important;
  color: #14143a !important;
  font-size: 15px;
  cursor: pointer;
  padding: 0 !important;
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50% !important;
  transition: background 0.15s !important;
}
.cart-qty-btn:hover { background: rgba(20,20,58,0.12) !important; }

.cart-remove {
  background: none !important;
  border: none !important;
  font-size: 13px;
  cursor: pointer;
  opacity: 0.35;
  transition: opacity 0.2s !important;
  padding: 4px !important;
}
.cart-remove:hover { opacity: 0.75; }

.cart-subtotal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed rgba(20,20,58,0.12);
  font-family: 'Tajawal', sans-serif;
  font-size: 13px;
  color: rgba(20,20,58,0.6);
}
.cart-subtotal-val {
  font-family: 'Rakkas', serif;
  font-size: 18px;
  color: #14143a;
  font-weight: 400;
}

/* ── Address fields ─────────────────────────────────────────── */
.cart-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-family: 'Tajawal', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: rgba(20,20,58,0.5);
  letter-spacing: 0.07em;
}

.cart-input {
  background: rgba(20,20,58,0.05) !important;
  border: 1.5px solid transparent !important;
  border-radius: 10px !important;
  padding: 10px 13px !important;
  font-family: 'Tajawal', sans-serif !important;
  font-size: 14px !important;
  color: #14143a !important;
  outline: none !important;
  transition: border-color 0.2s, background 0.2s !important;
  width: 100%;
  box-sizing: border-box;
  appearance: none;
}
.cart-input:focus {
  border-color: #e8744d !important;
  background: rgba(255,255,255,0.6) !important;
}

.cart-textarea { resize: none; height: 72px; }

/* ── Payment methods ────────────────────────────────────────── */
.cart-payment-methods {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.cart-payment-option { cursor: pointer; }
.cart-payment-option input { display: none; }

.cart-payment-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  background: rgba(20,20,58,0.05);
  border-radius: 12px;
  border: 2px solid transparent;
  font-family: 'Tajawal', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #14143a;
  transition: border-color 0.2s, background 0.2s;
}
.cart-payment-option input:checked + .cart-payment-card {
  border-color: #e8744d;
  background: rgba(232,116,77,0.07);
}
.cart-payment-icon { font-size: 20px; }

/* Disabled payment options */
.cart-payment-disabled {
  cursor: not-allowed;
  pointer-events: auto;
}

.cart-payment-disabled .cart-payment-card {
  opacity: 0.38;
  filter: grayscale(1);
  cursor: not-allowed;
}

.cart-payment-soon {
  font-family: 'Tajawal', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: rgba(20,20,58,0.45);
  background: rgba(20,20,58,0.07);
  border-radius: 9999px;
  padding: 2px 8px;
  margin-right: auto;
  margin-left: 4px;
}

/* ── Sticky confirm footer ──────────────────────────────────── */
.cart-sticky-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 14px 24px 24px;
  background: linear-gradient(to bottom, transparent, #f7f1e3 30%);
}

.cart-checkout-btn {
  width: 100%;
  background: #14143a !important;
  color: #f7f1e3 !important;
  border: none !important;
  border-radius: 9999px !important;
  font-family: 'Tajawal', sans-serif !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  padding: 15px 24px !important;
  cursor: pointer;
  transition: background 0.25s !important;
  text-align: center;
}
.cart-checkout-btn:hover { background: #e8744d !important; }

/* ── Done screen ────────────────────────────────────────────── */
.cart-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 40px 32px;
  text-align: center;
  gap: 12px;
}

.cart-done-icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: #14143a;
  color: #f7f1e3;
  font-size: 32px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}

.cart-done-title {
  font-family: 'Rakkas', serif;
  font-size: 28px;
  color: #14143a;
  font-weight: 400;
  margin: 0;
}

.cart-done-sub {
  font-family: 'Tajawal', sans-serif;
  font-size: 14px;
  color: rgba(20,20,58,0.6);
  line-height: 1.6;
  margin: 0;
  max-width: 280px;
}

.cart-done-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 260px;
  font-family: 'Tajawal', sans-serif;
  font-size: 14px;
  background: rgba(20,20,58,0.06);
  border-radius: 10px;
  padding: 10px 16px;
  color: rgba(20,20,58,0.55);
}
.cart-done-meta strong { color: #14143a; font-weight: 600; }

.cart-done .cart-checkout-btn {
  max-width: 240px;
  margin-top: 8px;
}

/* ── Toast ──────────────────────────────────────────────────── */
.cart-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #14143a;
  color: #f7f1e3;
  font-family: 'Tajawal', sans-serif;
  font-size: 14px;
  font-weight: 500;
  padding: 12px 24px;
  border-radius: 9999px;
  z-index: 99999;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  white-space: nowrap;
  pointer-events: none;
}
.cart-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

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