/* =============================================================================
   پارسی شو — هزینهٔ ارسال و بازطراحی صفحهٔ تسویه
   پیشوند phx- تا با هیچ کلاس دیگری تداخل نکند.
   ============================================================================= */

/* ---------------------------------------------------------------------------
   ۱) کارت محاسبهٔ ارسال (سبد + تسویه)
   --------------------------------------------------------------------------- */
.phx-ship {
  margin: 12px 0 4px;
  border: 1px solid #e3eaf4;
  border-radius: 18px;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(37, 99, 235, .07), transparent 55%),
    linear-gradient(180deg, #ffffff, #f9fbff);
  box-shadow: 0 18px 40px -34px rgba(15, 34, 55, .55);
  overflow: hidden;
}
.phx-ship.is-checkout { margin: 0; }

.phx-ship-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 15px 11px;
  border-bottom: 1px dashed #e6edf7;
}
.phx-ico {
  display: grid; place-items: center; flex: 0 0 34px;
  width: 34px; height: 34px; border-radius: 11px;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 10px 20px -14px rgba(37, 99, 235, .95);
}
.phx-ico svg { width: 18px; height: 18px; }
.phx-ship-head b { display: block; font-size: 13px; font-weight: 900; color: #16283b; letter-spacing: -.1px; }
.phx-ship-head i { display: block; font-style: normal; font-size: 10.5px; color: #7d8b9c; margin-top: 2px; }
.phx-live {
  margin-inline-start: auto;
  font-size: 9.5px; font-weight: 800; color: #0d7a5f;
  background: #ecfdf5; border: 1px solid #bdefd7;
  padding: 4px 9px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 5px;
}
.phx-live::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, .16);
}

.phx-ship-body { padding: 13px 15px 15px; }

