/* Feedback card (core/toast.ts, issue #227). Loaded on every _LiveLayout page.
   One card holds every visible message as a row; the history panel keeps what has gone. */

.lf-toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1200;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.lf-toast-card {
  pointer-events: auto;
  border-radius: 8px;
  overflow: hidden;
  background: #212529;
  color: #fff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  font-size: 0.85rem;
  animation: lf-toast-in 0.18s ease-out;
}
.lf-toast-card[hidden] { display: none; }
.lf-toast-card-success { background: #146c43; }
.lf-toast-card-warning { background: #b25e09; }
.lf-toast-card-error { background: #b02a37; }
.lf-toast-card-info { background: #0a58ca; }

.lf-toast-list {
  display: flex;
  flex-direction: column;
  max-height: min(40vh, 320px);
  overflow-y: auto;
}

.lf-toast {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.55rem 0.7rem;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}
.lf-toast:first-child { border-top: 0; }
.lf-toast-out { animation: lf-toast-out 0.2s ease-in forwards; }

.lf-toast-text { flex: 1 1 auto; word-break: break-word; }
.lf-toast-count {
  flex: 0 0 auto;
  font-weight: 600;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}
.lf-toast-count[hidden] { display: none; }

.lf-toast-close,
.lf-toast-action {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  padding: 0;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
}
.lf-toast-close:hover,
.lf-toast-action:hover { color: #fff; }

.lf-toast-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.9rem;
  padding: 0.3rem 0.7rem;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.12);
  font-size: 0.78rem;
}
.lf-toast-actions[hidden],
.lf-toast-action[hidden] { display: none; }
.lf-toast-action { display: inline-flex; align-items: center; gap: 0.3rem; }

/* Time left. Paused with the timer (hover, focus, hidden tab), so the bar never lies. */
.lf-toast-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background: rgba(255, 255, 255, 0.55);
  transform-origin: left;
  animation: lf-toast-progress linear forwards;
}
.lf-toast-progress[hidden] { display: none; }
.lf-toast-card.is-paused .lf-toast-progress { animation-play-state: paused; }

@keyframes lf-toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes lf-toast-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes lf-toast-progress { from { transform: scaleX(1); } to { transform: scaleX(0); } }

@media (prefers-reduced-motion: reduce) {
  .lf-toast-card, .lf-toast-out { animation: none; }
  .lf-toast-progress { display: none; }
}

/* History panel */
.lf-toast-history {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1210;
  width: min(420px, calc(100vw - 32px));
  max-height: min(70vh, 560px);
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bs-body-bg, #fff);
  color: var(--bs-body-color, #212529);
  border: 1px solid var(--bs-border-color, #dee2e6);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
  font-size: 0.85rem;
}
.lf-toast-history[hidden] { display: none; }

.lf-toast-history-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--bs-border-color, #dee2e6);
}
.lf-toast-history-head strong { flex: 1 1 auto; }
.lf-toast-history-head select { max-width: 9rem; font-size: 0.78rem; }
.lf-toast-history-head button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0.25rem 0.35rem;
  border-radius: 4px;
  cursor: pointer;
}
.lf-toast-history-head button:hover { background: rgba(127, 127, 127, 0.2); }

.lf-toast-history-prefs {
  display: grid;
  gap: 0.4rem;
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--bs-border-color, #dee2e6);
}
.lf-toast-history-prefs label { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; }

.lf-toast-history-list { overflow-y: auto; }
.lf-toast-history-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid var(--bs-border-color-translucent, rgba(0, 0, 0, 0.08));
}
.lf-toast-history-text { flex: 1 1 auto; word-break: break-word; }
.lf-toast-history-item time { opacity: 0.6; font-size: 0.75rem; white-space: nowrap; }
.lf-toast-history-success i { color: #198754; }
.lf-toast-history-warning i { color: #d97706; }
.lf-toast-history-error i { color: #dc3545; }
.lf-toast-history-info i { color: #0d6efd; }
.lf-toast-history-empty { padding: 1.2rem; text-align: center; opacity: 0.65; }

/* Phone: the panel is a page of its own, and the card spans the width (#258). */
@media (max-width: 576px) {
  .lf-toast-stack { left: 8px; right: 8px; bottom: 8px; width: auto; }
  .lf-toast-history { inset: 0; width: auto; max-height: none; border-radius: 0; border: 0; }
}

/* A row keeps its own kind visible inside a card coloured by the most severe one. */
.lf-toast-success { box-shadow: inset 3px 0 0 #75d9a3; }
.lf-toast-warning { box-shadow: inset 3px 0 0 #ffc46b; }
.lf-toast-error { box-shadow: inset 3px 0 0 #ff9aa4; }
.lf-toast-info { box-shadow: inset 3px 0 0 #8bb9fe; }
