/* سلة طلبات المنيو — متوافق مع ثيم pm */
body.pm-cart-enabled {
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

body.pm-has-cart-bar {
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

.pm-header__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.pm-cart-btn {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  margin-top: 0.25rem;
  border: 1px solid var(--pm-border);
  border-radius: 50%;
  background: var(--pm-card);
  color: var(--pm-text);
  font-size: 1.05rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.pm-cart-btn:hover {
  border-color: var(--pm-accent);
  background: var(--pm-card-hover);
}

.pm-cart-btn__badge {
  position: absolute;
  top: -4px;
  left: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--pm-accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pm-cart-add {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--pm-border);
  border-radius: 999px;
  background: var(--pm-tool-bg);
  color: var(--pm-text);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.pm-cart-add:hover {
  border-color: var(--pm-accent);
  color: var(--pm-accent);
}

.pm-slide .pm-cart-add,
.pm-stack-card .pm-cart-add,
.pm-cflow-card .pm-cart-add {
  max-width: 12rem;
  margin-left: auto;
  margin-right: auto;
}

.pm-cart-qty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.pm-cart-qty[hidden] {
  display: none !important;
}

.pm-cart-qty__btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--pm-border);
  border-radius: 50%;
  background: var(--pm-card);
  color: var(--pm-text);
  font-size: 1rem;
  cursor: pointer;
}

.pm-cart-qty__val {
  min-width: 1.5rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.pm-toast {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  z-index: 120;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  background: var(--pm-text);
  color: var(--pm-bg);
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.pm-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

body:not(.pm-has-cart-bar) .pm-toast {
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
}

.pm-cart-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  padding: 0.65rem 1rem;
  padding-bottom: max(0.65rem, env(safe-area-inset-bottom, 0px));
  background: var(--pm-glass);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--pm-border);
}

.pm-cart-bar[hidden] {
  display: none;
}

.pm-cart-bar__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.pm-cart-bar__open {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.5rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--pm-text);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s;
}

.pm-cart-bar__open:hover {
  background: var(--pm-tool-bg);
}

.pm-cart-bar__open i {
  font-size: 1.05rem;
  color: var(--pm-accent);
}

.pm-cart-bar__text {
  font-size: 0.88rem;
  color: var(--pm-text-soft);
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem;
}

.pm-cart-bar__text strong {
  color: var(--pm-text);
}

.pm-cart-bar__sum {
  color: var(--pm-accent);
  font-weight: 700;
}

.pm-cart-bar__submit {
  padding: 0.65rem 1.1rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #fff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.pm-cart-bar__submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pm-cart-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
}

.pm-cart-drawer.is-open {
  pointer-events: auto;
}

.pm-cart-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.25s;
}

.pm-cart-drawer.is-open .pm-cart-drawer__backdrop {
  opacity: 1;
}

.pm-cart-drawer__panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 85dvh;
  background: var(--pm-bg-elevated);
  border-radius: 1rem 1rem 0 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  border-top: 1px solid var(--pm-border);
}

@media (min-width: 640px) {
  .pm-cart-drawer__panel {
    top: 0;
    bottom: 0;
    left: auto;
    right: 0;
    width: min(100%, 400px);
    max-height: none;
    border-radius: 0;
    transform: translateX(100%);
  }

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

@media (max-width: 639px) {
  .pm-cart-drawer.is-open .pm-cart-drawer__panel {
    transform: translateY(0);
  }
}

.pm-cart-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--pm-border);
}

.pm-cart-drawer__head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.pm-cart-drawer__close {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: var(--pm-tool-bg);
  color: var(--pm-text);
  cursor: pointer;
}

.pm-cart-drawer__list {
  list-style: none;
  margin: 0;
  padding: 0.5rem 1rem;
  flex: 1;
  overflow-y: auto;
}

.pm-cart-drawer__list:empty {
  display: none;
}

.pm-cart-line {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--pm-border);
}

.pm-cart-line__info {
  flex: 1;
  min-width: 0;
}

.pm-cart-line__name {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.pm-cart-line__meta {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  color: var(--pm-text-soft);
}

.pm-cart-line__sum {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--pm-accent);
}

