/* Ally4Health cart UI.
   Separate from styles.css so the cart can be added or rolled back without
   touching the stylesheet every other page depends on.
   Uses the existing design tokens (gold / teal / cream) defined in styles.css. */

/* An author `display` rule beats the UA stylesheet's [hidden]{display:none}.
   Several elements here are flex, so without this the drawer never closes and
   the cart button shows while empty. Scoped to the parts this file styles. */
.cart-root [hidden],
[hidden].cart-fab,
[hidden].cart-scrim,
[hidden].cart-panel,
[hidden].cart-toast,
.oc-wrap [hidden]{display:none !important}

/* ---------- product card additions ---------- */

.prod-flag{
  display:block;
  font-size:.72rem;
  line-height:1.35;
  color:var(--text-soft);
  margin-bottom:8px;
  font-weight:600;
  letter-spacing:.01em;
}

/* ---------- floating cart button ---------- */

.cart-fab{
  position:fixed;
  right:20px;
  bottom:20px;
  z-index:1200;
  display:inline-flex;
  align-items:center;
  gap:9px;
  padding:14px 22px;
  border:0;
  border-radius:40px;
  cursor:pointer;
  font-size:.95rem;
  font-weight:700;
  color:#fff;
  background:var(--teal);
  box-shadow:0 10px 30px rgba(28,93,90,.34);
  transition:transform .25s,box-shadow .25s;
}
.cart-fab:hover{transform:translateY(-3px);box-shadow:0 18px 40px rgba(28,93,90,.44)}
.cart-fab-n{
  min-width:23px;
  height:23px;
  padding:0 6px;
  border-radius:14px;
  background:var(--gold);
  color:#fff;
  font-size:.8rem;
  line-height:23px;
  text-align:center;
}

/* ---------- scrim + panel ---------- */

.cart-scrim{
  position:fixed;
  inset:0;
  z-index:1300;
  background:rgba(42,45,46,.42);
  backdrop-filter:blur(2px);
}

.cart-panel{
  position:fixed;
  top:0;
  right:0;
  z-index:1301;
  width:min(420px,100vw);
  height:100%;
  display:flex;
  flex-direction:column;
  background:var(--cream);
  box-shadow:-18px 0 50px rgba(42,45,46,.18);
}

.cart-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:20px 22px;
  border-bottom:1px solid var(--line);
  background:var(--white);
}
.cart-head h2{
  margin:0;
  font-size:1.15rem;
  font-family:Georgia,serif;
  color:var(--teal-deep);
}
.cart-x{
  border:1px solid var(--line);
  background:var(--white);
  color:var(--teal-deep);
  border-radius:40px;
  padding:8px 16px;
  font-size:.82rem;
  font-weight:600;
  cursor:pointer;
}
.cart-x:hover{background:var(--gold-pale)}

.cart-body{
  flex:1;
  overflow-y:auto;
  padding:14px 22px;
}
.cart-empty{
  color:var(--text-soft);
  text-align:center;
  padding:44px 0;
  font-size:.92rem;
}

/* ---------- rows ---------- */

.cart-row{
  display:grid;
  grid-template-columns:62px 1fr auto;
  gap:12px;
  align-items:start;
  padding:14px 0;
  border-bottom:1px solid var(--line);
}
.cart-thumb{
  width:62px;
  height:62px;
  border-radius:10px;
  object-fit:cover;
  background:var(--warm);
  border:1px solid var(--line);
}
.cart-info{display:flex;flex-direction:column;gap:3px;min-width:0}
.cart-name{
  font-size:.85rem;
  font-weight:600;
  color:var(--charcoal);
  line-height:1.3;
}
.cart-price{font-size:.78rem;color:var(--text-soft)}
.cart-lineamt{
  font-size:.9rem;
  font-weight:700;
  color:var(--teal-deep);
  white-space:nowrap;
}

.cart-qty{display:flex;align-items:center;gap:7px;margin-top:5px}
.cart-qty button{
  width:27px;
  height:27px;
  border-radius:8px;
  border:1px solid var(--line);
  background:var(--white);
  color:var(--teal-deep);
  font-size:1rem;
  font-weight:700;
  line-height:1;
  cursor:pointer;
}
.cart-qty button:hover{background:var(--gold-pale)}
.cart-qty span{
  min-width:22px;
  text-align:center;
  font-size:.85rem;
  font-weight:600;
}
.cart-del{
  width:auto !important;
  padding:0 9px;
  font-size:.72rem !important;
  font-weight:600 !important;
  color:var(--text-soft) !important;
  margin-left:4px;
}

/* ---------- footer ---------- */

