/* Palo de Caballo — order form: unified phone field + micro-animations.
   Loaded ONLY via the order-form component, which renders only on Palo de
   Caballo product pages. Colors come from the per-hub --color-* bridge (the
   form lives inside .palo). Brand accent = button color; success = green. */

/* ───────── Field layout ───────── */
.pdc-field { position: relative; margin-bottom: 1.15rem; }

/* ───────── Name — floating label ───────── */
.pdc-field--float .pdc-input {
  width: 100%; padding: 1.18rem 2.4rem .5rem 1rem; font-size: 1rem;
  border: 1.5px solid var(--color-border, #d7dbe0); border-radius: var(--radius-md, 8px);
  background: #fff; color: var(--color-text, #1a1a2e);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.pdc-field--float .pdc-input:focus { outline: none; border-color: var(--color-accent, #C0392B); box-shadow: 0 0 0 3px rgba(0,0,0,.07); }
.pdc-field--float .pdc-float-label {
  position: absolute; left: 1rem; top: .92rem; font-size: 1rem; color: var(--color-text-muted, #6c757d);
  pointer-events: none; transform-origin: left top; transition: transform .2s ease, color .2s ease;
}
.pdc-field--float .pdc-input:focus + .pdc-float-label,
.pdc-field--float .pdc-input:not(:placeholder-shown) + .pdc-float-label {
  transform: translateY(-.66rem) scale(.74); color: var(--color-primary, #1a3a6e); font-weight: 700;
}
/* per-keystroke brand-color border pulse */
.pdc-input.pdc-typing { border-color: var(--color-accent, #C0392B); }
/* name invalid on submit */
.pdc-field--float.is-error .pdc-input { border-color: var(--color-accent, #C0392B); }

/* ───────── Green checkmark inside a field ───────── */
.pdc-check {
  position: absolute; right: .8rem; top: 50%; transform: translateY(-50%) scale(.5); opacity: 0;
  width: 20px; height: 20px; border-radius: 50%; background: var(--color-success, #2d8a4e); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 800;
  transition: opacity .15s ease, transform .15s ease; pointer-events: none;
}
.pdc-field--float.is-valid > .pdc-check,
.pdc-phone-wrap.is-valid > .pdc-check { opacity: 1; transform: translateY(-50%) scale(1); }

/* ───────── Phone — static label + +52 prefix outside the input ───────── */
.pdc-static-label { display: block; font-size: .85rem; font-weight: 700; margin-bottom: .35rem; color: var(--color-text, #1a1a2e); }
.pdc-phone-wrap {
  position: relative; display: flex; align-items: stretch;
  border: 1.5px solid var(--color-border, #d7dbe0); border-radius: var(--radius-md, 8px);
  background: #fff; transition: border-color .18s ease, box-shadow .18s ease;
}
.pdc-phone-prefix {
  display: inline-flex; align-items: center; padding: 0 .7rem 0 .95rem; font-weight: 800;
  color: var(--color-primary, #1a3a6e); background: var(--color-bg, #f5f7fa);
  border-right: 1px solid var(--color-border, #d7dbe0);
  border-radius: var(--radius-md, 8px) 0 0 var(--radius-md, 8px);
  opacity: .5; transition: opacity .2s ease; user-select: none;
}
.pdc-phone-input {
  flex: 1 1 auto; width: 100%; min-width: 0; border: 0; outline: none; background: transparent;
  padding: .85rem 2.2rem .85rem .85rem; font-size: 1rem; color: var(--color-text, #1a1a2e); letter-spacing: .03em;
}
.pdc-phone-wrap:focus-within { border-color: var(--color-accent, #C0392B); box-shadow: 0 0 0 3px rgba(0,0,0,.07); }
.pdc-phone-wrap:focus-within .pdc-phone-prefix { opacity: 1; }
.pdc-phone-wrap.is-valid { border-color: var(--color-success, #2d8a4e); }
.pdc-phone-wrap.is-error { border-color: var(--color-accent, #C0392B) !important; animation: pdc-shake .4s ease; }

/* per-digit pop on the input itself */
@keyframes pdc-pop { 0% { transform: scale(.985); } 100% { transform: scale(1); } }
.pdc-phone-input.pdc-pop { animation: pdc-pop .1s ease; }

/* one-shot pulse ring when the number becomes valid (10 digits) */
@keyframes pdc-pulse-ring { 0% { box-shadow: 0 0 0 0 rgba(45,138,78,.4); } 100% { box-shadow: 0 0 0 9px rgba(45,138,78,0); } }
.pdc-phone-wrap.pdc-pulse { animation: pdc-pulse-ring .9s ease; }

/* shake on submit error */
@keyframes pdc-shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }

/* inline error (phone) */
.pdc-field-error { color: var(--color-accent, #C0392B); font-size: .82rem; font-weight: 600; margin: .35rem 0 0; min-height: 1.1em; }

/* ───────── Submit button states ───────── */
@keyframes pdc-btn-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.03); } }
.pdc-order__btn.is-attn { animation: pdc-btn-pulse 2s ease-in-out infinite; }
.pdc-order__btn.is-ready { filter: saturate(1.2) brightness(1.05); }
.pdc-order__btn .pdc-arrow { display: inline-block; max-width: 0; opacity: 0; transform: translateX(-4px); transition: max-width .3s ease, opacity .3s ease, transform .3s ease; overflow: hidden; }
.pdc-order__btn.is-ready .pdc-arrow { max-width: 1.2em; opacity: 1; transform: translateX(0); }

/* ripple */
.pdc-ripple { position: absolute; border-radius: 50%; transform: scale(0); background: rgba(255,255,255,.5); animation: pdc-ripple .4s ease-out; pointer-events: none; }
@keyframes pdc-ripple { to { transform: scale(2.6); opacity: 0; } }

/* ───────── Reduced motion: keep states, drop motion ───────── */
@media (prefers-reduced-motion: reduce) {
  .pdc-phone-wrap.is-error,
  .pdc-phone-input.pdc-pop,
  .pdc-order__btn.is-attn,
  .pdc-phone-wrap.pdc-pulse { animation: none; }
  .pdc-ripple { display: none; }
  .pdc-field--float .pdc-float-label,
  .pdc-order__btn .pdc-arrow { transition: none; }
}
