/* Header mini-cart and add-to-cart feedback. */
.site-header.advanced-header {
  overflow: visible !important;
}

.header-cart {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}

.egs-mini-cart {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 2200;
  width: min(390px, calc(100vw - 24px));
  overflow: hidden;
  border: 1px solid rgba(15, 39, 68, 0.14);
  border-radius: 8px;
  background: #ffffff;
  color: #0f2744;
  box-shadow: 0 24px 60px rgba(8, 42, 77, 0.22);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-10px) scale(0.985);
  transform-origin: top right;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.header-cart.is-open .egs-mini-cart {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.egs-mini-cart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(15, 39, 68, 0.1);
}

.egs-mini-cart-head > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.egs-mini-cart-head strong {
  font-size: 15px;
  line-height: 1.2;
}

.egs-mini-cart-head small {
  color: #64748b;
  font-size: 12px;
}

.egs-mini-cart-head > a {
  color: #15803d;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.egs-mini-cart-items {
  max-height: 344px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.egs-mini-cart-item {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid rgba(15, 39, 68, 0.08);
  color: inherit;
  text-decoration: none;
  transition: background 0.16s ease;
}

.egs-mini-cart-item:hover {
  background: #f4faf6;
}

.egs-mini-cart-media {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  overflow: hidden;
  border: 1px solid rgba(15, 39, 68, 0.1);
  border-radius: 6px;
  background: #ffffff;
}

.egs-mini-cart-media img {
  display: block;
  width: 100%;
  height: 100%;
  padding: 4px;
  object-fit: contain;
}

.egs-mini-cart-media > span {
  color: #15803d;
  font-size: 22px;
  font-weight: 900;
}

.egs-mini-cart-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}

.egs-mini-cart-copy > strong {
  width: 100%;
  overflow: hidden;
  color: #0f2744;
  font-size: 13px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.egs-mini-cart-copy > small {
  width: 100%;
  overflow: hidden;
  color: #64748b;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.egs-mini-cart-copy > span {
  color: #0f2744;
  font-size: 12px;
  font-weight: 800;
}

.egs-mini-cart-copy em {
  color: #64748b;
  font-style: normal;
  font-weight: 700;
}

.egs-mini-cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px;
  text-align: center;
}

.egs-mini-cart-empty > span {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: rgba(22, 163, 74, 0.1);
  color: #15803d;
}

.egs-mini-cart-empty svg {
  width: 22px;
  height: 22px;
}

.egs-mini-cart-empty strong {
  font-size: 14px;
}

.egs-mini-cart-empty small {
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
}

