/* Sahler — rok isporuke (Poručeno → Poslato → Isporuka). Učitava se na svim stranama (i fioka korpe).
 * Boje i fontovi su promenljive iz style.css dizajna. Ikonice: Icons8 forma-light (PNG kao maska).
 * Animacija kreće kad blok uđe u ekran (.is-in); .is-static = odmah konačno stanje (AJAX osvežavanje, smanjeno kretanje). */

.sahler-eta { --eta-ico: 46px; position: relative; display: grid; gap: 14px; margin: 0; padding: 20px 22px 22px; border: 1px solid var(--line); border-radius: 14px;
  background: linear-gradient(135deg, rgba(255,45,45,.07), transparent 46%), rgba(255,255,255,.025); color: var(--steel); font-size: .9rem; line-height: 1.45; overflow: hidden; }
.sahler-eta p { margin: 0; }
.sahler-eta b { color: var(--ink); font-weight: 600; }
.sahler-eta__lead b, .sahler-eta__cut b { white-space: nowrap; }

.sahler-eta__lead { display: flex; align-items: flex-start; gap: 10px; color: var(--ink-2); }
.sahler-eta__clock { flex: 0 0 20px; width: 20px; height: 20px; margin-top: 1px; background-color: var(--ink);
  -webkit-mask: url(../img/icons/eta-clock.png) center / contain no-repeat; mask: url(../img/icons/eta-clock.png) center / contain no-repeat; }

.sahler-eta__cut { display: flex; align-items: center; gap: 9px; justify-self: start; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.03); font-size: .8rem; }
.sahler-eta__cut:empty { display: none; }
.sahler-eta__cut.is-today { border-color: rgba(255,45,45,.35); background: rgba(255,45,45,.08); color: var(--ink-2); }
.sahler-eta__dot { position: relative; flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--tail); box-shadow: 0 0 10px var(--tail-glow); }
.sahler-eta__dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1px solid var(--tail); animation: eta-ping 1.8s cubic-bezier(.2, .6, .4, 1) infinite; }

/* Linija: ikonice su na levoj ivici, sredini i desnoj ivici, traka ide od centra prve do centra poslednje. */
.sahler-eta__line { position: relative; margin-top: 6px; }
.sahler-eta__track { position: absolute; left: calc(var(--eta-ico) / 2); right: calc(var(--eta-ico) / 2); top: calc(var(--eta-ico) / 2 - 1px); height: 2px; border-radius: 2px;
  background: repeating-linear-gradient(90deg, var(--line-2) 0 6px, transparent 6px 11px); overflow: hidden; }
.sahler-eta__fill { position: absolute; top: 0; bottom: 0; width: 50%; transform: scaleX(0); transform-origin: left center; }
.sahler-eta__fill--a { left: 0; background: linear-gradient(90deg, var(--ink-2), var(--tail)); }
.sahler-eta__fill--b { left: 50%; background: linear-gradient(90deg, var(--tail), var(--tail-deep)); }
/* Svetlo koje putuje niz liniju (pošiljka na putu). */
.sahler-eta__track::after { content: ""; position: absolute; top: -3px; bottom: -3px; left: 0; width: 70px; opacity: 0;
  background: radial-gradient(closest-side, rgba(255,255,255,.95), rgba(255,120,120,.5) 45%, transparent); filter: blur(.5px); }

