/* Cart Drawer Styles - Dynamic Color Scheme Support & Scoped Controls */

.drawer {
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100%;
  display: flex;
  justify-content: flex-end;
  background-color: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.drawer.active {
  opacity: 1;
  visibility: visible;
}

.drawer__inner {
  height: 100%;
  width: 440px;
  max-width: 100vw;
  background-color: rgb(var(--color-background));
  color: rgb(var(--color-foreground));
  border-left: 0.1rem solid rgba(var(--color-foreground), 0.12);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  position: relative;
  box-sizing: border-box;
}

.drawer.active .drawer__inner {
  transform: translateX(0);
}

.drawer__inner-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: rgb(var(--color-background));
  color: rgb(var(--color-foreground));
}

/* Header */
.cart-drawer .drawer__header {
  padding: 18px 20px 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 0.1rem solid rgba(var(--color-foreground), 0.08);
  background-color: rgb(var(--color-background));
}

.cart-drawer .drawer__header-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cart-drawer .drawer__header-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgb(var(--color-foreground));
}

.cart-drawer .drawer__header-icon svg {
  stroke: currentColor;
}

.cart-drawer .drawer__heading {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: rgb(var(--color-foreground));
  line-height: 1.3;
}

.cart-drawer .drawer__close {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, color 0.2s ease;
  color: rgba(var(--color-foreground), 0.7);
  position: static;
  min-width: auto;
  min-height: auto;
  box-shadow: none;
}

.cart-drawer .drawer__close:hover {
  background-color: rgba(var(--color-foreground), 0.08);
  color: rgb(var(--color-foreground));
}

.cart-drawer .drawer__close svg {
  stroke: currentColor;
}

/* Free Shipping Banner */
.cart-drawer__free-shipping {
  padding: 12px 20px 0 20px;
}

.cart-drawer .free-shipping-bar {
  background-color: rgba(var(--color-foreground), 0.04);
  border: 0.1rem solid rgba(var(--color-foreground), 0.12);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12.5px;
  color: rgb(var(--color-foreground));
  line-height: 1.4;
  display: flex;
  align-items: center;
}

.cart-drawer .free-shipping-bar.unlocked {
  background-color: #ECFDF5;
  border: 1px solid #34D399;
  color: #065F46;
}

.cart-drawer .free-shipping-bar.unlocked strong {
  color: #065F46;
  font-weight: 700;
}

/* Scrollable Content */
.cart-drawer cart-drawer-items {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: block;
}

.cart-drawer cart-drawer-items::-webkit-scrollbar {
  width: 4px;
}

.cart-drawer cart-drawer-items::-webkit-scrollbar-thumb {
  background: rgba(var(--color-foreground), 0.2);
  border-radius: 4px;
}

.cart-drawer__form {
  display: flex;
  flex-direction: column;
}

.cart-drawer .drawer__contents {
  display: flex;
  flex-direction: column;
}

