/* ==========================================================================
   mohtava-toast — hot-toast style notifications
   Companion stylesheet for /js/toast.js
   All classes are prefixed with `mht-` to avoid clashing with theme styles.
   Colours read the theme design tokens through `var(--token, fallback)`, so the
   file drops into any of the shop_* themes unchanged.
   Placement: TOP CENTRE, below the fixed header. Toasts slide down on entry.
   ========================================================================== */

.mht-root {
  position: fixed;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  direction: rtl;
  text-align: center;
  /* Top-centre. `inset-inline: 0` + `margin-inline: auto` centres the box without
     a transform, so it stays centred in both LTR and RTL. The top offset clears
     the theme's fixed header. */
  inset-inline: 0;
  margin-inline: auto;
  top: 84px;
  bottom: auto;
  width: 360px;
  max-width: calc(100vw - 32px);
}

.mht-toast {
  pointer-events: auto;
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px 15px;
  background: var(--shop-surface, #fff);
  border: 1px solid var(--shop-line, #e8e4dc);
  border-radius: 18px;
  box-shadow: var(--shop-shadow-md, 0 22px 60px -30px rgba(24, 24, 27, .32));
  overflow: hidden;
  color: var(--shop-ink, #202126);
  font-family: inherit;
  transform: translateY(-14px) scale(.97);
  opacity: 0;
  transition: transform .28s cubic-bezier(.2, .9, .3, 1.15), opacity .24s ease;
}

.mht-toast.mht-in {
  transform: none;
  opacity: 1;
}

.mht-toast.mht-out {
  transform: translateY(-10px) scale(.97);
  opacity: 0;
}

/* ---------- Icon ---------- */

.mht-icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mht-icon svg {
  width: 18px;
  height: 18px;
}

.mht-icon--success,
.mht-icon--cart {
  background: color-mix(in srgb, var(--color-primary, #e6123d) 14%, transparent);
  color: var(--color-primary, #e6123d);
}

.mht-icon--error {
  background: rgba(198, 58, 58, .12);
  color: #c03a3a;
}

.mht-icon--info {
  background: rgba(32, 33, 38, .08);
  color: var(--shop-ink, #202126);
}

.mht-icon--loading {
  background: rgba(32, 33, 38, .06);
  color: var(--shop-muted, #72747c);
}

/* ---------- Body ---------- */

.mht-body {
  flex: 1 1 auto;
  min-width: 0;
  padding-top: 2px;
}

.mht-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1.7;
}

.mht-desc {
  margin: 2px 0 0;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.8;
  color: var(--shop-muted, #72747c);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.mht-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--color-primary, #e6123d);
  color: #fff !important;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none !important;
  transition: background .2s ease, transform .2s ease;
}

.mht-action:hover {
  background: var(--color-primary-dark, #c00f33);
  transform: translateY(-1px);
}

.mht-action svg {
  width: 14px;
  height: 14px;
}

/* ---------- Close ---------- */

.mht-close {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  margin: -2px -4px 0 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--shop-muted, #72747c);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}

.mht-close:hover {
  background: rgba(32, 33, 38, .07);
  color: var(--shop-ink, #202126);
}

.mht-close svg {
  width: 14px;
  height: 14px;
}

/* ---------- Progress bar ---------- */

.mht-progress {
  display: block;
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 3px;
  background: rgba(32, 33, 38, .07);
}

.mht-progress-bar {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: right center;
  background: var(--color-primary, #e6123d);
  animation-name: mht-shrink;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

.mht-toast--error .mht-progress-bar {
  background: #c03a3a;
}

.mht-toast--info .mht-progress-bar,
.mht-toast--loading .mht-progress-bar {
  background: var(--shop-muted, #72747c);
}

@keyframes mht-shrink {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

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

.mht-spin {
  animation: mht-rotate .8s linear infinite;
}

/* ---------- Mobile ---------- */

@media (max-width: 639px) {
  .mht-root {
    inset-inline: 12px;
    margin-inline: 0;
    top: 72px;
    width: auto;
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mht-toast {
    transition: opacity .2s ease;
    transform: none;
  }
  .mht-toast.mht-out {
    transform: none;
  }
}
