/*
 * Toasts das mensagens de flash ($this->flash) e da API JS window.CotaToast.
 * Markup gerado em app/library/Flash/ToastFlash.php e public/js/flash-toast.js.
 * Prefixo "cota-" para não colidir com o .toast do Bootstrap 5.
 */
.cota-toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 380px;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}

.cota-toast {
  --cota-toast-accent: #005CA9;
  --cota-toast-tint: #E6F0F8;
  --cota-toast-duration: 5000ms;

  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 12px 16px 16px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #E9EFF2;
  border-left: 4px solid var(--cota-toast-accent);
  border-radius: 10px;
  box-shadow: 0 10px 30px -12px rgba(48, 69, 88, .35), 0 2px 6px rgba(48, 69, 88, .08);
  color: #304558;
  font-family: Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  text-align: left;
  pointer-events: auto;
  animation: cota-toast-in .32s cubic-bezier(.21, 1.02, .73, 1) both;
}

.cota-toast--success { --cota-toast-accent: #00A167; --cota-toast-tint: #E3F8EF; }
.cota-toast--notice  { --cota-toast-accent: #166CB5; --cota-toast-tint: #E6F0F8; }
.cota-toast--warning { --cota-toast-accent: #D19F1F; --cota-toast-tint: #FDF5DC; }
.cota-toast--error   { --cota-toast-accent: #C44139; --cota-toast-tint: #FCE9E8; }

.cota-toast__icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--cota-toast-tint);
  color: var(--cota-toast-accent);
}

.cota-toast__icon svg {
  width: 18px;
  height: 18px;
}

.cota-toast__body {
  flex: 1 1 auto;
  min-width: 0;
  padding-top: 1px;
}

.cota-toast__title {
  display: block;
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 700;
  color: #304558;
}

.cota-toast__message {
  color: #50667A;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.cota-toast__close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: -4px -2px 0 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #7E91A3;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}

.cota-toast__close:hover {
  background: #F2F7FA;
  color: #304558;
}

.cota-toast__close:focus-visible {
  outline: 2px solid var(--cota-toast-accent);
  outline-offset: 1px;
}

.cota-toast__close svg {
  width: 16px;
  height: 16px;
}

/* Barra de tempo restante: o fim da animação dispara o fechamento (ver JS). */
.cota-toast__progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  background: var(--cota-toast-accent);
  opacity: .35;
  transform-origin: left center;
  transform: scaleX(0);
}

.cota-toast.is-timed .cota-toast__progress {
  animation: cota-toast-progress var(--cota-toast-duration) linear forwards;
}

.cota-toast:hover .cota-toast__progress,
.cota-toast:focus-within .cota-toast__progress {
  animation-play-state: paused;
}

.cota-toast.is-leaving {
  animation: cota-toast-out .22s ease-in forwards;
}

@keyframes cota-toast-in {
  from { opacity: 0; transform: translateX(24px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

@keyframes cota-toast-out {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translateX(24px) scale(.98); }
}

@keyframes cota-toast-progress {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

@media (max-width: 576px) {
  .cota-toast-stack {
    top: 8px;
    right: 8px;
    left: 8px;
    width: auto;
    max-width: none;
  }

  @keyframes cota-toast-in {
    from { opacity: 0; transform: translateY(-16px); }
    to   { opacity: 1; transform: none; }
  }

  @keyframes cota-toast-out {
    from { opacity: 1; transform: none; }
    to   { opacity: 0; transform: translateY(-16px); }
  }
}

@media (prefers-reduced-motion: reduce) {
  .cota-toast,
  .cota-toast.is-leaving {
    animation-duration: 1ms;
  }

  /* O cronômetro continua valendo; só a barra deixa de ser exibida. */
  .cota-toast__progress {
    visibility: hidden;
  }
}

@media print {
  .cota-toast-stack {
    display: none;
  }
}
