/* =====================================================================
   The Hemp Doctor — Cart drawer ("Nice Picks / Your Cart") + floating button
   Requires thd-base.css. Loaded site-wide.
   ===================================================================== */

.thd-drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 99998;
  background: rgba(10, 29, 33, 0.5);
  opacity: 0;
  transition: opacity 0.3s ease;
  cursor: pointer;
}
.thd-drawer-scrim.is-open { opacity: 1; }
body.thd-drawer-locked { overflow: hidden; }

.thd-drawer,
.thd-drawer * { box-sizing: border-box; }
.thd-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  width: min(460px, 100vw);
  height: 100%;
  background: var(--thd-white);
  box-shadow: -12px 0 40px rgba(17, 61, 60, 0.16);
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  visibility: hidden;
  font-family: var(--thd-sans);
  color: var(--thd-ink);
}
.thd-drawer.is-open { transform: translateX(0); visibility: visible; }

.thd-drawer__close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--thd-border) !important;
  border-radius: 50%;
  background: var(--thd-white) !important;
  color: var(--thd-teal) !important;
  box-shadow: 0 2px 10px rgba(17, 61, 60, 0.08);
  cursor: pointer;
}
.thd-drawer__close:hover { border-color: var(--thd-teal) !important; }
.thd-drawer__close .thd-icon { font-size: 16px; }

.thd-drawer__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.thd-drawer__body.is-busy { opacity: 0.5; pointer-events: none; }
.thd-drawer__notices { padding: 0 28px; }
.thd-drawer__notices .woocommerce-error,
.thd-drawer__notices .woocommerce-message,
.thd-drawer__notices .woocommerce-info {
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: var(--thd-radius-sm);
  background: var(--thd-cream);
  color: var(--thd-ink);
  font-size: 13px;
  list-style: none;
}

/* --- Head: "Nice Picks / Your Cart" + progress cards --- */
.thd-mini-head { flex: none; padding: 32px 28px 6px; text-align: center; }
.thd-mini-head .thd-page-head { margin-bottom: 0; }
.thd-mini-head .thd-eyebrow { font-size: 26px; }
.thd-mini-head .thd-title { font-size: 32px !important; }
.thd-mini-head .thd-rule { width: 200px; margin-top: 10px; }
.thd-mini-progress { flex: none; padding: 18px 28px 4px; }

/* --- Items --- */
.thd-drawer__items {
  flex: 1;
  min-height: 0;
  margin: 0 !important;
  padding: 8px 28px 4px !important;
  list-style: none !important;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.thd-drawer__item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 84px;
  margin: 0 !important;
  padding: 18px 0 18px 100px !important;
  border-bottom: 1px solid var(--thd-border-light);
}
.thd-drawer__item:last-child { border-bottom: 0; }
.thd-drawer__item > .thd-thumb {
  position: absolute;
  left: 0;
  top: 18px;
  width: 80px;
  height: 80px;
  border-radius: 10px;
}
.thd-drawer__item-body { width: 100%; }
.thd-drawer__name,
.thd-drawer__name:visited {
  display: block;
  color: var(--thd-teal) !important;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.thd-drawer__name:hover { color: var(--thd-teal-dark) !important; }
.thd-drawer__meta {
  display: block;
  margin-top: 2px;
  color: var(--thd-muted);
  font-size: 12px;
  line-height: 1.5;
}
.thd-drawer__meta dl.variation { margin: 0; }
.thd-drawer__meta dl.variation dt,
.thd-drawer__meta dl.variation dd,
.thd-drawer__meta dl.variation p { display: inline; margin: 0; padding: 0; font-weight: 400; float: none; }
.thd-drawer__meta dl.variation dt { margin-right: 4px; }
.thd-drawer__meta dl.variation dd::after { content: " "; }
.thd-drawer__item .thd-badge { margin-top: 4px; }
.thd-mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 8px;
}
.thd-mini-price { color: var(--thd-ink); font-size: 15px; font-weight: 700; }
.thd-mini-price .woocommerce-Price-amount { color: inherit; font-weight: inherit; }
.thd-drawer__remove {
  margin: 8px 0 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--thd-teal);
  font-family: var(--thd-sans);
  font-size: 12px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.thd-drawer__remove:hover { color: var(--thd-goldfish); }

