/* ==========================================================================
   Global Psychometrics Cafe — shop app (cart, checkout, payment, orders)
   ========================================================================== */

/* Entry animation that also plays after HTMX swaps (keyframe-based, unlike
   .reveal which relies on the page-load IntersectionObserver). */
@keyframes shop-rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}
.shop-rise { animation: shop-rise .55s cubic-bezier(.22, .61, .36, 1) both; }

@keyframes shop-pop {
  from { transform: scale(.4); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* --------------------------------------------------------------------------
   Cart
   -------------------------------------------------------------------------- */

.cart-layout,
.checkout-layout,
.pay-layout,
.order-detail-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 380px;
  gap: 1.6rem; align-items: start;
}
@media (max-width: 940px) {
  .cart-layout, .checkout-layout, .pay-layout, .order-detail-layout {
    grid-template-columns: 1fr;
  }
}

.cart-lines { display: flex; flex-direction: column; gap: 1rem; }

.cart-line { display: flex; align-items: center; gap: 1.1rem; padding: 1.1rem 1.3rem; flex-wrap: wrap; }

.cart-thumb {
  flex: 0 0 auto; width: 62px; height: 62px; border-radius: 16px;
  display: grid; place-items: center; color: #fff;
  background: var(--grad-primary); box-shadow: var(--shadow-sm);
}
.cart-thumb.teal { background: linear-gradient(135deg, #0d9488, #115e59); }
.cart-thumb.gold { background: linear-gradient(135deg, #f59e0b, #b45309); }

.cart-line-info { flex: 1 1 220px; min-width: 0; }
.cart-line-name { display: inline-block; font-family: var(--font-display); font-weight: 700; color: var(--ink); }
.cart-line-name:hover { color: var(--primary); }
.cart-line-tags { display: flex; gap: .4rem; flex-wrap: wrap; margin: .3rem 0; }
.cart-line-unit { font-size: .85rem; color: var(--ink-faint); }
.cart-line-total { font-family: var(--font-display); font-weight: 800; min-width: 92px; text-align: right; }

.cart-line-remove {
  width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: var(--surface-2); color: var(--ink-faint);
  font-size: 1.05rem; line-height: 1; cursor: pointer;
  transition: background .2s, color .2s, transform .25s;
}
.cart-line-remove:hover { background: #ffe4e6; color: var(--danger); transform: rotate(90deg); }

.qty-stepper {
  display: inline-flex; align-items: center; gap: .15rem;
  border: 1px solid var(--line); border-radius: 999px;
  padding: .25rem .35rem; background: #fff;
}
.qty-btn {
  width: 28px; height: 28px; border-radius: 50%; border: 0;
  background: var(--surface-2); color: var(--ink-soft);
  font-weight: 700; font-size: 1rem; line-height: 1; cursor: pointer;
  transition: background .2s, color .2s;
}
.qty-btn:hover { background: var(--primary); color: #fff; }
.qty-value { min-width: 30px; text-align: center; font-weight: 700; }

/* --------------------------------------------------------------------------
   Summary card (cart / checkout / payment)
   -------------------------------------------------------------------------- */

.summary-card { padding: 1.6rem 1.7rem; position: sticky; top: calc(var(--nav-height) + 18px); }
@media (max-width: 940px) { .summary-card { position: static; } }
.summary-card h3 { margin-bottom: 1rem; }

.summary-item { display: flex; justify-content: space-between; gap: .8rem; padding: .35rem 0; font-size: .95rem; color: var(--ink-soft); }
.summary-item span:last-child { white-space: nowrap; font-weight: 600; color: var(--ink); }

.summary-rows { margin-top: 1rem; }
.summary-row { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .45rem 0; color: var(--ink-soft); font-size: .97rem; }
.summary-label { display: inline-flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.summary-total {
  border-top: 2px solid var(--line); margin-top: .5rem; padding-top: .9rem;
  color: var(--ink); font-family: var(--font-display); font-weight: 800; font-size: 1.15rem;
}
.discount-amount { color: var(--success); font-weight: 700; white-space: nowrap; }

.coupon-form { display: flex; gap: .5rem; }
.coupon-form input { flex: 1 1 auto; min-width: 0; }
.coupon-msg { font-size: .85rem; font-weight: 600; margin-top: .55rem; }
.coupon-msg-error { color: var(--danger); }
.coupon-msg-success { color: var(--success); }

.coupon-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  background: #d1fae5; color: #047857; border-radius: 999px;
  padding: .15rem .3rem .15rem .7rem;
  font-size: .76rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
}
.coupon-chip button {
  border: 0; background: rgba(4, 120, 87, .14); color: #047857;
  width: 18px; height: 18px; border-radius: 50%; cursor: pointer;
  font-size: .78rem; line-height: 1; display: grid; place-items: center;
  transition: background .2s, color .2s;
}
.coupon-chip button:hover { background: #047857; color: #fff; }

.counselling-note {
  display: flex; gap: .6rem; align-items: flex-start;
  background: var(--accent-soft); color: #0f766e;
  border-radius: var(--radius-sm); padding: .85rem .95rem;
  font-size: .88rem; font-weight: 600; margin: 1rem 0;
}
.counselling-note svg { flex: 0 0 auto; margin-top: .1rem; }

.summary-secure {
  display: flex; align-items: center; justify-content: center; gap: .45rem;
  margin-top: .9rem; font-size: .8rem; color: var(--ink-faint);
}

.empty-actions { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; margin-top: 1.2rem; }

/* --------------------------------------------------------------------------
   Checkout
   -------------------------------------------------------------------------- */

.checkout-main { display: flex; flex-direction: column; gap: 1.3rem; min-width: 0; }
.checkout-card { padding: 1.6rem 1.8rem; }
.checkout-card > h3 { margin-bottom: .35rem; }

.account-row { display: flex; align-items: center; gap: 1rem; margin-top: .9rem; }
.account-avatar {
  flex: 0 0 auto; width: 52px; height: 52px; border-radius: 50%;
  background: var(--grad-primary); color: #fff;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 1.2rem;
}
.account-meta strong { display: block; font-family: var(--font-display); color: var(--ink); }
.account-meta small { color: var(--ink-faint); }
.account-chips { display: flex; gap: .45rem; flex-wrap: wrap; margin-top: 1rem; }

.notice-amber {
  display: flex; gap: .9rem; align-items: flex-start;
  background: #fffbeb; border: 1px solid #fcd34d;
  border-radius: var(--radius); padding: 1.1rem 1.3rem;
}
.notice-amber svg { flex: 0 0 auto; color: #d97706; margin-top: .15rem; }
.notice-amber strong { display: block; color: #92400e; font-family: var(--font-display); }
.notice-amber p { color: #b45309; font-size: .9rem; margin: .25rem 0 .75rem; }

.slot-warning { margin-top: .9rem; color: var(--danger); font-weight: 600; font-size: .9rem; }

/* --------------------------------------------------------------------------
   Schedule page (slot selection right after add-to-cart) + cart status card
   -------------------------------------------------------------------------- */

.schedule-wrap { max-width: 720px; margin-inline: auto; display: flex; flex-direction: column; gap: 1.2rem; }
.schedule-chips { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; }
.schedule-chips .chip svg { color: var(--primary); flex: 0 0 auto; }

.schedule-skip {
  display: block; text-align: center; margin-top: 1rem;
  font-size: .9rem; font-weight: 600; color: var(--ink-faint);
  text-decoration: underline; text-underline-offset: 3px;
}
.schedule-skip:hover { color: var(--primary); }

.schedule-card {
  display: flex; gap: .7rem; align-items: flex-start;
  border-radius: var(--radius-sm); padding: .95rem 1.05rem;
  margin-bottom: 1.1rem; font-size: .9rem;
}
.schedule-card svg { flex: 0 0 auto; margin-top: .1rem; }
.schedule-card strong { display: block; font-family: var(--font-display); line-height: 1.4; }
.schedule-card .btn { margin-top: .6rem; }
.schedule-card.ok { background: var(--accent-soft); color: #0f766e; }
.schedule-card.ok strong { color: #115e59; }
.schedule-card.warn { background: #fffbeb; border: 1px solid #fcd34d; color: #b45309; }
.schedule-card.warn strong { color: #92400e; }
.schedule-card-link {
  display: inline-block; margin-top: .35rem; font-weight: 700; font-size: .85rem;
  color: inherit; text-decoration: underline; text-underline-offset: 3px;
}
.schedule-card-link:hover { color: var(--primary); }

.muted { color: var(--ink-faint); font-size: .9rem; }
.center { text-align: center; }

/* --------------------------------------------------------------------------
   Payment
   -------------------------------------------------------------------------- */

.pay-card { padding: 1.7rem 1.8rem; }
.pay-card > h3 { margin-bottom: .3rem; }

.pay-methods {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .8rem; margin: 1.15rem 0 1.3rem;
}
.pay-method {
  position: relative; display: flex; flex-direction: column; align-items: center;
  gap: .45rem; text-align: center;
  border: 2px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; padding: 1rem .6rem; cursor: pointer;
  font-weight: 600; font-size: .9rem; color: var(--ink-soft);
  transition: transform .2s, border-color .2s, background .2s, color .2s;
}
.pay-method:hover { border-color: var(--primary); transform: translateY(-2px); }
.pay-method.selected {
  border-color: var(--primary); background: var(--primary-soft);
  color: var(--primary-strong); box-shadow: var(--shadow-sm);
}
.pay-method input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.pay-method svg { color: var(--primary); }

.mock-note {
  display: flex; gap: .6rem; align-items: flex-start;
  background: var(--surface-2); border: 1px dashed #c9c3ee;
  border-radius: var(--radius-sm); padding: .85rem .95rem;
  font-size: .85rem; color: var(--ink-faint); margin-bottom: 1.1rem;
}
.mock-note svg { flex: 0 0 auto; color: var(--primary); margin-top: .1rem; }

.secure-badges {
  display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center;
  margin-top: 1.15rem; font-size: .8rem; color: var(--ink-faint);
}
.secure-badges span { display: inline-flex; align-items: center; gap: .35rem; }

/* --------------------------------------------------------------------------
   Order success
   -------------------------------------------------------------------------- */

.success-wrap { max-width: 780px; margin-inline: auto; }

.success-card { text-align: center; padding: 3rem 2rem 2.4rem; }

.success-badge {
  width: 110px; height: 110px; margin: 0 auto 1.4rem; border-radius: 50%;
  background: #d1fae5; display: grid; place-items: center;
  animation: shop-pop .5s cubic-bezier(.34, 1.56, .64, 1) both;
}
.success-check { width: 64px; height: 64px; display: block; }
.success-check .ck-circle {
  fill: none; stroke: var(--success); stroke-width: 2.5;
  stroke-dasharray: 155; stroke-dashoffset: 155;
  animation: ck-draw .7s cubic-bezier(.65, 0, .45, 1) .25s forwards;
}
.success-check .ck-check {
  fill: none; stroke: var(--success); stroke-width: 3.4;
  stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 36; stroke-dashoffset: 36;
  animation: ck-draw .45s cubic-bezier(.65, 0, .45, 1) .85s forwards;
}
@keyframes ck-draw { to { stroke-dashoffset: 0; } }

.success-sub { margin-top: .4rem; }

.success-items { text-align: left; margin: 1.7rem auto 0; max-width: 480px; }

.success-ctas { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; margin: 1.7rem 0; }

.booking-card { margin-top: 1.4rem; padding: 1.6rem 1.8rem; }
.booking-when { font-weight: 700; color: var(--ink); margin-top: .2rem; }
.booking-duration { font-size: .88rem; color: var(--ink-faint); }
.booking-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }

.next-steps { margin-top: 1.4rem; padding: 1.6rem 1.8rem; }
.next-list { list-style: none; margin-top: 1rem; display: flex; flex-direction: column; gap: 1rem; counter-reset: nextstep; }
.next-list li { counter-increment: nextstep; display: flex; gap: .9rem; align-items: flex-start; color: var(--ink-soft); }
.next-list li::before {
  content: counter(nextstep); flex: 0 0 auto;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--grad-primary); color: #fff;
  font-weight: 700; font-size: .85rem;
  display: grid; place-items: center; margin-top: .1rem;
}
.next-list strong { color: var(--ink); }

/* --------------------------------------------------------------------------
   Orders list / detail
   -------------------------------------------------------------------------- */

.orders-card { padding: .5rem 1.1rem; overflow-x: auto; }
.order-number-link { font-family: var(--font-display); font-weight: 700; }

.order-detail-main { display: flex; flex-direction: column; gap: 1.3rem; min-width: 0; }
.order-detail-side { display: flex; flex-direction: column; gap: 1.3rem; }
.order-detail-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.6rem;
}
.order-detail-head h1 { font-size: clamp(1.6rem, 3.5vw, 2.3rem); }

.assessment-chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .45rem; }
.assessment-chips .chip { font-size: .78rem; padding: .3rem .75rem; }

.payment-id { font-size: .8rem; color: var(--ink-faint); word-break: break-all; }