.egs-mini-cart-more {
  margin: 0;
  padding: 10px 18px;
  border-bottom: 1px solid rgba(15, 39, 68, 0.1);
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.egs-mini-cart-footer {
  padding: 15px 18px 18px;
  background: #ffffff;
}

.egs-mini-cart-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.egs-mini-cart-total span {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.egs-mini-cart-total strong {
  color: #0f2744;
  font-size: 19px;
}

.egs-mini-cart-actions {
  display: grid;
  grid-template-columns: 0.9fr 1.35fr;
  gap: 8px;
}

.egs-mini-cart-actions a,
.egs-cart-toast-actions a,
.egs-cart-toast-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.egs-mini-cart-secondary {
  border-color: rgba(15, 39, 68, 0.16) !important;
  background: #ffffff;
  color: #0f2744;
}

.egs-mini-cart-primary,
.egs-cart-toast-checkout {
  background: #16a34a;
  color: #ffffff !important;
  box-shadow: 0 8px 20px rgba(22, 163, 74, 0.22);
}

.egs-mini-cart-primary:hover,
.egs-cart-toast-checkout:hover {
  background: #15803d;
}

.egs-cart-toast-region {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 20000;
  display: grid;
  width: min(390px, calc(100vw - 32px));
  gap: 10px;
  pointer-events: none;
}

.egs-cart-toast {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 12px;
  padding: 16px;
  overflow: hidden;
  border: 1px solid rgba(22, 163, 74, 0.28);
  border-radius: 8px;
  background: #ffffff;
  color: #0f2744;
  box-shadow: 0 24px 60px rgba(8, 42, 77, 0.24);
  opacity: 0;
  pointer-events: auto;
  transform: translateY(-12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.egs-cart-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.egs-cart-toast.is-error {
  border-color: rgba(220, 38, 38, 0.32);
}

.egs-cart-toast-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(22, 163, 74, 0.11);
  color: #15803d;
}

.egs-cart-toast.is-error .egs-cart-toast-icon {
  background: rgba(220, 38, 38, 0.1);
  color: #b91c1c;
}

.egs-cart-toast-icon svg {
  width: 20px;
  height: 20px;
}

.egs-cart-toast-copy {
  min-width: 0;
}

.egs-cart-toast-copy strong {
  display: block;
  margin-bottom: 3px;
  font-size: 14px;
}

.egs-cart-toast-copy p {
  margin: 0;
  overflow: hidden;
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.egs-cart-toast-close {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.egs-cart-toast-close:hover {
  background: #f1f5f9;
  color: #0f2744;
}

.egs-cart-toast-actions {
  grid-column: 2 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.egs-cart-toast-actions a {
  min-height: 38px;
}

.egs-cart-toast-cart {
  border-color: rgba(15, 39, 68, 0.16) !important;
  color: #0f2744;
}

.cart-badge.is-updated,
.egs-mobile-dock-badge.is-updated {
  animation: egsCartBadgePop 0.38s ease;
}

.is-cart-loading {
  cursor: wait !important;
  opacity: 0.72;
}

.is-cart-loading svg {
  animation: egsCartSpin 0.8s linear infinite;
}

@keyframes egsCartBadgePop {
  50% { transform: scale(1.35); }
}

@keyframes egsCartSpin {
  to { transform: rotate(360deg); }
}

html.theme-dark .egs-mini-cart,
html.theme-dark .egs-cart-toast {
  border-color: rgba(255, 255, 255, 0.13);
  background: #111c2a;
  color: #ecfff4;
  box-shadow: 0 28px 68px rgba(0, 0, 0, 0.48);
}

html.theme-dark .egs-mini-cart-head,
html.theme-dark .egs-mini-cart-item,
html.theme-dark .egs-mini-cart-more {
  border-color: rgba(255, 255, 255, 0.09);
}

html.theme-dark .egs-mini-cart-head small,
html.theme-dark .egs-mini-cart-copy > small,
html.theme-dark .egs-mini-cart-copy em,
html.theme-dark .egs-mini-cart-empty small,
html.theme-dark .egs-mini-cart-total span,
html.theme-dark .egs-cart-toast-copy p {
  color: #9fb2aa;
}

html.theme-dark .egs-mini-cart-head > a,
html.theme-dark .egs-mini-cart-empty > span {
  color: #7defa0;
}

html.theme-dark .egs-mini-cart-item:hover,
html.theme-dark .egs-mini-cart-more,
html.theme-dark .egs-cart-toast-close:hover {
  background: rgba(255, 255, 255, 0.055);
}

html.theme-dark .egs-mini-cart-media {
  border-color: rgba(255, 255, 255, 0.12);
  background: #f8fafc;
}

html.theme-dark .egs-mini-cart-copy > strong,
html.theme-dark .egs-mini-cart-copy > span,
html.theme-dark .egs-mini-cart-total strong,
html.theme-dark .egs-cart-toast-copy strong {
  color: #ecfff4;
}

html.theme-dark .egs-mini-cart-footer {
  background: #111c2a;
}

html.theme-dark .egs-mini-cart-secondary,
html.theme-dark .egs-cart-toast-cart {
  border-color: rgba(255, 255, 255, 0.16) !important;
  background: rgba(255, 255, 255, 0.055);
  color: #ecfff4;
}

html.theme-dark .egs-cart-toast-close {
  color: #9fb2aa;
}

[data-mini-cart-remaining][hidden],
[data-mini-cart-footer][hidden],
[data-cart-badge][hidden],
.egs-cart-empty[hidden],
.egs-cart-form[hidden],
[data-cart-page-form][hidden],
[data-cart-checkout-wrap][hidden],
.egs-mini-cart-empty[hidden] {
  display: none !important;
}

@media (max-width: 1024px) {
  .egs-mini-cart {
    right: 0;
    left: auto;
    width: min(360px, calc(100vw - 20px));
  }
}

@media (max-width: 600px) {
  .header-cart.is-open .egs-mini-cart {
    position: fixed;
    top: calc(68px + env(safe-area-inset-top, 0px));
    right: max(10px, env(safe-area-inset-right, 0px));
    left: max(10px, env(safe-area-inset-left, 0px));
    width: auto;
  }

  .egs-mini-cart {
    width: min(366px, calc(100vw - 24px));
  }

  .egs-mini-cart-items {
    max-height: min(344px, 43vh);
  }

  .egs-mini-cart-actions {
    grid-template-columns: 1fr;
  }

  .egs-cart-toast-region {
    top: auto;
    right: 16px;
    bottom: calc(82px + env(safe-area-inset-bottom, 0px));
  }

  .egs-cart-toast {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    padding: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .egs-mini-cart,
  .egs-cart-toast {
    transition: none;
  }

  .cart-badge.is-updated,
  .is-cart-loading svg {
    animation: none;
  }
}

.egs-cart-item.is-busy {
  opacity: 0.55;
  pointer-events: none;
}

.egs-cart-item.is-removing {
  opacity: 0;
  transform: translateX(12px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

[data-cart-save-status].is-saving {
  color: #0f6fb8;
}

[data-cart-save-status].is-saved {
  color: #15803d;
}

[data-cart-save-status].is-error {
  color: #dc2626;
}

/* Checkout consent checkboxes */
.egs-consent {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid rgba(15, 79, 120, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.egs-consent:hover {
  border-color: rgba(22, 163, 74, 0.32);
  background: rgba(22, 163, 74, 0.04);
}

.egs-consent input[type="checkbox"] {
  grid-column: 1;
  grid-row: 1;
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
  min-height: 0 !important;
  max-height: none !important;
  box-shadow: none !important;
  border: none !important;
  border-radius: 0 !important;
  appearance: none;
  -webkit-appearance: none;
}

.egs-consent-mark {
  grid-column: 1;
  grid-row: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1.5px solid rgba(15, 79, 120, 0.22);
  border-radius: 6px;
  background: #fff;
  pointer-events: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.egs-consent-mark::after {
  content: "";
  width: 6px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  margin-top: -2px;
  transition: transform 0.12s ease;
}

.egs-consent input:checked + .egs-consent-mark {
  background: #16a873;
  border-color: #16a873;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.28);
}

.egs-consent input:checked + .egs-consent-mark::after {
  transform: rotate(45deg) scale(1);
}

.egs-consent input:focus-visible + .egs-consent-mark {
  outline: 2px solid rgba(22, 163, 74, 0.45);
  outline-offset: 2px;
}

.egs-consent-text {
  grid-column: 2;
  grid-row: 1;
  color: #476176;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.55;
}

.egs-consent-text a {
  color: #0f6fb8;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.egs-consent-text a:hover {
  color: #16a873;
}

html.theme-dark .egs-consent {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.045);
}

html.theme-dark .egs-consent:hover {
  border-color: rgba(74, 222, 128, 0.28);
  background: rgba(22, 163, 74, 0.08);
}

html.theme-dark .egs-consent-mark {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.16);
}

html.theme-dark .egs-consent-text {
  color: rgba(224, 242, 233, 0.82);
}

html.theme-dark .egs-consent-text a {
  color: #7dd3fc;
}

html.theme-dark .egs-consent-text a:hover {
  color: #86efac;
}