/* --- Upsell card inside the list --- */
.thd-mini-upsell {
  display: block;
  margin: 18px 0 8px !important;
  padding: 20px !important;
  border: 0;
  border-radius: 12px;
  background: var(--thd-teal);
  color: var(--thd-white);
}
.thd-mini-upsell__top { display: flex; gap: 14px; align-items: flex-start; }
.thd-mini-upsell__thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 74px;
  height: 74px;
  border-radius: 8px;
  background: var(--thd-linen);
  color: var(--thd-teal-muted);
  overflow: hidden;
}
.thd-mini-upsell__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thd-mini-upsell__thumb .thd-icon { font-size: 24px; }
.thd-mini-upsell__body { flex: 1; min-width: 0; }
.thd-mini-upsell__body .thd-badge { margin-bottom: 8px; }
.thd-mini-upsell__name { display: block; color: var(--thd-white); font-size: 14px; font-weight: 700; line-height: 1.35; text-transform: uppercase; }
.thd-mini-upsell__price { display: block; margin-top: 10px; text-align: right; font-size: 15px; font-weight: 700; color: var(--thd-white); }
.thd-mini-upsell__price del { color: rgba(255, 255, 255, 0.6); font-weight: 500; margin-right: 8px; }
.thd-mini-upsell__price ins { text-decoration: none; }
.thd-mini-upsell__price .woocommerce-Price-amount { color: inherit; }
.thd-mini-upsell .thd-btn { margin-top: 14px; }

/* --- Footer (pinned) --- */
.thd-drawer__foot {
  flex: none;
  padding: 24px 28px 26px;
  border-top: 4px solid var(--thd-goldfish);
  background: var(--thd-cream);
}
.thd-drawer__sub {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.thd-mini-sub-label { color: var(--thd-teal); font-size: 22px; font-weight: 600; }
.thd-mini-sub-amount,
.thd-mini-sub-amount .woocommerce-Price-amount { color: var(--thd-teal); font-size: 30px; font-weight: 700; }
.thd-mini-footnote { margin: 6px 0 0; color: var(--thd-muted); font-size: 13px; line-height: 1.5; }
.thd-drawer__foot .thd-installments { justify-content: flex-start; margin: 12px 0 0; }
.thd-drawer__foot .thd-drawer__checkout { margin-top: 18px; }
.thd-mini-keep {
  display: block;
  margin: 14px auto 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--thd-teal);
  font-family: var(--thd-sans);
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.thd-mini-trust {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 18px 0 0 !important;
  padding: 16px 0 0 !important;
  border-top: 1px solid rgba(2, 89, 96, 0.12);
  list-style: none !important;
}
.thd-mini-trust__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  margin: 0;
  color: var(--thd-teal);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}
.thd-mini-trust__item .thd-icon { color: var(--thd-goldfish); font-size: 16px; }

/* --- Empty state --- */
.thd-drawer__empty { padding: 48px 28px; text-align: center; }
.thd-drawer__empty-title {
  margin: 0;
  font-family: var(--thd-serif);
  font-size: 22px;
  color: var(--thd-teal);
}
.thd-drawer__empty-text { margin: 8px 0 24px; color: var(--thd-muted); font-size: 14px; }

/* --- Floating cart button --- */
.thd-fab {
  position: fixed;
  right: calc(20px + env(safe-area-inset-right, 0px));
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 9990;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  padding: 0;
  border: 0 !important;
  border-radius: 50%;
  background: var(--thd-teal) !important;
  color: var(--thd-white) !important;
  box-shadow: 0 6px 20px rgba(17, 61, 60, 0.28);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}
.thd-fab:hover,
.thd-fab:focus-visible { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(17, 61, 60, 0.34); }
.thd-fab:focus-visible { outline: 2px solid var(--thd-goldfish); outline-offset: 3px; }
.thd-fab .thd-icon { font-size: 24px; }
.thd-fab__count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--thd-goldfish);
  color: var(--thd-forest);
  font-family: var(--thd-sans);
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}
.thd-fab__count.is-empty { display: none; }
body.thd-drawer-locked .thd-fab { opacity: 0; pointer-events: none; }

@media (max-width: 480px) {
  .thd-mini-head { padding: 28px 20px 4px; }
  .thd-mini-progress,
  .thd-drawer__items { padding-left: 20px !important; padding-right: 20px !important; }
  .thd-drawer__foot { padding: 20px 20px 22px; }
  .thd-drawer__item { padding-left: 88px !important; }
  .thd-drawer__item > .thd-thumb { width: 72px; height: 72px; }
  .thd-drawer__notices { padding: 0 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .thd-drawer, .thd-drawer-scrim, .thd-fab { transition: none; }
}
