/*****************************
M3yar — Toast notifications
*****************************/

.m3-toast-host {
  position: fixed;
  inset-inline: 0;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  pointer-events: none;
}

.m3-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(100%, 420px);
  padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, #4A2C2A 0%, #2C1810 100%);
  color: #F5F0EB;
  box-shadow:
    0 16px 40px rgba(44, 24, 16, 0.28),
    0 0 0 1px rgba(196, 165, 116, 0.28) inset;
  transform: translateY(18px) scale(0.96);
  opacity: 0;
  transition:
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.28s ease;
}

.m3-toast.is-in {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.m3-toast.is-out {
  transform: translateY(12px) scale(0.98);
  opacity: 0;
}

.m3-toast__icon {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(196, 165, 116, 0.2);
  color: #E8D5B5;
  font-size: 18px;
  animation: m3-toast-pop 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.m3-toast--favorite .m3-toast__icon {
  color: #ff6b81;
  background: rgba(255, 107, 129, 0.16);
}

.m3-toast--favorite .m3-toast__icon i {
  animation: m3-toast-heart 0.55s ease both;
}

.m3-toast__body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.m3-toast__title {
  margin: 0;
  font-family: "Cairo", sans-serif;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
  color: #fff;
}

.m3-toast__text {
  margin: 0;
  font-family: "Cairo", sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: rgba(245, 240, 235, 0.78);
  line-height: 1.4;
}

.m3-toast__action {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(196, 165, 116, 0.22);
  color: #E8D5B5;
  text-decoration: none;
  font-family: "Cairo", sans-serif;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}

.m3-toast__action:hover {
  background: #C4A574;
  color: #2C1810;
}

.m3-toast__close {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(245, 240, 235, 0.55);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 14px;
}

.m3-toast__close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.m3-toast--warn {
  background: linear-gradient(135deg, #8a3a3a 0%, #4a1f1f 55%, #2e1212 100%);
  box-shadow:
    0 18px 44px rgba(122, 51, 51, 0.38),
    0 0 0 1px rgba(255, 215, 168, 0.22) inset;
}

.m3-toast--warn .m3-toast__icon {
  position: relative;
  color: #ffe0b0;
  background: rgba(255, 215, 168, 0.18);
}

.m3-toast--warn .m3-toast__title {
  font-size: 15px;
  font-weight: 900;
}

.m3-toast--warn .m3-toast__text {
  color: rgba(255, 240, 230, 0.88);
  font-size: 12.5px;
  font-weight: 650;
}

.m3-toast--attention.is-in {
  transition: none;
  animation:
    m3-toast-attention 0.7s cubic-bezier(0.22, 1.25, 0.36, 1) both,
    m3-toast-glow 1.25s ease-in-out 0.55s 3;
}

.m3-toast--attention .m3-toast__icon {
  animation:
    m3-toast-pop 0.45s cubic-bezier(0.22, 1, 0.36, 1) both,
    m3-toast-icon-wiggle 0.85s ease-in-out 0.35s 2;
}

.m3-toast--attention .m3-toast__icon::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 16px;
  border: 2px solid rgba(255, 215, 168, 0.65);
  opacity: 0;
  pointer-events: none;
  animation: m3-toast-ring 1.15s ease-out 0.25s 3;
}

.m3-toast--remove {
  background: linear-gradient(135deg, #3d2420 0%, #2a1a16 100%);
}

.m3-toast--remove .m3-toast__icon {
  color: #E8D5B5;
  background: rgba(196, 165, 116, 0.14);
}

@keyframes m3-toast-pop {
  0% { transform: scale(0.6); }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes m3-toast-heart {
  0% { transform: scale(0.5); }
  45% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

@keyframes m3-toast-attention {
  0% {
    opacity: 0;
    transform: translateY(28px) scale(0.9);
  }
  55% {
    opacity: 1;
    transform: translateY(-4px) scale(1.03);
  }
  75% {
    transform: translateY(2px) scale(0.99);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes m3-toast-glow {
  0%, 100% {
    box-shadow:
      0 18px 44px rgba(122, 51, 51, 0.38),
      0 0 0 1px rgba(255, 215, 168, 0.22) inset,
      0 0 0 0 rgba(255, 215, 168, 0);
  }
  50% {
    box-shadow:
      0 20px 48px rgba(122, 51, 51, 0.46),
      0 0 0 1px rgba(255, 215, 168, 0.35) inset,
      0 0 0 6px rgba(255, 215, 168, 0.18);
  }
}

@keyframes m3-toast-icon-wiggle {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(-10deg) scale(1.08); }
  50% { transform: rotate(8deg) scale(1.05); }
  75% { transform: rotate(-5deg) scale(1.06); }
}

@keyframes m3-toast-ring {
  0% {
    opacity: 0.8;
    transform: scale(0.85);
  }
  100% {
    opacity: 0;
    transform: scale(1.55);
  }
}

@media (prefers-reduced-motion: reduce) {
  .m3-toast--attention,
  .m3-toast--attention.is-in,
  .m3-toast--attention .m3-toast__icon,
  .m3-toast--attention .m3-toast__icon::after {
    animation: none !important;
  }
}

@media (max-width: 576px) {
  .m3-toast-host {
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }

  .m3-toast {
    width: 100%;
    padding: 11px 12px;
    gap: 10px;
  }

  .m3-toast__icon {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }

  .m3-toast__title {
    font-size: 13px;
  }
}