/* مقصد */
.phx-loc { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.phx-field { display: block; }
.phx-field > span {
  display: block; font-size: 10.5px; font-weight: 800; color: #5b6b7e; margin-bottom: 5px;
}
.phx-field select {
  width: 100%; height: 40px; padding: 0 11px;
  border: 1px solid #dfe8f3; border-radius: 11px;
  background: #fff; color: #1e293b;
  font: inherit; font-size: 12.5px; font-weight: 700;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: left 11px center;
  padding-left: 30px;
  transition: border-color .16s, box-shadow .16s, background-color .16s;
}
.phx-field select:hover { border-color: #c9d8ea; }
.phx-field select:focus {
  outline: none; border-color: #93b4f5; background-color: #fff;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, .13);
}
.phx-field select:disabled { opacity: .55; cursor: not-allowed; }

/* روش‌ها */
.phx-methods { display: grid; gap: 8px; margin-top: 12px; }
.phx-m {
  position: relative;
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid #e4ebf5;
  border-radius: 13px;
  background: #fff;
  cursor: pointer;
  transition: border-color .16s, box-shadow .16s, transform .16s, background-color .16s;
}
.phx-m:hover { border-color: #c9dbf3; box-shadow: 0 12px 24px -22px rgba(15, 34, 55, .8); }
.phx-m input { position: absolute; opacity: 0; width: 0; height: 0; }
.phx-dot {
  position: relative; width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid #cbd7e6; background: #fff; transition: border-color .16s;
}
.phx-dot::after {
  content: ""; position: absolute; inset: 3px; border-radius: 50%;
  background: #2563eb; transform: scale(0); transition: transform .16s ease;
}
.phx-m input:checked ~ .phx-dot { border-color: #2563eb; }
.phx-m input:checked ~ .phx-dot::after { transform: scale(1); }
.phx-m input:focus-visible ~ .phx-dot { box-shadow: 0 0 0 4px rgba(37, 99, 235, .18); }
.phx-m.is-on {
  border-color: #7ea8f0;
  background: linear-gradient(180deg, #f7faff, #eef5ff);
  box-shadow: 0 0 0 1px #7ea8f0 inset, 0 14px 28px -26px rgba(37, 99, 235, .9);
}
.phx-m-tx b {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 900; color: #16283b;
}
.phx-m-tx i {
  display: block; font-style: normal; font-size: 10.5px; line-height: 1.7;
  color: #7d8b9c; margin-top: 2px;
}
.phx-m-eta {
  font-size: 9.5px; font-weight: 800; color: #1d4ed8;
  background: #eaf1ff; border-radius: 999px; padding: 2px 7px;
}
.phx-m-cost {
  text-align: left; font-variant-numeric: tabular-nums; white-space: nowrap;
  font-size: 13px; font-weight: 900; color: #16283b;
}
.phx-m-cost small { font-size: 9px; font-weight: 700; color: #94a3b8; margin-inline-start: 3px; }
.phx-m-cost.is-free { color: #0d7a5f; }
.phx-m.is-disabled { opacity: .55; cursor: not-allowed; }
.phx-m.is-disabled .phx-m-cost { text-decoration: line-through; }

.phx-empty {
  margin-top: 12px; padding: 14px;
  border: 1px dashed #dbe5f1; border-radius: 13px;
  text-align: center; font-size: 11.5px; line-height: 1.9; color: #7d8b9c;
  background: #fbfdff;
}

/* نوار ارسال رایگان */
.phx-free { margin-top: 12px; padding-top: 11px; border-top: 1px dashed #e6edf7; }
.phx-free-tx {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 10.5px; color: #5b6b7e; margin-bottom: 7px;
}
.phx-free-tx b { color: #0d7a5f; font-weight: 900; font-variant-numeric: tabular-nums; }
.phx-bar { height: 6px; border-radius: 99px; background: #e9eff7; overflow: hidden; }
.phx-bar span {
  display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #34d399, #10b981);
  transition: width .45s cubic-bezier(.22, .8, .3, 1);
}
.phx-free.is-done .phx-bar span { background: linear-gradient(90deg, #10b981, #059669); }

/* خطای محاسبه */
.phx-err {
  margin-top: 10px; padding: 9px 12px; border-radius: 10px;
  background: #fff6f6; border: 1px solid #f6cccc; color: #b91c1c;
  font-size: 11px; font-weight: 700;
}

/* توضیح تخفیف */
.phx-disc-note {
  margin: 8px 2px 0; font-size: 10px; line-height: 1.95; color: #7d8b9c;
}
.phx-disc-note b { color: #0d7a5f; font-weight: 900; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------------
   ۲) بازطراحی صفحهٔ تسویه (فقط فرم دارای phx-co)
   --------------------------------------------------------------------------- */
main form.phx-co { align-items: start; }

main form.phx-co .glass:not(.phx-ship),
main form.phx-co > div > div:not(.phx-ship) {
  border-radius: 20px !important;
  border: 1px solid #e6edf7;
  background: #fff !important;
  box-shadow: 0 22px 44px -40px rgba(15, 34, 55, .5);
  backdrop-filter: none;
  transition: box-shadow .2s ease, border-color .2s ease;
}
main form.phx-co .glass:not(.phx-ship):hover { border-color: #d7e4f5; box-shadow: 0 26px 50px -40px rgba(15, 34, 55, .6); }

/* سربرگ کارت‌ها */
main form.phx-co .phx-card-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px !important;
}
main form.phx-co .phx-card-head h2 {
  font-size: 13.5px !important; font-weight: 900 !important; color: #16283b !important;
  letter-spacing: -.1px;
}
main form.phx-co .phx-card-head svg {
  width: 17px; height: 17px; color: #2563eb;
}
main form.phx-co .phx-step {
  display: grid; place-items: center; flex: 0 0 24px;
  width: 24px; height: 24px; border-radius: 8px;
  font-size: 11px; font-weight: 900; color: #fff;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 8px 16px -12px rgba(37, 99, 235, .95);
}
main form.phx-co .phx-card-sub {
  margin: -8px 0 14px; font-size: 11px; line-height: 1.85; color: #8593a6;
}

/* فیلدها */
main form.phx-co label {
  font-size: 11.5px !important; font-weight: 800 !important;
  color: #52657a !important; margin-bottom: 6px !important;
}
main form.phx-co input,
main form.phx-co select,
main form.phx-co textarea {
  height: 48px !important;
  border-radius: 12px !important;
  border: 1px solid #dfe8f3 !important;
  background: #f8fafc !important;
  font-size: 13px !important; font-weight: 700;
  color: #16283b !important;
  transition: border-color .16s, box-shadow .16s, background-color .16s;
}
main form.phx-co select { padding-inline-end: 12px; }
main form.phx-co input::placeholder { font-weight: 500; color: #a7b4c4 !important; }
main form.phx-co input:hover,
main form.phx-co select:hover,
main form.phx-co textarea:hover { border-color: #c9d8ea !important; }
main form.phx-co input:focus,
main form.phx-co select:focus,
main form.phx-co textarea:focus {
  outline: none !important;
  background: #fff !important;
  border-color: #7ea8f0 !important;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, .14) !important;
}
main form.phx-co input.phx-bad {
  border-color: #f0a9a9 !important; background: #fffafa !important;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, .1) !important;
}
main form.phx-co .phx-help {
  margin: 6px 2px 0; font-size: 10px; line-height: 1.75; color: #93a1b3;
}
main form.phx-co .phx-help.is-bad { color: #b91c1c; font-weight: 700; }

/* متن‌های کمکی سربرگ آدرس */
main form.phx-co .phx-chiprow {
  display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 14px;
}
main form.phx-co .phx-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 9.5px; font-weight: 800; color: #52657a;
  background: #f3f7fc; border: 1px solid #e6eef8;
  padding: 4px 9px; border-radius: 999px;
}
main form.phx-co .phx-chip b { color: #16283b; font-variant-numeric: tabular-nums; }
main form.phx-co .phx-chip.is-ok { color: #0d7a5f; background: #f1fcf7; border-color: #c9efdd; }

/* ردیف اعتماد زیر دکمه */
main form.phx-co .phx-trust {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  margin-top: 12px;
}
main form.phx-co .phx-trust div {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 9px 6px; border-radius: 12px;
  background: #f8fafc; border: 1px solid #eaf0f8;
  font-size: 9.5px; font-weight: 800; color: #52657a; text-align: center;
}
main form.phx-co .phx-trust svg { width: 15px; height: 15px; color: #2563eb; }

/* خلاصهٔ سفارش */
main form.phx-co .phx-sum-total {
  margin-top: 4px; padding: 12px 14px; border-radius: 14px;
  background: linear-gradient(135deg, #f4f8ff, #eef5ff);
  border: 1px solid #dbe8fb;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
main form.phx-co .phx-sum-total span:first-child {
  font-size: 12px; font-weight: 800; color: #33475e;
}
main form.phx-co .phx-sum-total .phx-total-num {
  font-size: 15px; font-weight: 900; color: #1d4ed8; font-variant-numeric: tabular-nums;
}

/* روش ارسال انتخاب‌شده در خلاصه */
.phx-sum-method {
  display: flex; align-items: center; gap: 6px;
  font-size: 10px; color: #5b6b7e; margin-top: 5px;
  padding-inline-start: 20px;
}
.phx-sum-method b { color: #16283b; font-weight: 800; }

/* ---------------------------------------------------------------------------
   ۲.۵) ستون خلاصهٔ سفارش: تا انتهای صفحه همراه اسکرول می‌آید
   --------------------------------------------------------------------------- */
@media (min-width: 1024px) {
  /* ستون خلاصه هم‌قدِ ستون فرم می‌شود تا کارت چسبان فضای حرکت داشته باشد */
  main form.phx-co > div:last-child { align-self: stretch; }
  main form.phx-co > div:last-child > div {
    position: sticky !important;
    top: 84px !important;
    max-height: calc(100vh - 104px);
    overflow-y: auto !important;
    overscroll-behavior: contain;
  }
  main form.phx-co > div:last-child > div::-webkit-scrollbar { width: 6px; }
  main form.phx-co > div:last-child > div::-webkit-scrollbar-thumb {
    background: #cfdcec; border-radius: 99px;
  }
  main form.phx-co > div:last-child > div::-webkit-scrollbar-track { background: transparent; }
}

/* ---------------------------------------------------------------------------
   ۳) حالت شب
   --------------------------------------------------------------------------- */
html.ph-night .phx-ship {
  background: linear-gradient(180deg, #101f2f, #0f1c2a);
  border-color: #23394f; box-shadow: none;
}
html.ph-night .phx-ship-head { border-bottom-color: #23394f; }
html.ph-night .phx-ship-head b { color: #e6eef8; }
html.ph-night .phx-ship-head i { color: #9fb3c8; }
html.ph-night .phx-field select {
  background-color: #13263b; border-color: #24384d; color: #e6eef8;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
}
html.ph-night .phx-m { background: #13263b; border-color: #24384d; }
html.ph-night .phx-m.is-on {
  background: linear-gradient(180deg, #16293f, #13263b); border-color: #3b6fc4;
  box-shadow: 0 0 0 1px #3b6fc4 inset;
}
html.ph-night .phx-m-tx b, html.ph-night .phx-m-cost { color: #e6eef8; }
html.ph-night .phx-m-tx i { color: #9fb3c8; }
html.ph-night .phx-m-eta { background: #1b3352; color: #a9c6f0; }
html.ph-night .phx-dot { background: #0f1c2a; border-color: #3b5069; }
html.ph-night .phx-bar { background: #1d3147; }
html.ph-night .phx-free { border-top-color: #23394f; }
html.ph-night .phx-empty { background: #0f1e2e; border-color: #24384d; color: #9fb3c8; }
html.ph-night main form.phx-co .glass:not(.phx-ship),
html.ph-night main form.phx-co > div > div:not(.phx-ship) {
  background: #101f2f !important; border-color: #23394f;
}
html.ph-night main form.phx-co .phx-card-head h2 { color: #e6eef8 !important; }
html.ph-night main form.phx-co label { color: #b9cbdd !important; }
html.ph-night main form.phx-co input,
html.ph-night main form.phx-co select,
html.ph-night main form.phx-co textarea {
  background: #13263b !important; border-color: #24384d !important; color: #e6eef8 !important;
}
html.ph-night main form.phx-co .phx-trust div { background: #13263b; border-color: #24384d; color: #b9cbdd; }
html.ph-night main form.phx-co .phx-sum-total { background: #13263b; border-color: #24384d; }
html.ph-night main form.phx-co .phx-sum-total span:first-child { color: #b9cbdd; }
html.ph-night main form.phx-co .phx-sum-total .phx-total-num { color: #7ea8f0; }

/* ---------------------------------------------------------------------------
   ۴) موبایل
   --------------------------------------------------------------------------- */
@media (min-width: 560px) {
  .phx-methods { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .phx-ship-head { padding: 11px 12px 9px; }
  .phx-ship-body { padding: 11px 12px 13px; }
  .phx-loc { grid-template-columns: 1fr; }
  .phx-m { grid-template-columns: 20px 1fr; row-gap: 6px; }
  .phx-m-cost { grid-column: 2; text-align: right; }
  .phx-methods { grid-template-columns: 1fr; }
  main form.phx-co .phx-trust { grid-template-columns: 1fr 1fr 1fr; gap: 5px; }
  main form.phx-co .phx-trust div { font-size: 9px; padding: 8px 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .phx-bar span, .phx-m, .phx-dot::after { transition: none !important; }
}
