/* Keffer Cart — Shopify-style Buy Button + drawer + embedded checkout */

:root {
  --keffer-fg: #111;
  --keffer-bg: #fff;
  --keffer-muted: #6b7280;
  --keffer-border: #e5e7eb;
  --keffer-accent: #111;
  --keffer-accent-fg: #fff;
  --keffer-radius: 10px;
  --keffer-z-fab: 999990;
  --keffer-z-drawer: 999995;
  --keffer-z-modal: 999999;
}

/* Any element with data-keffer-buy gets a pointer cursor and a clean
   transition for the disabled state. Add the .keffer-buy class on top if
   you want the full pill-button look. */
.keffer-buy-trigger {
  cursor: pointer;
  transition: opacity .15s ease;
}
.keffer-buy-trigger[aria-disabled="true"],
.keffer-buy--disabled {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Optional opt-in pill button styling */
.keffer-buy {
  display: inline-block;
  padding: .7rem 1.1rem;
  border-radius: var(--keffer-radius);
  background: var(--keffer-accent);
  color: var(--keffer-accent-fg);
  border: none;
  font: inherit;
  line-height: 1.2;
}
.keffer-buy:hover { opacity: .9; }

/* Floating Action Button (cart icon, bottom-right) */
.keffer-fab {
  position: fixed;
  right: 50px;
  bottom: 50px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--keffer-accent);
  color: var(--keffer-accent-fg);
  border: none;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(0,0,0,.2);
  z-index: var(--keffer-z-fab);
  transform: scale(.4);
  opacity: 0;
  transition: transform .2s ease, opacity .2s ease;
}
.keffer-fab.keffer-fab--show {
  display: flex;
  transform: scale(1);
  opacity: 1;
}
.keffer-fab__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: #ef4444;
  color: #fff;
  border-radius: 100px;
  font: 600 11px/22px system-ui, sans-serif;
  text-align: center;
}

/* Backdrop (shared by drawer) */
.keffer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
  z-index: var(--keffer-z-drawer);
}
.keffer-backdrop.keffer-backdrop--show {
  opacity: 1;
  pointer-events: auto;
}

/* Drawer */
.keffer-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 380px;
  max-width: 100vw;
  background: var(--keffer-bg);
  color: var(--keffer-fg);
  display: flex;
  flex-direction: column;
  transform: translateX(110%);
  transition: transform .25s ease-out;
  box-shadow: -8px 0 30px rgba(0,0,0,.15);
  z-index: var(--keffer-z-drawer);
  font: 14px/1.45 system-ui, -apple-system, sans-serif;
}
.keffer-drawer.keffer-drawer--show { transform: translateX(0); }
@media (max-width: 600px) {
  .keffer-drawer { width: 100vw; }
}
.keffer-checkout-mount {
  width: 100%;
  min-height: 100%;
}

.keffer-drawer__head {
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--keffer-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.keffer-drawer__head h2 { margin: 0; font-size: 1.05rem; font-weight: 600; }
.keffer-drawer__body { flex: 1; overflow-y: auto; padding: .5rem 1.25rem; }
.keffer-drawer__foot {
  border-top: 1px solid var(--keffer-border);
  padding: 1rem 1.25rem 1.25rem;
  background: var(--keffer-bg);
}

.keffer-iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  color: inherit;
}
.keffer-iconbtn:hover { background: rgba(0,0,0,.05); }

/* Empty state */
.keffer-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--keffer-muted);
}
.keffer-empty p { margin: 0 0 1rem; }

/* Cart row */
.keffer-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--keffer-border);
  align-items: flex-start;
}
.keffer-row:last-child { border-bottom: none; }
.keffer-row__img {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  background: #f3f4f6;
}
.keffer-row__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.keffer-row__noimg {
  width: 100%; height: 100%; background: #f3f4f6;
}
.keffer-row__name { font-weight: 500; line-height: 1.3; }
.keffer-row__price { color: var(--keffer-muted); font-size: .85rem; margin-top: 2px; }
.keffer-row__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  min-width: 70px;
}
.keffer-row__total { font-weight: 500; }
.keffer-row__remove { color: var(--keffer-muted); }
.keffer-row__remove:hover { color: #b91c1c; }

/* Qty selector — minimal: − 1 + on a single line */
.keffer-qty {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: var(--keffer-muted);
  font-size: .8rem;
  line-height: 1;
}
.keffer-qty__btn {
  width: 16px;
  height: 16px;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  color: inherit;
  opacity: .6;
}
.keffer-qty__btn:hover { opacity: 1; }
.keffer-qty__in {
  width: 22px;
  height: 16px;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  border-bottom: none !important;
  box-shadow: none !important;
  background: transparent !important;
  text-align: center;
  font: inherit;
  color: var(--keffer-fg);
  -moz-appearance: textfield;
}
.keffer-qty__in:focus { outline: none !important; border: none !important; box-shadow: none !important; }
.keffer-qty__in::-webkit-outer-spin-button,
.keffer-qty__in::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Footer */
.keffer-sub {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 4px;
}
.keffer-note {
  margin: 0 0 .9rem;
  color: var(--keffer-muted);
  font-size: .8rem;
}
.keffer-btn {
  display: block;
  width: 100%;
  padding: .85rem 1rem;
  border-radius: 10px;
  border: none;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
}
.keffer-btn--primary {
  background: var(--keffer-accent);
  color: var(--keffer-accent-fg);
}
.keffer-btn--primary:hover { opacity: .92; }
.keffer-btn--primary:disabled { opacity: .5; cursor: not-allowed; }
.keffer-btn--secondary {
  background: #f3f4f6;
  color: var(--keffer-fg);
}
.keffer-err {
  margin-top: .6rem;
  padding: .55rem .8rem;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 8px;
  font-size: .85rem;
}

