:root {
  --cdfw-panel-width: 380px;
  --cdfw-color-primary: #2271b1;
  --cdfw-color-accent: #d63638;
  --cdfw-color-text: #1d2327;
  --cdfw-color-muted: #646970;
  --cdfw-color-border: #dcdcde;
  --cdfw-color-bg: #ffffff;
  --cdfw-color-surface: #f6f7f7;
  --cdfw-z-index: 100000;
}

.cdfw-cart-drawer {
  position: fixed;
  inset: 0;
  z-index: var(--cdfw-z-index);
  pointer-events: none;
  font-family: inherit;
}

.cdfw-cart-drawer.is-open {
  pointer-events: auto;
}

.cdfw-cart-drawer *,
.cdfw-cart-drawer *::before,
.cdfw-cart-drawer *::after {
  box-sizing: border-box;
}

.cdfw-cart-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.cdfw-cart-drawer.is-open .cdfw-cart-drawer__backdrop {
  opacity: 1;
}

.cdfw-cart-drawer__panel {
  position: absolute;
  top: 0;
  width: min(var(--cdfw-panel-width), 100vw);
  max-width: 100%;
  height: 100%;
  background: var(--cdfw-color-bg);
  color: var(--cdfw-color-text);
  box-shadow: 0 0 32px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}

.cdfw-cart-drawer--left .cdfw-cart-drawer__panel {
  left: 0;
  transform: translateX(-100%);
}

.cdfw-cart-drawer--right .cdfw-cart-drawer__panel {
  right: 0;
  transform: translateX(100%);
}

.cdfw-cart-drawer.is-open.cdfw-cart-drawer--left .cdfw-cart-drawer__panel,
.cdfw-cart-drawer.is-open.cdfw-cart-drawer--right .cdfw-cart-drawer__panel {
  transform: translateX(0);
}

.cdfw-cart-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--cdfw-color-border);
  flex-shrink: 0;
}

.cdfw-cart-drawer__title {
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.3;
  font-weight: 600;
}

.cdfw-cart-drawer__close {
  appearance: none;
  border: 1px solid var(--cdfw-color-border);
  border-radius: 50%;
  background: transparent;
  color: var(--cdfw-color-text);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.cdfw-cart-drawer__close:hover {
  background: var(--cdfw-color-surface);
}

.cdfw-cart-drawer__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.cdfw-cart-drawer__content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.cdfw-mini-cart {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.cdfw-mini-cart__scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px 20px;
}

.cdfw-mini-cart__items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cdfw-mini-cart__item {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--cdfw-color-border);
  border-radius: 4px;
  background: var(--cdfw-color-bg);
}

.cdfw-mini-cart__item-media {
  width: 88px;
  height: 88px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--cdfw-color-surface);
}

.cdfw-mini-cart__item-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cdfw-mini-cart__item-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cdfw-mini-cart__item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.cdfw-mini-cart__item-name {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.4;
  display: block;
}

.cdfw-mini-cart__item-name:hover {
  color: var(--cdfw-color-primary);
}

.cdfw-mini-cart__remove {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--cdfw-color-border);
  color: var(--cdfw-color-muted) !important;
  text-decoration: none !important;
  font-size: 1.125rem;
  line-height: 1;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  background: var(--cdfw-color-bg);
  float: none !important;
  position: static !important;
  top: auto !important;
  right: auto !important;
  left: auto !important;
}

.cdfw-mini-cart__remove:hover {
  color: var(--cdfw-color-accent) !important;
  border-color: var(--cdfw-color-accent);
}

.cdfw-mini-cart__item-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}

.cdfw-qty {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--cdfw-color-border);
  border-radius: 4px;
  overflow: hidden;
  background: var(--cdfw-color-bg);
}

.cdfw-qty__btn {
  appearance: none;
  border: 0;
  background: var(--cdfw-color-surface);
  width: 34px;
  min-height: 34px;
  cursor: pointer;
  color: var(--cdfw-color-text);
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}

.cdfw-qty__btn:hover {
  background: var(--cdfw-color-border);
}

.cdfw-qty__input {
  width: 42px;
  min-height: 34px;
  border: 0;
  border-left: 1px solid var(--cdfw-color-border);
  border-right: 1px solid var(--cdfw-color-border);
  text-align: center;
  padding: 0;
  font-size: 0.875rem;
  background: var(--cdfw-color-bg);
  -moz-appearance: textfield;
}

.cdfw-qty__input::-webkit-outer-spin-button,
.cdfw-qty__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.cdfw-mini-cart__item-subtotal {
  font-weight: 700;
  font-size: 0.9375rem;
  white-space: nowrap;
}

.cdfw-mini-cart__footer {
  flex-shrink: 0;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--cdfw-color-border);
  background: var(--cdfw-color-bg);
}

.cdfw-mini-cart__total {
  margin: 0 0 14px;
  font-size: 1rem;
  font-weight: 600;
}

.cdfw-mini-cart__total .amount {
  font-weight: 700;
}

.cdfw-mini-cart__buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cdfw-mini-cart__buttons .button,
.cdfw-mini-cart__buttons a.button {
  width: 100%;
  text-align: center;
  box-sizing: border-box;
  margin: 0 !important;
  float: none !important;
  display: block;
  padding: 12px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 4px;
}

.cdfw-mini-cart__buttons .checkout {
  background: var(--cdfw-color-accent) !important;
  border-color: var(--cdfw-color-accent) !important;
  color: #fff !important;
}

.cdfw-mini-cart__buttons .checkout:hover {
  opacity: 0.92;
}

.cdfw-mini-cart__buttons .wc-forward:not(.checkout) {
  background: transparent !important;
  color: var(--cdfw-color-primary) !important;
  border: 1px solid var(--cdfw-color-primary) !important;
}

.cdfw-mini-cart__empty {
  margin: 0;
  padding: 32px 20px;
  color: var(--cdfw-color-muted);
  text-align: center;
}

.cdfw-mini-cart dl.variation,
.cdfw-mini-cart .variation {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--cdfw-color-muted);
}

.cdfw-mini-cart dl.variation dt,
.cdfw-mini-cart dl.variation dd {
  display: inline;
  margin: 0;
}

.cdfw-mini-cart dl.variation dd p {
  margin: 0;
}

body.cdfw-cart-drawer-open {
  overflow: hidden;
}

.cdfw-cart-drawer.is-loading .cdfw-cart-drawer__content {
  opacity: 0.65;
  pointer-events: none;
}

@media (max-width: 480px) {
  .cdfw-cart-drawer__panel {
    width: 100vw;
  }

  .cdfw-mini-cart__item {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .cdfw-mini-cart__item-media {
    width: 72px;
    height: 72px;
  }
}
