/* ===== Site alerts ===== */

.alert-container {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 18px;
  pointer-events: none;
}

.alert {
  --alert-accent: #ffd42a;
  --alert-accent-soft: rgba(255, 212, 42, 0.18);
  --alert-accent-glow: rgba(255, 212, 42, 0.28);
  width: min(346px, calc(100vw - 32px));
  min-height: 82px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  position: relative;
  overflow: hidden;
  padding: 15px 18px 15px 16px;
  border: 1px solid rgba(255, 255, 255, 0.035);
  border-radius: 7px;
  background:
    linear-gradient(90deg, var(--alert-accent-soft), rgba(34, 43, 49, 0) 38%),
    #222b31;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
  color: #fff;
  pointer-events: auto;
  transform: translateX(calc(100% + 28px));
  opacity: 0;
  transition: transform 0.28s ease, opacity 0.28s ease;
}

.alert.show {
  transform: translateX(0);
  opacity: 1;
}

.alert.success,
.alert.promo-success {
  --alert-accent: #00e58a;
  --alert-accent-soft: rgba(0, 229, 138, 0.16);
  --alert-accent-glow: rgba(0, 229, 138, 0.34);
}

.alert.warning,
.alert.info,
.alert.promo-expired,
.alert.promo-limit,
.alert.promo-already-used {
  --alert-accent: #ffd42a;
  --alert-accent-soft: rgba(255, 212, 42, 0.16);
  --alert-accent-glow: rgba(255, 212, 42, 0.34);
}

.alert.error,
.alert.promo-not-found {
  --alert-accent: #ff4e57;
  --alert-accent-soft: rgba(255, 78, 87, 0.16);
  --alert-accent-glow: rgba(255, 78, 87, 0.34);
}

.alert-content {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 16px;
  width: 100%;
}

.alert-icon {
  position: relative;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--alert-accent-soft);
  color: var(--alert-accent);
  text-shadow: 0 0 14px var(--alert-accent-glow);
  font-size: 0;
}

.alert-icon::before,
.alert-icon::after {
  content: "";
  position: absolute;
  display: block;
  background: currentColor;
  border-radius: 999px;
}

.alert.success .alert-icon::before,
.alert.promo-success .alert-icon::before {
  width: 14px;
  height: 7px;
  border-left: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
  background: transparent;
  border-radius: 1px;
  transform: translateY(-1px) rotate(-45deg);
}

.alert.error .alert-icon::before,
.alert.error .alert-icon::after,
.alert.promo-not-found .alert-icon::before,
.alert.promo-not-found .alert-icon::after {
  width: 15px;
  height: 3px;
}

.alert.error .alert-icon::before,
.alert.promo-not-found .alert-icon::before {
  transform: rotate(45deg);
}

.alert.error .alert-icon::after,
.alert.promo-not-found .alert-icon::after {
  transform: rotate(-45deg);
}

.alert.warning .alert-icon::before,
.alert.info .alert-icon::before,
.alert.promo-expired .alert-icon::before,
.alert.promo-limit .alert-icon::before,
.alert.promo-already-used .alert-icon::before {
  width: 4px;
  height: 13px;
  top: 7px;
}

.alert.warning .alert-icon::after,
.alert.info .alert-icon::after,
.alert.promo-expired .alert-icon::after,
.alert.promo-limit .alert-icon::after,
.alert.promo-already-used .alert-icon::after {
  width: 4px;
  height: 4px;
  bottom: 7px;
}

.alert-text {
  min-width: 0;
}

.alert-title {
  margin: 0 0 3px;
  color: #fff5f5;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.1;
}

.alert-message {
  margin: 0;
  color: rgba(255, 245, 245, 0.74);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.alert-timer {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 4px;
  background: var(--alert-accent);
  box-shadow: 0 -8px 24px var(--alert-accent-glow);
  transform-origin: left center;
  animation: alertTimerShrink var(--alert-duration, 5000ms) linear forwards;
}

@keyframes alertTimerShrink {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

@media (max-width: 768px) {
  .alert-container {
    right: 12px;
    bottom: 12px;
    gap: 12px;
  }

  .alert {
    width: min(346px, calc(100vw - 24px));
    padding: 14px 15px;
  }

  .alert-content {
    gap: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .alert,
  .alert-timer {
    transition: none;
    animation: none;
  }
}
