/**
 * Vape101 — mini cart drawer styles.
 * Built on the v1.2.17 design-token system; self-contained and scoped to
 * .hp-cart-drawer so it cannot leak into WooCommerce/Elementor layouts.
 */

/* ---------- Shell ---------- */
.hp-cart-drawer {
  position: fixed;
  inset: 0;
  z-index: 100000; /* above the 21+ gate if both are ever visible */
  visibility: hidden;
  pointer-events: none;
}
.hp-cart-drawer.is-open {
  visibility: visible;
  pointer-events: auto;
}
.hp-cart-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 40, .5);
  opacity: 0;
  transition: opacity .3s var(--hp-ease);
}
.hp-cart-drawer.is-open .hp-cart-drawer__backdrop { opacity: 1; }

.hp-cart-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 100%);
  background: var(--hp-surface);
  box-shadow: -12px 0 48px rgba(16, 24, 40, .18);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .34s var(--hp-ease);
  outline: none;
}
.hp-cart-drawer.is-open .hp-cart-drawer__panel { transform: translateX(0); }
body.hp-cart-open { overflow: hidden; }

/* ---------- Head ---------- */
.hp-cart-drawer__head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--hp-sp-5);
  border-bottom: 1px solid var(--hp-line);
}
.hp-cart-drawer__title {
  margin: 0;
  font-size: var(--hp-fs-sm);
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--hp-ink);
}
.hp-cart-drawer__close {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--hp-muted);
  transition: background var(--hp-t-fast), color var(--hp-t-fast);
}
.hp-cart-drawer__close:hover { background: var(--hp-soft-2); color: var(--hp-ink); }
.hp-cart-drawer__close:focus-visible { outline: 2px solid var(--hp-blue); outline-offset: 2px; }

/* ---------- Body (scrollable lines) ---------- */
.hp-cart-drawer__body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--hp-sp-2) var(--hp-sp-5);
}
.hp-cart-lines { margin: 0; padding: 0; list-style: none; }
.hp-cart-line {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: var(--hp-sp-3);
  align-items: start;
  padding: var(--hp-sp-4) 0;
  border-bottom: 1px solid var(--hp-line);
}
.hp-cart-line__media {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  background: var(--hp-surface);
  border: 1px solid var(--hp-line);
  border-radius: var(--hp-radius-sm);
  overflow: hidden;
}
.hp-cart-line__img { width: 100%; height: 100%; object-fit: contain; }
.hp-cart-line__img--ph {
  display: grid;
  place-items: center;
  font-size: var(--hp-fs-2xl);
  font-weight: 700;
  color: var(--hp-line-strong);
  background: var(--hp-soft);
}
.hp-cart-line__info { min-width: 0; }
.hp-cart-line__name {
  display: block;
  font-size: var(--hp-fs-base);
  font-weight: 700;
  line-height: 1.4;
  color: var(--hp-ink);
  overflow-wrap: anywhere;
}
.hp-cart-line__name:hover { color: var(--hp-blue); }
.hp-cart-line__var {
  display: block;
  margin-top: 2px;
  font-size: var(--hp-fs-sm);
  color: var(--hp-muted);
}
.hp-cart-line__meta {
  display: flex;
  align-items: center;
  gap: var(--hp-sp-3);
  margin-top: var(--hp-sp-2);
}
/* Capsule quantity stepper: [ - | qty | + ] */
.hp-cart-qty {
  display: inline-flex;
  align-items: center;
  height: 30px;
  border: 1px solid var(--hp-line-strong, #cfd6dd);
  border-radius: var(--hp-radius-pill, 999px);
  overflow: hidden;
  background: var(--hp-surface);
  color: var(--hp-ink);
}
.hp-cart-qty__btn {
  width: 32px;
  height: 100%;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--hp-muted);
  cursor: pointer;
  transition: background var(--hp-t-fast), color var(--hp-t-fast);
}
.hp-cart-qty__btn:hover { background: var(--hp-soft-2); color: var(--hp-blue); }
.hp-cart-qty__btn:focus-visible { outline: 2px solid var(--hp-blue); outline-offset: -2px; }
.hp-cart-qty__btn:disabled { opacity: .4; cursor: not-allowed; }
.hp-cart-qty__input {
  width: 42px;
  height: 100%;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--hp-line);
  border-right: 1px solid var(--hp-line);
  background: var(--hp-surface);
  color: var(--hp-ink);
  text-align: center;
  font-family: inherit;
  font-size: var(--hp-fs-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  -moz-appearance: textfield;
  appearance: textfield;
}
.hp-cart-qty__input::-webkit-outer-spin-button,
.hp-cart-qty__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.hp-cart-qty__input:focus { outline: 2px solid var(--hp-blue); outline-offset: -2px; }
.hp-cart-qty.is-busy { opacity: .5; pointer-events: none; }
.hp-cart-line__remove {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--hp-line);
  border-radius: 50%;
  background: var(--hp-surface);
  color: var(--hp-muted);
  transition: border-color var(--hp-t-fast), color var(--hp-t-fast), background var(--hp-t-fast);
}
.hp-cart-line__remove:hover { border-color: var(--hp-danger); color: var(--hp-danger); background: #fdecea; }
.hp-cart-line__remove:focus-visible { outline: 2px solid var(--hp-blue); outline-offset: 2px; }
.hp-cart-line__remove.is-busy { opacity: .5; pointer-events: none; }
.hp-cart-line__pricing {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  text-align: right;
  white-space: nowrap;
}
.hp-cart-line__price {
  font-size: var(--hp-fs-base);
  font-weight: 700;
  color: var(--hp-blue);
  white-space: nowrap;
}
.hp-cart-line__was {
  font-size: var(--hp-fs-sm);
  color: var(--hp-faint);
  text-decoration: line-through;
}
.hp-cart-line__save {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--hp-radius-pill, 999px);
  background: #e7f5ec;
  color: #1a7f43;
  font-size: var(--hp-fs-xs);
  font-weight: 700;
  line-height: 1.5;
}