/* Item Card */
.cart-drawer-item-card {
  display: flex;
  gap: 14px;
  background-color: rgb(var(--color-background));
  border: 0.1rem solid rgba(var(--color-foreground), 0.12);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  position: relative;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cart-drawer-item-card:hover {
  border-color: rgba(var(--color-foreground), 0.25);
}

.cart-drawer-item__image-wrap {
  width: 74px;
  height: 74px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background-color: rgba(var(--color-foreground), 0.03);
  border: 0.1rem solid rgba(var(--color-foreground), 0.08);
}

.cart-drawer-item__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cart-drawer-item__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.cart-drawer-item__header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.cart-drawer-item__title {
  font-size: 13.5px;
  font-weight: 600;
  color: rgb(var(--color-foreground));
  text-decoration: none;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.cart-drawer-item__title:hover {
  opacity: 0.8;
}

.cart-drawer-item-card cart-remove-button {
  display: flex;
  flex-shrink: 0;
}

.cart-drawer-item__remove {
  background: transparent;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: rgba(var(--color-foreground), 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.2s ease, background-color 0.2s ease;
  margin-top: -2px;
  margin-right: -4px;
}

.cart-drawer .cart-drawer-item__remove:hover,
.cart-drawer-item__remove:hover {
  color: rgb(var(--color-hover-button-text));
  background-color: rgba(239, 68, 68, 0.1);
}

.cart-drawer-item__remove svg {
  stroke: currentColor;
}

.cart-drawer .cart-drawer-item__remove:hover svg,
.cart-drawer-item__remove:hover svg {
  stroke: rgb(var(--color-hover-button-text));
}

.cart-drawer-item__variant-info {
  font-size: 11.5px;
  color: rgba(var(--color-foreground), 0.7);
  margin-top: 2px;
  margin-bottom: 8px;
}

.cart-drawer-item__bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  min-width: 0;
}

/* Quantity Control Pill */
.cart-drawer-quantity {
  display: flex;
  align-items: center;
  border: 0.1rem solid rgba(var(--color-foreground), 0.2);
  border-radius: 6px;
  height: 28px;
  background-color: rgb(var(--color-background));
  overflow: hidden;
  flex-shrink: 0;
}

.cart-drawer-quantity__button {
  width: 26px;
  height: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: rgb(var(--color-foreground));
  user-select: none;
  transition: background-color 0.15s ease, color 0.15s ease;
  padding: 0;
}

.cart-drawer-quantity__button:hover {
  background-color: rgba(var(--color-foreground), 0.08);
}

.cart-drawer-quantity__button span {
  pointer-events: none;
}

.cart-drawer-quantity__button.disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.cart-drawer-quantity__input {
  width: 28px;
  border: none;
  background: transparent;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  color: rgb(var(--color-foreground));
  padding: 0;
  -moz-appearance: textfield;
}

.cart-drawer-quantity__input::-webkit-outer-spin-button,
.cart-drawer-quantity__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.cart-drawer-item__price {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  text-align: right;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  color: rgb(var(--color-foreground));
  flex-shrink: 0;
  white-space: nowrap;
}

.cart-drawer-item__price--old {
  font-size: 12px;
  color: rgba(var(--color-foreground), 0.5);
  text-decoration: line-through;
  margin-right: 0;
  font-weight: 400;
  white-space: nowrap;
}

.cart-drawer-item__price--final {
  font-size: 14px;
  font-weight: 700;
  color: rgb(var(--color-foreground));
  white-space: nowrap;
}

/* Upsell / Frequently Added Box */
.cart-drawer-upsell {
  background-color: rgba(var(--color-foreground), 0.03);
  border: 0.1rem dashed rgba(var(--color-foreground), 0.2);
  border-radius: 12px;
  padding: 12px;
  margin-top: 16px;
  margin-bottom: 8px;
}

.cart-drawer-upsell__badge,
.cart-drawer .cart-drawer-upsell__badge {
  display: inline-block;
  background-color: #ECFDF5;
  border: 1px solid #34D399;
  color: #065F46;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.cart-drawer-upsell__card {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cart-drawer-upsell__image-wrap {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  background-color: rgb(var(--color-background));
  border: 0.1rem solid rgba(var(--color-foreground), 0.1);
}

.cart-drawer-upsell__image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-drawer-upsell__info {
  flex: 1;
  min-width: 0;
}

.cart-drawer-upsell__title {
  font-size: 12px;
  font-weight: 600;
  color: rgb(var(--color-foreground));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.cart-drawer-upsell__price {
  font-size: 12px;
  font-weight: 700;
  color: rgb(var(--color-foreground));
  margin-top: 2px;
}

.cart-drawer-upsell__btn {
  background-color: rgb(var(--color-button));
  color: rgb(var(--color-button-text));
  border: none;
  border-radius: 16px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s ease;
  white-space: nowrap;
}

.cart-drawer-upsell__btn:hover {
  opacity: 0.9;
}

/* Footer Section */
.cart-drawer .drawer__footer {
  border-top: 0.1rem solid rgba(var(--color-foreground), 0.08);
  padding: 16px 20px 20px 20px;
  background-color: rgb(var(--color-background));
}

/* Discount Code Input Box */
.cart-drawer__discount-box {
  margin-bottom: 14px;
}

.cart-drawer__discount-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cart-drawer__discount-input-inner {
  flex: 1;
  display: flex;
  align-items: center;
  background-color: rgb(var(--color-background));
  border: 1.5px solid #d1d5db;
  border-radius: 14px;
  padding: 0 14px;
  height: 44px;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  min-width: 0;
}

.cart-drawer__discount-input-inner:focus-within {
  border-color: #94a3b8;
  box-shadow: 0 0 0 1px #94a3b8;
}

.cart-drawer__discount-input-icon {
  display: flex;
  align-items: center;
  color: #7b8e9e;
  margin-right: 10px;
  flex-shrink: 0;
}

.cart-drawer__discount-input {
  flex: 1;
  background: transparent !important;
  background-color: transparent !important;
  color: #334155 !important;
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
  padding: 0 !important;
  margin: 0 !important;
  height: 100% !important;
  font-size: 13.5px;
  font-weight: 500;
  min-width: 0;
  width: 100%;
  letter-spacing: 0.3px;
  -webkit-appearance: none;
  appearance: none;
}

.cart-drawer__discount-input:focus,
.cart-drawer__discount-input:focus-visible,
.cart-drawer__discount-input:active {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
}

.cart-drawer__discount-input::placeholder {
  color: #7b8e9e;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.cart-drawer__discount-btn {
  background-color: #1f3550;
  color: #ffffff;
  border: none;
  border-radius: 14px;
  height: 44px;
  padding: 0 24px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.1s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cart-drawer__discount-btn:hover {
  opacity: 0.92;
}

.cart-drawer__discount-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.cart-drawer__discount-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #fdf2f8;
  color: #db2777;
  border: 1.5px solid #db2777;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  text-decoration: none;
}

.cart-drawer__discount-tab:hover {
  background-color: #fce7f3;
  border-color: #be185d;
  color: #be185d;
}

.cart-drawer__discount-tab.active {
  background-color: #fce7f3;
  border-color: #db2777;
  color: #be185d;
  box-shadow: 0 0 0 1px #db2777;
}

.cart-drawer__discount-message {
  font-size: 12.5px;
  font-weight: 500;
  margin-top: 8px;
  display: none;
}

.cart-drawer__discount-message.error {
  display: block;
  color: #dc2626;
}

.cart-drawer__discount-message.success {
  display: block;
  color: #16a34a;
}

/* Applied Discount Row */
.cart-drawer__applied-discount {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: rgb(var(--color-background));
  border: 1px solid #fbcfe8;
  border-radius: 8px;
  padding: 8px 12px;
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.4;
  box-sizing: border-box;
}

.cart-drawer__applied-discount-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.cart-drawer__applied-discount-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #e11d48;
  flex-shrink: 0;
}

.cart-drawer__applied-discount-icon svg {
  stroke: currentColor;
}

.cart-drawer__applied-discount-code {
  color: #e11d48;
  font-weight: 700;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.cart-drawer__applied-discount-desc {
  color: rgba(var(--color-foreground), 0.75);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-drawer__applied-discount-remove {
  background: transparent;
  border: none;
  padding: 0;
  color: rgb(var(--color-button));
  font-size: 13px;
  font-weight: 500;
  text-decoration: underline;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 12px;
  transition: opacity 0.2s ease;
}

.cart-drawer__applied-discount-remove:hover {
  opacity: 0.75;
}

/* Summary Rows */
.cart-drawer__summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.cart-drawer__summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: rgba(var(--color-foreground), 0.75);
}

.cart-drawer__summary-val {
  font-weight: 600;
  color: rgb(var(--color-foreground));
}

.cart-drawer__summary-val--free {
  color: #16a34a;
  font-weight: 700;
}

.cart-drawer__summary-val--discount {
  color: #16a34a;
  font-weight: 700;
}

.cart-drawer__summary-total {
  font-size: 16px;
  font-weight: 700;
  color: rgb(var(--color-foreground));
  padding-top: 6px;
  border-top: 0.1rem dashed rgba(var(--color-foreground), 0.15);
  margin-top: 2px;
}

.cart-drawer__summary-val--total {
  font-size: 18px;
  font-weight: 800;
  color: rgb(var(--color-foreground));
}

/* Checkout Button */
.cart-drawer__checkout-btn {
  width: 100%;
  background-color: rgb(var(--color-button));
  color: rgb(var(--color-button-text));
  border: none;
  border-radius: 10px;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
}

.cart-drawer__checkout-btn:hover {
  opacity: 0.9;
}

.cart-drawer__checkout-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Full Cart Link */
.cart-drawer__full-cart {
  text-align: center;
  margin-top: 12px;
  margin-bottom: 12px;
}

.cart-drawer__full-cart-link {
  font-size: 12.5px;
  color: rgba(var(--color-foreground), 0.75);
  text-decoration: underline;
  transition: color 0.2s ease;
}

.cart-drawer__full-cart-link:hover {
  color: rgb(var(--color-foreground));
}

/* Trust Badges Footer */
.cart-drawer__trust-footer {
  text-align: center;
  font-size: 11px;
  color: rgba(var(--color-foreground), 0.7);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-top: 4px;
}

/* Empty State */
.cart-drawer__empty-content {
  padding: 40px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background-color: rgb(var(--color-background));
  color: rgb(var(--color-foreground));
}

.cart-drawer__empty-icon {
  margin-bottom: 16px;
  opacity: 0.9;
  color: rgb(var(--color-foreground));
}

.cart-drawer__empty-icon svg {
  stroke: currentColor;
}

.cart__empty-title {
  font-size: 18px;
  font-weight: 700;
  color: rgb(var(--color-foreground));
  margin-bottom: 8px;
}

.cart__empty-text {
  font-size: 13px;
  color: rgba(var(--color-foreground), 0.75);
  margin-bottom: 24px;
  max-width: 260px;
}

.cart__empty-btn,
.cart-drawer__empty-content .cart__empty-btn {
  background-color: rgb(var(--color-button));
  color: rgb(var(--color-button-text));
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  box-shadow: none !important;
  transform: none !important;
  transition: none !important;
  cursor: pointer;
}

.cart-drawer__empty-content .cart__empty-btn::before,
.cart-drawer__empty-content .cart__empty-btn::after,
.cart-drawer__empty-content .cart__empty-btn:hover::before,
.cart-drawer__empty-content .cart__empty-btn:hover::after,
.cart-drawer__empty-content .cart__empty-btn:focus::before,
.cart-drawer__empty-content .cart__empty-btn:focus::after {
  display: none !important;
  content: none !important;
  box-shadow: none !important;
}

.cart__empty-btn:hover,
.cart__empty-btn:focus,
.cart__empty-btn:active,
.cart-drawer__empty-content .cart__empty-btn:hover,
.cart-drawer__empty-content .cart__empty-btn:focus,
.cart-drawer__empty-content .cart__empty-btn:active,
.cart-drawer__empty-content .cart__empty-btn:not([disabled]):hover,
.cart-drawer__empty-content .cart__empty-btn:not([disabled]):focus,
.cart-drawer__empty-content .cart__empty-btn:not([disabled]):active {
  --color-button: var(--color-base-button-background);
  --color-button-text: 255, 255, 255;
  --color-hover-button-background: var(--color-base-button-background);
  --color-hover-button-text: 255, 255, 255;
  background-color: rgb(var(--color-base-button-background, var(--color-button))) !important;
  color: #ffffff !important;
  box-shadow: none !important;
  transform: none !important;
  opacity: 1 !important;
  outline: none !important;
  text-decoration: none !important;
  transition: none !important;
}

.cart-drawer__empty-content .cart__empty-btn:hover *,
.cart-drawer__empty-content .cart__empty-btn:focus *,
.cart-drawer__empty-content .cart__empty-btn:active * {
  color: #ffffff !important;
  transition: none !important;
}

.drawer__close-top {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: rgba(var(--color-foreground), 0.7);
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drawer__close-top:hover {
  background-color: rgba(var(--color-foreground), 0.08);
  color: rgb(var(--color-foreground));
}

/* Responsive adjustments */
@media screen and (max-width: 480px) {
  .drawer__inner {
    width: 100vw;
  }

  .cart-drawer .drawer__header {
    padding: 14px 16px;
  }

  .cart-drawer__free-shipping {
    padding: 10px 16px 0 16px;
  }

  .cart-drawer cart-drawer-items {
    padding: 14px 16px;
  }

  .cart-drawer .drawer__footer {
    padding: 14px 16px 16px 16px;
  }

  .cart-drawer-item-card {
    gap: 12px;
    padding: 10px;
    margin-bottom: 10px;
  }

  .cart-drawer-item__image-wrap {
    width: 68px;
    height: 68px;
    flex-shrink: 0;
  }

  .cart-drawer-item__title {
    font-size: 13px;
  }

  .cart-drawer-item__bottom-row {
    gap: 8px;
    margin-top: 6px;
    min-width: 0;
  }

  .cart-drawer-quantity {
    height: 26px;
    flex-shrink: 0;
  }

  .cart-drawer-quantity__button {
    width: 24px;
    font-size: 13px;
  }

  .cart-drawer-quantity__input {
    width: 26px;
    font-size: 12px;
  }

  .cart-drawer-item__price {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    text-align: right;
    gap: 1px;
    flex-shrink: 0;
    min-width: 0;
  }

  .cart-drawer-item__price--old {
    font-size: 11px;
    line-height: 1.2;
    margin-right: 0;
    white-space: nowrap;
  }

  .cart-drawer-item__price--final {
    font-size: 13.5px;
    line-height: 1.2;
    white-space: nowrap;
  }
}