/* Variables referenced below but never defined by styles.css. Values match the
   design tokens in styles.css so toasts/modals render as intended. */
:root {
  --brand-green: #175c33;
  --shadow-pop: 0 24px 70px rgba(10, 39, 23, 0.32);
  --stone-500: #44584a;
  --stone-900: #10281a;
}

/* messages.html uses .btn.btn-primary for the modal's Close action; styles.css
   only ships .btn-gold/.btn-leaf/.btn-ghost, so define the missing variant. */
.btn-primary {
  background: var(--leaf-600, #1e7a3f);
  color: var(--white, #ffffff);
}
.btn-primary:hover { background: var(--pine-700, #175c33); }

.message-layer {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.message-toast {
  --toast-bg: rgba(25, 83, 54, 0.96);
  --toast-accent: var(--brand-green);
  --toast-text: #fff;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: min(360px, calc(100vw - 2rem));
  background: var(--toast-bg);
  color: var(--toast-text);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0.9rem;
  padding: 0.8rem 0.85rem 0.8rem 0.7rem;
  box-shadow: var(--shadow-pop);
  pointer-events: auto;
  animation: toastIn 0.28s ease-out both;
}

.message-toast.is-closing {
  animation: toastOut 0.25s ease-in forwards;
}

.message-toast--success {
  --toast-bg: rgba(5, 150, 105, 0.97);
  --toast-accent: #34d399;
}

.message-toast--warning {
  --toast-bg: rgba(120, 53, 15, 0.97);
  --toast-accent: #fbbf24;
}

.message-toast--error {
  --toast-bg: rgba(153, 27, 27, 0.97);
  --toast-accent: #fca5a5;
}

.message-toast--info {
  --toast-bg: rgba(12, 74, 110, 0.97);
  --toast-accent: #7dd3fc;
}

.message-toast__icon {
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.14);
  color: var(--toast-accent);
  font-weight: 700;
  font-size: 0.9rem;
}

.message-toast__content {
  flex: 1;
  min-width: 0;
}

.message-toast__title {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.9;
  margin-bottom: 0.15rem;
}

.message-toast__content p {
  margin: 0;
  font-size: 0.83rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.96);
}

.message-toast__close,
.message-modal__close {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  line-height: 1;
  font-size: 1.25rem;
  padding: 0.15rem;
}

.message-toast__close {
  margin-left: 0.25rem;
}

.message-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  place-items: center;
  background: rgba(12, 10, 9, 0.55);
  padding: 1rem;
  pointer-events: auto;
  animation: backdropIn 0.2s ease-out both;
}

.message-modal-backdrop.is-closing {
  animation: backdropOut 0.2s ease-in forwards;
}

.message-modal {
  --modal-bg: #fff;
  --modal-accent: var(--brand-green);
  position: relative;
  width: min(460px, calc(100vw - 2rem));
  background: var(--modal-bg);
  border-radius: 1.1rem;
  border: 1px solid rgba(25, 83, 54, 0.12);
  box-shadow: var(--shadow-pop);
  padding: 1.25rem 1.25rem 1rem;
  animation: modalIn 0.25s ease-out both;
}

.message-modal-backdrop.is-closing .message-modal {
  animation: modalOut 0.2s ease-in forwards;
}

.message-modal--success { --modal-accent: #10b981; }
.message-modal--warning { --modal-accent: #f59e0b; }
.message-modal--error { --modal-accent: #ef4444; }
.message-modal--info { --modal-accent: #0284c7; }

.message-modal__close {
  position: absolute;
  right: 1rem;
  top: 0.85rem;
  color: var(--stone-500);
  font-size: 1.5rem;
}

.message-modal__icon {
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--modal-accent) 12%, white);
  color: var(--modal-accent);
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 0.9rem;
}

.message-modal__body {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.message-modal__eyebrow {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--modal-accent);
}

.message-modal__body h3 {
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--stone-900);
  margin: 0;
}

.message-modal__actions {
  margin-top: 1.1rem;
  display: flex;
  justify-content: flex-end;
}