.cart-foot{
  padding:18px 22px 22px;
  border-top:1px solid var(--line);
  background:var(--white);
}
.cart-line{
  display:flex;
  align-items:center;
  justify-content:space-between;
  font-size:1rem;
  margin-bottom:4px;
}
.cart-line strong{color:var(--teal-deep);font-size:1.15rem}
.cart-fine{
  font-size:.75rem;
  color:var(--text-soft);
  margin:0 0 14px;
}
.cart-go{width:100%}
.cart-go:disabled{opacity:.5;cursor:not-allowed;transform:none}
.cart-err{
  margin:12px 0 0;
  padding:11px 13px;
  border-radius:10px;
  background:#FBEAE7;
  border:1px solid #E8C4BD;
  color:#8A2F1E;
  font-size:.8rem;
  line-height:1.45;
}
.cart-clear{
  display:block;
  margin:12px auto 0;
  border:0;
  background:none;
  color:var(--text-soft);
  font-size:.78rem;
  text-decoration:underline;
  cursor:pointer;
}

/* ---------- toast ---------- */

.cart-toast{
  position:fixed;
  left:50%;
  bottom:26px;
  transform:translateX(-50%);
  z-index:1400;
  padding:12px 22px;
  border-radius:40px;
  background:var(--teal-deep);
  color:#fff;
  font-size:.86rem;
  font-weight:600;
  box-shadow:0 12px 32px rgba(18,63,61,.34);
}

/* ---------- small screens ---------- */

@media (max-width:520px){
  .cart-panel{width:100vw}
  .cart-fab{right:14px;bottom:14px;padding:12px 18px}
  .cart-toast{bottom:78px;font-size:.8rem;padding:10px 18px}
}

/* ---------- motion ---------- */

@keyframes cartIn{from{transform:translateX(100%)}to{transform:translateX(0)}}
@keyframes cartFade{from{opacity:0}to{opacity:1}}
@keyframes cartRise{from{opacity:0;transform:translate(-50%,10px)}to{opacity:1;transform:translate(-50%,0)}}
@keyframes cartPop{0%{transform:scale(1)}45%{transform:scale(1.18)}100%{transform:scale(1)}}

.cart-panel:not([hidden]){animation:cartIn .32s cubic-bezier(.22,1,.36,1)}
.cart-scrim:not([hidden]){animation:cartFade .28s ease}
.cart-toast:not([hidden]){animation:cartRise .3s cubic-bezier(.22,1,.36,1)}
.cart-fab-n.is-bumped{animation:cartPop .42s cubic-bezier(.22,1,.36,1)}

/* ---------- order confirmation ---------- */

.oc-wrap{padding:44px 0 76px}

.oc-state{
  text-align:center;
  padding:70px 20px;
  color:var(--text-soft);
}
.oc-spinner{
  width:34px;
  height:34px;
  margin:0 auto 18px;
  border-radius:50%;
  border:3px solid var(--line);
  border-top-color:var(--gold);
  animation:cartSpin .8s linear infinite;
}
@keyframes cartSpin{to{transform:rotate(360deg)}}