.sahler-eta__steps { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; }
.sahler-eta__step { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; margin: 0; padding: 0; list-style: none; }
.sahler-eta__step::before { content: none !important; }
.sahler-eta__step--ship { align-items: center; text-align: center; }
.sahler-eta__step--home { align-items: flex-end; text-align: right; }
.sahler-eta__step b { margin-top: 10px; font-size: .84rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sahler-eta__step--home b span { display: inline-block; }
.sahler-eta__lbl { color: var(--steel); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }

.sahler-eta__ico { position: relative; display: grid; place-items: center; width: var(--eta-ico); height: var(--eta-ico); border-radius: 50%;
  border: 1px solid var(--line-2); background: var(--carbon-2, #15171b); box-shadow: 0 0 0 5px var(--carbon, #0d0e11); }
.sahler-eta__ico::before { content: ""; width: 46%; height: 46%; background-color: var(--ink); -webkit-mask: var(--eta-i) center / contain no-repeat; mask: var(--eta-i) center / contain no-repeat; }
.sahler-eta__ico::after { content: ""; position: absolute; inset: -1px; border-radius: 50%; border: 1px solid var(--tail); opacity: 0; }
.sahler-eta__step--order .sahler-eta__ico { --eta-i: url(../img/icons/eta-ordered.png); }
.sahler-eta__step--ship .sahler-eta__ico { --eta-i: url(../img/icons/in-transit.png); }
.sahler-eta__step--home .sahler-eta__ico { --eta-i: url(../img/icons/eta-delivered.png); }

/* ——— Animacija ——— */
.sahler-eta__lead, .sahler-eta__cut { opacity: 0; transform: translateY(8px); transition: opacity .5s ease, transform .6s var(--ease-out, ease); }
.sahler-eta__cut { transition-delay: .08s; }
.sahler-eta__ico { opacity: 0; transform: scale(.55); transition: opacity .35s ease, transform .6s cubic-bezier(.3, 1.6, .5, 1), border-color .4s, background-color .4s; }
.sahler-eta__step b, .sahler-eta__lbl { opacity: 0; transform: translateY(6px); transition: opacity .45s ease, transform .5s var(--ease-out, ease); }
.sahler-eta__fill { transition: transform .75s cubic-bezier(.55, 0, .35, 1); }

.sahler-eta.is-in .sahler-eta__lead, .sahler-eta.is-in .sahler-eta__cut,
.sahler-eta.is-in .sahler-eta__ico, .sahler-eta.is-in .sahler-eta__step b, .sahler-eta.is-in .sahler-eta__lbl { opacity: 1; transform: none; }
.sahler-eta.is-in .sahler-eta__fill { transform: scaleX(1); }

.sahler-eta.is-in .sahler-eta__step--order .sahler-eta__ico { transition-delay: .15s; }
.sahler-eta.is-in .sahler-eta__step--order b, .sahler-eta.is-in .sahler-eta__step--order .sahler-eta__lbl { transition-delay: .3s; }
.sahler-eta.is-in .sahler-eta__fill--a { transition-delay: .45s; }
.sahler-eta.is-in .sahler-eta__step--ship .sahler-eta__ico { transition-delay: 1.05s; }
.sahler-eta.is-in .sahler-eta__step--ship b, .sahler-eta.is-in .sahler-eta__step--ship .sahler-eta__lbl { transition-delay: 1.2s; }
.sahler-eta.is-in .sahler-eta__fill--b { transition-delay: 1.3s; }
.sahler-eta.is-in .sahler-eta__step--home .sahler-eta__ico { transition-delay: 1.9s; }
.sahler-eta.is-in .sahler-eta__step--home b, .sahler-eta.is-in .sahler-eta__step--home .sahler-eta__lbl { transition-delay: 2.05s; }

/* Kad linija stigne do koraka, krug dobija crveni obod; kamion je crven, odredište dobija sjaj. */
.sahler-eta.is-in .sahler-eta__ico { border-color: rgba(255,45,45,.45); }
.sahler-eta.is-in .sahler-eta__step--ship .sahler-eta__ico::before { background-color: var(--tail); animation: eta-drive 3.2s ease-in-out 2.6s infinite; }
.sahler-eta.is-in .sahler-eta__step--home .sahler-eta__ico { border-color: var(--tail); background: radial-gradient(circle at 50% 40%, rgba(255,45,45,.22), var(--carbon-2, #15171b) 70%); box-shadow: 0 0 0 5px var(--carbon, #0d0e11), 0 0 26px -6px var(--tail-glow); }
.sahler-eta.is-in .sahler-eta__step--home .sahler-eta__ico::before { animation: eta-drop .7s cubic-bezier(.3, 1.5, .5, 1) 1.9s both; }
.sahler-eta.is-in .sahler-eta__step--home .sahler-eta__ico::after { animation: eta-ring 1.4s ease-out 2.1s 2; }
.sahler-eta.is-in .sahler-eta__track::after { animation: eta-travel 3.2s cubic-bezier(.45, 0, .25, 1) 2.6s infinite; }

@keyframes eta-ping { 0% { transform: scale(1); opacity: .9; } 80%, 100% { transform: scale(2.6); opacity: 0; } }
@keyframes eta-ring { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(1.55); opacity: 0; } }
@keyframes eta-drop { 0% { transform: translateY(-14px) scale(.6); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; opacity: 1; } }
@keyframes eta-drive {
  0%, 52%, 100% { transform: translateX(0); }
  8% { transform: translateX(2px) translateY(-1px); } 14% { transform: translateX(-1px); }
  20% { transform: translateX(1px) translateY(-.5px); } 26% { transform: translateX(0); }
}
@keyframes eta-travel { 0% { left: -70px; opacity: 0; } 12% { opacity: 1; } 80% { opacity: 1; } 100% { left: 100%; opacity: 0; } }

/* Konačno stanje bez animacije. */
.sahler-eta.is-static *, .sahler-eta.is-static *::before, .sahler-eta.is-static *::after { transition: none !important; }
.sahler-eta.is-static .sahler-eta__step--home .sahler-eta__ico::before, .sahler-eta.is-static .sahler-eta__step--home .sahler-eta__ico::after { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .sahler-eta *, .sahler-eta *::before, .sahler-eta *::after { animation: none !important; transition: none !important; }
}

/* ——— Mesta ——— */
.pp-summary .sahler-eta { margin-top: 4px; }
.wc-proceed-to-checkout .sahler-eta { margin-bottom: 18px; text-align: left; }
.woocommerce-checkout #order_review > .sahler-eta, .woocommerce-checkout .sahler-eta { margin: 4px 0 20px; }

/* Fioka korpe: manja varijanta, bez okvira, između ukupnog iznosa i dugmadi. */
.sahler-eta--compact { --eta-ico: 36px; gap: 10px; margin: 0; padding: 4px 24px 18px; border: 0; border-radius: 0; background: rgba(255,255,255,.02); font-size: .8rem; }
.sahler-eta--compact .sahler-eta__clock { flex-basis: 16px; width: 16px; height: 16px; }
.sahler-eta--compact .sahler-eta__cut { padding: 4px 10px; font-size: .74rem; }
.sahler-eta--compact .sahler-eta__line { margin-top: 2px; }
.sahler-eta--compact .sahler-eta__step b { margin-top: 7px; font-size: .74rem; }
.sahler-eta--compact .sahler-eta__lbl { font-size: 10px; }
.sahler-eta--compact .sahler-eta__ico { box-shadow: 0 0 0 4px #101114; }

@media (max-width: 480px) {
  .sahler-eta { --eta-ico: 40px; padding: 16px 16px 18px; font-size: .84rem; }
  .sahler-eta__cut { border-radius: 12px; }
  .sahler-eta__step b { font-size: .76rem; }
  .sahler-eta__step--home b { white-space: normal; }
  .sahler-eta__lbl { font-size: 10px; letter-spacing: .08em; }
  .sahler-eta--compact { --eta-ico: 34px; padding: 4px 18px 16px; }
  .sahler-eta--compact .sahler-eta__cut { border-radius: 10px; }
}
@media (max-width: 360px) {
  .sahler-eta__step b { font-size: .7rem; white-space: normal; }
}