/* ---------- Empty state ---------- */
.hp-cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 320px;
  color: var(--hp-faint);
}
.hp-cart-empty__title { margin: var(--hp-sp-4) 0 var(--hp-sp-1); font-size: var(--hp-fs-lg); font-weight: 700; color: var(--hp-ink); }
.hp-cart-empty__note { margin: 0; font-size: var(--hp-fs-base); color: var(--hp-muted); }

/* ---------- Footer: summary + checkout ---------- */
.hp-cart-drawer__foot {
  flex: 0 0 auto;
  border-top: 1px solid var(--hp-line);
  padding: var(--hp-sp-5);
  background: var(--hp-surface);
}
.hp-cart-summary__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: var(--hp-fs-md);
  color: var(--hp-ink);
}
.hp-cart-summary__row strong { font-size: var(--hp-fs-xl); font-weight: 700; }
.hp-cart-summary__row--was { font-size: var(--hp-fs-sm); color: var(--hp-faint); }
.hp-cart-summary__row--was span:last-child { text-decoration: line-through; }
.hp-cart-summary__row--save { color: #1a7f43; font-size: var(--hp-fs-sm); font-weight: 600; }
.hp-cart-summary__row--save strong { font-size: var(--hp-fs-md); font-weight: 700; }
.hp-cart-summary__row--total { margin-top: var(--hp-sp-2); padding-top: var(--hp-sp-3); border-top: 1px solid var(--hp-line); }

.hp-cart-ship { margin-top: var(--hp-sp-4); }
.hp-cart-ship__msg { margin: 0 0 var(--hp-sp-2); font-size: var(--hp-fs-sm); color: var(--hp-muted); }
.hp-cart-ship__msg strong { color: var(--hp-ink); }
.hp-cart-ship__done { color: var(--hp-success); font-weight: 600; }
.hp-cart-ship__track {
  height: 6px;
  border-radius: var(--hp-radius-pill);
  background: var(--hp-soft-2);
  overflow: hidden;
}
.hp-cart-ship__bar {
  display: block;
  height: 100%;
  border-radius: var(--hp-radius-pill);
  background: linear-gradient(90deg, var(--hp-blue), var(--hp-blue-600));
  transition: width .4s var(--hp-ease);
}

.hp-cart-checkout {
  display: block;
  width: 100%;
  margin-top: var(--hp-sp-5);
  padding: 16px 20px;
  border-radius: var(--hp-radius);
  background: var(--hp-blue);
  color: #fff;
  text-align: center;
  font-size: var(--hp-fs-md);
  font-weight: 700;
  letter-spacing: .08em;
  transition: background var(--hp-t-fast), transform var(--hp-t-fast);
}
.hp-cart-checkout:hover { background: var(--hp-blue-dark); color: #fff; }
.hp-cart-checkout:active { transform: translateY(1px); }
.hp-cart-checkout:focus-visible { outline: 2px solid var(--hp-blue); outline-offset: 2px; }
.hp-cart-checkout--muted { background: var(--hp-ink); }
.hp-cart-checkout--muted:hover { background: #000; }

.hp-cart-viewcart {
  display: block;
  margin-top: var(--hp-sp-3);
  text-align: center;
  font-size: var(--hp-fs-sm);
  font-weight: 600;
  color: var(--hp-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.hp-cart-viewcart:hover { color: var(--hp-blue); }
.hp-cart-summary__note { margin: var(--hp-sp-3) 0 0; text-align: center; font-size: var(--hp-fs-xs); color: var(--hp-faint); }

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .hp-cart-drawer__panel { width: 100%; }
  .hp-cart-drawer__head { padding: var(--hp-sp-4); }
  .hp-cart-drawer__body { padding: var(--hp-sp-2) var(--hp-sp-4); }
  .hp-cart-drawer__foot { padding: var(--hp-sp-4); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .hp-cart-drawer__panel,
  .hp-cart-drawer__backdrop,
  .hp-cart-ship__bar { transition: none; }
}