.oc-hero{text-align:center;max-width:660px;margin:0 auto 40px}
.oc-badge{
  display:inline-block;
  padding:7px 17px;
  border-radius:40px;
  background:var(--sage-soft);
  color:var(--teal-deep);
  font-size:.76rem;
  font-weight:700;
  letter-spacing:.06em;
  text-transform:uppercase;
  margin-bottom:16px;
}
.oc-badge-warn{background:var(--gold-pale);color:#7A5A12}
.oc-hero h1{
  font-family:Georgia,serif;
  color:var(--teal-deep);
  font-size:clamp(1.7rem,4vw,2.5rem);
  line-height:1.18;
  margin:0 0 14px;
}
.oc-lede{color:var(--text-soft);font-size:1.02rem;line-height:1.6;margin:0}
.oc-lede strong{color:var(--charcoal)}

.oc-grid{
  display:grid;
  grid-template-columns:1.35fr 1fr;
  gap:22px;
  align-items:start;
  max-width:920px;
  margin:0 auto;
}
.oc-side{display:flex;flex-direction:column;gap:22px}

.oc-card{
  background:var(--white);
  border:1px solid var(--line);
  border-radius:16px;
  padding:24px 26px;
  box-shadow:var(--shadow);
}
.oc-card h2{
  font-family:Georgia,serif;
  font-size:1.05rem;
  color:var(--teal-deep);
  margin:0 0 16px;
}

.oc-items{list-style:none;margin:0 0 18px;padding:0}
.oc-items li{
  display:flex;
  justify-content:space-between;
  gap:16px;
  padding:11px 0;
  border-bottom:1px solid var(--line);
  font-size:.9rem;
}
.oc-iname{color:var(--charcoal);line-height:1.4}
.oc-q{color:var(--text-soft);font-weight:600}
.oc-iamt{font-weight:700;color:var(--teal-deep);white-space:nowrap}

.oc-totals{margin:0}
.oc-totals div{
  display:flex;
  justify-content:space-between;
  gap:16px;
  padding:7px 0;
  font-size:.9rem;
}
.oc-totals dt{color:var(--text-soft)}
.oc-totals dd{margin:0;font-weight:600;color:var(--charcoal)}
.oc-grand{
  margin-top:8px;
  padding-top:14px !important;
  border-top:2px solid var(--line);
}
.oc-grand dt{color:var(--charcoal) !important;font-weight:700;font-size:1rem}
.oc-grand dd{color:var(--teal-deep) !important;font-size:1.25rem;font-weight:700}

.oc-ship address{font-style:normal;line-height:1.6;font-size:.9rem;color:var(--text)}
.oc-ship address span{display:block}

.oc-steps{margin:0;padding-left:20px;color:var(--text-soft);font-size:.87rem;line-height:1.6}
.oc-steps li{margin-bottom:10px}
.oc-steps li:last-child{margin-bottom:0}
.oc-steps strong{color:var(--charcoal)}
.oc-steps a{color:var(--teal);font-weight:600}

.oc-actions{
  display:flex;
  gap:12px;
  justify-content:center;
  flex-wrap:wrap;
  margin-top:38px;
}

@media (max-width:820px){
  .oc-grid{grid-template-columns:1fr;max-width:560px}
}

/* ---------- embedded checkout page ---------- */

.co-head{text-align:center;max-width:620px;margin:0 auto 30px}
.co-head h1{
  font-family:Georgia,serif;
  color:var(--teal-deep);
  font-size:clamp(1.6rem,3.6vw,2.2rem);
  margin:0 0 10px;
}

.co-state{
  text-align:center;
  padding:56px 20px;
  color:var(--text-soft);
  max-width:560px;
  margin:0 auto;
}
.co-state h2{
  font-family:Georgia,serif;
  color:var(--teal-deep);
  font-size:1.25rem;
  margin:0 0 12px;
}

/* ---- destination step ---- */

.co-dest{max-width:520px;margin:0 auto}
.co-destcard{text-align:left}
.co-label{
  display:block;
  font-size:.8rem;
  font-weight:600;
  color:var(--text-soft);
  margin-bottom:7px;
}
.co-select{
  width:100%;
  padding:13px 14px;
  border:1px solid var(--line);
  border-radius:10px;
  background:var(--white);
  color:var(--charcoal);
  font-size:.95rem;
  font-family:inherit;
}
.co-select:focus{outline:2px solid var(--gold-soft);outline-offset:1px}
.co-quote{
  margin:14px 0 0;
  padding:12px 14px;
  border-radius:10px;
  background:var(--sage-soft);
  color:var(--teal-deep);
  font-size:.88rem;
  font-weight:600;
}
.co-continue{width:100%;margin-top:16px}
.co-continue:disabled{opacity:.5;cursor:not-allowed;transform:none}

/* ---- shipping summary above the payment form ---- */

.co-shipbar{
  max-width:900px;
  margin:0 auto 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  flex-wrap:wrap;
  padding:12px 18px;
  border-radius:12px;
  background:var(--sage-soft);
  color:var(--teal-deep);
  font-size:.88rem;
}
.co-change{
  border:1px solid rgba(28,93,90,.25);
  background:var(--white);
  color:var(--teal-deep);
  border-radius:40px;
  padding:7px 15px;
  font-size:.8rem;
  font-weight:600;
  cursor:pointer;
}
.co-change:hover{background:var(--gold-pale)}

/* Stripe mounts its iframe here. Give it room and a card to sit on so it does
   not look bolted onto the page. */
#checkout,
#checkout-form{
  max-width:900px;
  margin:0 auto;
  min-height:540px;
  background:var(--white);
  border:1px solid var(--line);
  border-radius:16px;
  padding:10px;
  box-shadow:var(--shadow);
}
#checkout iframe,
#checkout-form iframe{border-radius:12px}

@media (max-width:640px){
  #checkout,
  #checkout-form{padding:4px;border-radius:12px;min-height:620px}
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion:reduce){
  .cart-fab,.cart-x,.cart-qty button,.prod{transition:none}
  .cart-fab:hover{transform:none}
  .cart-panel:not([hidden]),.cart-scrim:not([hidden]),
  .cart-toast:not([hidden]),.cart-fab-n.is-bumped{animation:none}
  .oc-spinner{animation-duration:2s}
}
