/* assets/css/pwa-update-toast.css */
/* Toast notification for PWA updates */

.pwa-update-toast {
  position: fixed;
  bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
  left: 1rem;
  right: 1rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
  background: linear-gradient(135deg, #2ECC71 0%, #27AE60 100%);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(46, 204, 113, 0.3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-weight: 600;
  z-index: 99999;
  animation: pwaToastSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pwa-update-toast__content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.pwa-update-toast__icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.pwa-update-toast__text {
  font-size: 0.95rem;
  white-space: nowrap;
}

.pwa-update-toast__actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.pwa-update-toast__btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.pwa-update-toast__btn--primary {
  background: white;
  color: #2ECC71;
}

.pwa-update-toast__btn--primary:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.pwa-update-toast__btn--primary:active {
  transform: scale(0.98);
}

.pwa-update-toast__btn--primary.is-loading {
  opacity: 0.8;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* Spinner sits before the 'Updating…' text */
.pwa-update-toast__btn--primary.is-loading::before {
  content: '';
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  border: 2px solid #2ECC71;
  border-top-color: transparent;
  border-radius: 50%;
  animation: pwaBtnSpin 0.6s linear infinite;
  flex-shrink: 0;
}

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

.pwa-update-toast__btn--secondary {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.pwa-update-toast__btn--secondary:hover {
  background: rgba(255, 255, 255, 0.3);
}

.pwa-update-toast__btn--secondary:active {
  background: rgba(255, 255, 255, 0.15);
}

@keyframes pwaToastSlideUp {
  from {
    transform: translateY(120%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Mobile: stack buttons vertically if space tight */
@media (max-width: 480px) {
  .pwa-update-toast {
    flex-direction: column;
    align-items: stretch;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    left: 0.5rem;
    right: 0.5rem;
  }

  .pwa-update-toast__content {
    justify-content: space-between;
  }

  .pwa-update-toast__actions {
    width: 100%;
  }

  .pwa-update-toast__btn {
    flex: 1;
    padding: 0.75rem 1rem;
  }
}

/* ── Moderation approval toast ─────────────────────────────────────────────── */
.moderation-toast {
  position: fixed;
  bottom: calc(2rem + 20px);
  left: 1rem;
  right: 1rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
  background: #2ECC71;
  color: white;
  padding: 0.9rem 1.25rem;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(46, 204, 113, 0.35);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  z-index: 99999;
  opacity: 0;
  transform: translateY(120%);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.moderation-toast--visible {
  opacity: 1;
  transform: translateY(0);
}

/* Rejection variant — red instead of green */
.moderation-toast--rejected {
  background: #B33939;
  box-shadow: 0 4px 16px rgba(179, 57, 57, 0.35);
}

@media (max-width: 480px) {
  .moderation-toast {
    bottom: calc(1rem + 20px);
    left: 0.5rem;
    right: 0.5rem;
  }
}