/* =========================================================================
   نوار «ارسال رایگان» RHÉA — inc/free-shipping.php ، assets/js/rhea-fs.js
   شیشه‌ی روشن، پر شدن سرمه‌ای، جعبه‌ی زرشکی مقصد، ستاره‌های طلایی در رسیدن
   ========================================================================= */
.rhea-fs-wrap { position: relative; z-index: 25; max-width: 1180px; margin: 0 auto; padding: 8px 16px 2px; direction: rtl; }
@media (min-width: 1024px) { .rhea-fs-wrap .rhea-fs { max-width: 760px; margin: 0 auto; } }

.rhea-fs {
  --fs-n: #13273f; --fs-n2: #1f3a5c; --fs-b: #4e0000; --fs-iv: #fdfbf7;
  --fs-e: cubic-bezier(.16, 1, .3, 1);
  position: relative; padding: 10px 16px 12px; border-radius: 18px; direction: rtl; text-align: right;
  font-family: 'Noto Naskh Arabic', Tahoma, sans-serif; color: var(--fs-n);
  background: linear-gradient(160deg, rgba(255, 255, 255, .74), rgba(255, 255, 255, .46));
  border: 1px solid rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%);
  box-shadow: inset 0 1px 0 #fff, 0 14px 26px -20px rgba(19, 39, 63, .55);
}
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) { .rhea-fs { background: rgba(250, 249, 247, .96); } }
.rhea-fs__t { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; font-weight: 700; line-height: 1.7; }
.rhea-fs__t b { color: var(--fs-n); font-weight: 800; transition: color .4s ease; }
.rhea-fs.is-close .rhea-fs__t b { color: var(--fs-b); }
.rhea-fs__m { flex: 0 0 auto; font-size: 10.5px; font-weight: 600; color: rgba(19, 39, 63, .55); white-space: nowrap; }
.rhea-fs__track { position: relative; height: 9px; margin: 13px 4px 3px 34px; border-radius: 99px; background: rgba(19, 39, 63, .09); box-shadow: inset 0 1px 2px rgba(19, 39, 63, .14); }
.rhea-fs__fill {
  position: absolute; top: 0; right: 0; bottom: 0; border-radius: 99px; overflow: hidden;
  background: linear-gradient(270deg, #24466f, var(--fs-n));
  box-shadow: 0 0 12px rgba(36, 70, 111, .45), 0 0 2px rgba(243, 223, 174, .6);
  transition: width 1.1s var(--fs-e);
}
/* اکلیل: ذره‌های ریز طلایی و سفید که آرام در طول نوار جریان دارند */
.rhea-fs__fill::before {
  content: ""; position: absolute; inset: 0; opacity: .9;
  background-image:
    radial-gradient(circle, rgba(255, 246, 220, .95) 0 .7px, transparent 1.2px),
    radial-gradient(circle, rgba(230, 201, 138, .9) 0 .8px, transparent 1.3px),
    radial-gradient(circle, rgba(255, 255, 255, .7) 0 .5px, transparent 1px);
  background-size: 13px 9px, 21px 9px, 8px 9px; background-position: 0 2px, 6px 6px, 3px 4px;
  animation: rhea-fs-glit 6s linear infinite;
}
/* برق نوری که هر چند ثانیه از روی نوار رد می‌شود */
.rhea-fs__fill::after {
  content: ""; position: absolute; inset: -2px 0;
  background: linear-gradient(100deg, transparent 42%, rgba(255, 250, 235, .85) 50%, transparent 58%) no-repeat;
  background-size: 300% 100%; background-position: 150% 0;
  animation: rhea-fs-sweep 3.2s cubic-bezier(.45, 0, .2, 1) infinite;
}
@keyframes rhea-fs-glit { to { background-position: -130px 2px, -84px 6px, -48px 4px; } }
@keyframes rhea-fs-sweep { 0%, 35% { background-position: 150% 0; } 100% { background-position: -50% 0; } }
/* چشمک‌های تکی روی بخش پرشده (با JS اضافه می‌شوند) */
.rhea-fs__spark {
  position: absolute; top: 50%; width: 9px; height: 9px; margin: -4.5px -4.5px 0 0; pointer-events: none; opacity: 0; z-index: 1;
  background: radial-gradient(circle, #fffaf0, #f3dfae 40%, #c5a059 75%);
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  transition: right 1.1s var(--fs-e);
  animation: rhea-fs-twk 2.6s ease-in-out infinite;
}
@keyframes rhea-fs-twk { 0%, 100% { opacity: 0; transform: scale(.2) rotate(0); } 45% { opacity: 1; transform: scale(1) rotate(45deg); } 70% { opacity: 0; transform: scale(.4) rotate(90deg); } }
.rhea-fs.is-empty .rhea-fs__spark { display: none; }
.rhea-fs__knob {
  position: absolute; top: 50%; width: 26px; height: 26px; margin-right: -13px; transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center; border-radius: 50%;
  background: var(--fs-iv); border: 1.5px solid var(--fs-n); color: var(--fs-n);
  box-shadow: 0 6px 12px -6px rgba(19, 39, 63, .7);
  transition: right 1.1s var(--fs-e), background-color .4s ease, color .4s ease;
}
/* هاله‌ی طلایی ملایم دور کامیون */
.rhea-fs__knob::before { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 1px solid rgba(197, 160, 89, .7); animation: rhea-fs-halo 2.4s ease-out infinite; pointer-events: none; }
@keyframes rhea-fs-halo { 0% { transform: scale(.8); opacity: .9; } 100% { transform: scale(1.45); opacity: 0; } }
.rhea-fs.is-empty .rhea-fs__knob::before { animation: none; opacity: 0; }
.rhea-fs__knob { z-index: 2; }
.rhea-fs__knob svg { width: 14px; height: 14px; }
.rhea-fs__truck { transform: scaleX(-1); }
.rhea-fs__check { display: none; }
.rhea-fs.is-done .rhea-fs__truck { display: none; }
.rhea-fs.is-done .rhea-fs__check { display: block; }
.rhea-fs.is-done .rhea-fs__knob { background: var(--fs-n); color: var(--fs-iv); }
.rhea-fs__dest {
  position: absolute; top: 50%; left: -34px; width: 26px; height: 26px; transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center; border-radius: 8px;
  background: linear-gradient(165deg, #6a0a14, var(--fs-b)); box-shadow: 0 8px 14px -8px rgba(78, 0, 0, .9);
  transition: opacity .4s ease, transform .4s ease;
}
.rhea-fs__dest { overflow: hidden; }
.rhea-fs__dest::after { content: ""; position: absolute; inset: -10px; background: linear-gradient(115deg, transparent 40%, rgba(255, 240, 210, .6) 50%, transparent 60%); animation: rhea-fs-glint 4.5s ease-in-out infinite; }
@keyframes rhea-fs-glint { 0%, 70% { transform: translateX(40px); } 100% { transform: translateX(-40px); } }
.rhea-fs__dest svg { position: relative; z-index: 1; width: 16px; height: 16px; }
.rhea-fs.is-done .rhea-fs__dest { opacity: 0; transform: translateY(-50%) scale(.6); }
.rhea-fs.is-pulse { animation: rhea-fs-pulse 1.1s ease; }
@keyframes rhea-fs-pulse {
  0% { box-shadow: inset 0 1px 0 #fff, 0 0 0 0 rgba(19, 39, 63, 0); }
  35% { box-shadow: inset 0 1px 0 #fff, 0 0 0 6px rgba(19, 39, 63, .12); }
  100% { box-shadow: inset 0 1px 0 #fff, 0 14px 26px -20px rgba(19, 39, 63, .55); }
}

/* داخل پاپ‌آپ سبد خرید */
.rhea-fs-cart { margin: 0 0 12px; }
.rhea-fs--cart { padding: 9px 14px 11px; }
.rhea-fs-sug {
  display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 8px; border-radius: 16px; direction: rtl;
  background: rgba(255, 255, 255, .78); border: 1px dashed rgba(19, 39, 63, .2);
  font-family: 'Noto Naskh Arabic', Tahoma, sans-serif; color: #13273f;
}
.rhea-fs-sug[hidden] { display: none; }
.rhea-fs-sug__img { flex: 0 0 40px; aspect-ratio: 3 / 4; border-radius: 9px; overflow: hidden; background: #f1ece4; }
.rhea-fs-sug__img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.rhea-fs-sug__t { flex: 1; min-width: 0; font-size: 10.5px; line-height: 1.75; color: rgba(19, 39, 63, .7); }
.rhea-fs-sug__t a { display: block; overflow: hidden; color: #13273f; font-size: 11.5px; font-weight: 800; text-decoration: none; white-space: nowrap; text-overflow: ellipsis; }
.rhea-fs-sug__t em { font-style: normal; font-weight: 800; color: #4e0000; }
.rhea-fs-sug__btn {
  flex: 0 0 auto; height: 32px; padding: 0 12px; border: 0; border-radius: 999px; cursor: pointer;
  background: #13273f; color: #fdfbf7; font: inherit; font-size: 11px; font-weight: 800;
  box-shadow: 0 10px 18px -10px rgba(19, 39, 63, .9); transition: transform .3s ease, opacity .3s ease;
}
.rhea-fs-sug__btn:hover { transform: translateY(-1px); }
.rhea-fs-sug__btn[disabled] { opacity: .55; cursor: wait; }

/* کپسول باریک بالای صفحه: وقتی نوار اصلی با اسکرول از دید خارج شد */
.rhea-fs-pill {
  position: fixed; z-index: 60; top: calc(10px + env(safe-area-inset-top, 0px)); left: 50%;
  width: calc(100% - 28px); max-width: 520px; pointer-events: none;
  opacity: 0; transform: translate(-50%, -140%);
  transition: transform .55s cubic-bezier(.16, 1, .3, 1), opacity .4s ease;
}
.rhea-fs-pill.is-show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.rhea-fs-pill .rhea-fs { padding: 7px 14px 8px; border-radius: 999px; background: rgba(253, 251, 247, .86); box-shadow: 0 12px 24px -16px rgba(19, 39, 63, .7); }
.rhea-fs-pill .rhea-fs__t { font-size: 11px; line-height: 1.6; }
.rhea-fs-pill .rhea-fs__track { height: 5px; margin: 6px 2px 1px 2px; }
.rhea-fs-pill .rhea-fs__dest, .rhea-fs-pill .rhea-fs__knob, .rhea-fs-pill .rhea-fs__spark { display: none; }
html.rcmp-lock .rhea-fs-pill { opacity: 0; transform: translate(-50%, -140%); }

/* ستاره‌های طلایی: اول کمی بالا می‌روند و در هوا پخش می‌شوند، بعد با تاب ملایم آرام می‌ریزند */
.rhea-fs-stars { position: fixed; z-index: 2147483000; /* روی پاپ‌آپ سبد خرید هم دیده شوند */ pointer-events: none; overflow: visible; }
.rhea-fs-stars i {
  position: absolute; top: 0; width: var(--s); height: var(--s); opacity: 0;
  background: radial-gradient(circle at 40% 35%, #fff6dc, #e6c98a 35%, #c5a059 70%);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  filter: drop-shadow(0 0 3px rgba(230, 201, 138, .85));
  animation: rhea-fs-bloom var(--d) linear var(--dl) forwards;
}
@keyframes rhea-fs-bloom {
  0%   { opacity: 0; transform: translate(0, 0) rotate(0) scale(.2); animation-timing-function: cubic-bezier(.2, .7, .3, 1); }
  14%  { opacity: 1; transform: translate(calc(var(--x1) * .6), calc(var(--y1) * .6)) rotate(calc(var(--r) * .15)) scale(1); animation-timing-function: cubic-bezier(.2, .7, .3, 1); }
  36%  { opacity: 1; transform: translate(var(--x1), var(--y1)) rotate(calc(var(--r) * .3)) scale(1.05); animation-timing-function: ease-in-out; }
  50%  { opacity: 1; transform: translate(calc(var(--x1) + var(--sw)), calc(var(--y1) + 8px)) rotate(calc(var(--r) * .4)) scale(.95); animation-timing-function: cubic-bezier(.45, 0, .55, 1); }
  75%  { opacity: .9; transform: translate(calc(var(--x2) - var(--sw)), calc(var(--y2) * .6)) rotate(calc(var(--r) * .75)) scale(.9); animation-timing-function: cubic-bezier(.45, 0, .55, 1); }
  100% { opacity: 0; transform: translate(var(--x2), var(--y2)) rotate(var(--r)) scale(.75); }
}
@media (prefers-reduced-motion: reduce) {
  .rhea-fs__fill, .rhea-fs__knob, .rhea-fs__spark, .rhea-fs-pill { transition: none; }
  .rhea-fs__fill::before, .rhea-fs__fill::after, .rhea-fs__spark, .rhea-fs__knob::before, .rhea-fs__dest::after { animation: none; }
  .rhea-fs.is-pulse { animation: none; }
  .rhea-fs-stars { display: none; }
}