.pm-cart-line__qty {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.pm-cart-line__qty button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--pm-border);
  border-radius: 8px;
  background: var(--pm-card);
  color: var(--pm-text);
  cursor: pointer;
}

.pm-cart-line__remove {
  border: none;
  background: none;
  color: var(--pm-text-soft);
  cursor: pointer;
  padding: 0.35rem;
}

.pm-cart-drawer__empty {
  margin: 0;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--pm-text-soft);
  font-size: 0.9rem;
}

.pm-cart-drawer__empty.is-hidden {
  display: none;
}

.pm-cart-drawer__foot {
  padding: 1rem 1.1rem 1.25rem;
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--pm-border);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pm-cart-drawer__total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.95rem;
}

.pm-cart-drawer__total span {
  color: var(--pm-text-soft);
  font-weight: 600;
}

.pm-cart-drawer__total strong {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--pm-accent);
}

.pm-cart-drawer__checkout {
  width: 100%;
  padding: 0.85rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.pm-cart-drawer__checkout:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ——— نموذج تفاصيل الطلب قبل واتساب ——— */
.pm-checkout {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
}

.pm-checkout.is-open {
  pointer-events: auto;
}

.pm-checkout__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.25s;
}

.pm-checkout.is-open .pm-checkout__backdrop {
  opacity: 1;
}

.pm-checkout__panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(92dvh, 640px);
  display: flex;
  flex-direction: column;
  background: var(--pm-card);
  color: var(--pm-text);
  border-radius: 18px 18px 0 0;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  border-top: 1px solid var(--pm-border);
}

.pm-checkout.is-open .pm-checkout__panel {
  transform: translateY(0);
}

@media (min-width: 640px) {
  .pm-checkout__panel {
    top: 50%;
    bottom: auto;
    left: 50%;
    right: auto;
    width: min(100% - 2rem, 420px);
    max-height: min(90dvh, 640px);
    border-radius: 16px;
    transform: translate(-50%, -46%) scale(0.96);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
  }

  .pm-checkout.is-open .pm-checkout__panel {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

.pm-checkout__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--pm-border);
}

.pm-checkout__head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.pm-checkout__close {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: var(--pm-tool-bg);
  color: var(--pm-text);
  cursor: pointer;
}

.pm-checkout__body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.pm-checkout__hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--pm-text-soft);
  line-height: 1.45;
}

.pm-checkout__field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.pm-checkout__field > span {
  font-size: 0.82rem;
  font-weight: 600;
}

.pm-checkout__field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--pm-border);
  border-radius: 12px;
  background: var(--pm-tool-bg);
  color: var(--pm-text);
  font: inherit;
  font-size: 0.9rem;
  resize: vertical;
  min-height: 2.75rem;
}

.pm-checkout__field textarea:focus {
  outline: none;
  border-color: var(--pm-accent);
}

.pm-checkout__loc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pm-checkout__loc-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--pm-border);
  border-radius: 999px;
  background: var(--pm-tool-bg);
  color: var(--pm-text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.pm-checkout__loc-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.pm-checkout__loc-btn--muted {
  color: var(--pm-text-soft);
}

.pm-checkout__loc-status {
  margin: 0;
  font-size: 0.78rem;
  color: var(--pm-text-soft);
}

.pm-checkout__loc-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--pm-accent);
  text-decoration: none;
}

.pm-checkout__loc-link:hover {
  text-decoration: underline;
}

.pm-checkout__foot {
  padding: 1rem 1.1rem 1.25rem;
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--pm-border);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pm-checkout__total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.95rem;
}

.pm-checkout__total span {
  color: var(--pm-text-soft);
  font-weight: 600;
}

.pm-checkout__total strong {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--pm-accent);
}

.pm-checkout__wa-hint {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  background: rgba(180, 70, 70, 0.12);
  color: #c45c5c;
  font-size: 0.8rem;
  line-height: 1.45;
  text-align: center;
}

.pm-checkout__send {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.pm-checkout__send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* إخفاء زر واتساب القديم عند تفعيل السلة */
body.pm-cart-enabled .pm-wa-fab {
  display: none !important;
}
