/* =====================================================================
   SALAO 1.0 — Componentes compartilhados (temáveis)
   Toasts · Skeleton (shimmer) · Empty-state.
   Aditivo: depende dos tokens de :root (painel.css / vitrine.css), portanto
   funciona no tema claro e no escuro sem ajuste — basta o data-theme trocar
   os valores das variáveis. Todo movimento tem contrapartida em
   prefers-reduced-motion. Contraste AA mantido pelas cores de acento.
   ===================================================================== */

/* Tokens locais derivados dos globais. Centralizam os ajustes de cor por
   tipo e seguem o tema automaticamente (referenciam --rose/--gold/etc.). */
:root {
  --toast-bg: #fff;
  --toast-fg: var(--ink-900);
  --toast-muted: var(--ink-600);
  --toast-radius: 14px;
  --toast-shadow: 0 14px 38px rgba(10, 36, 23, .18);
  --toast-width: 360px;

  --skeleton-base: var(--cream-100);
  --skeleton-shine: rgba(255, 255, 255, .65);
}

/* =====================================================================
   TOASTS
   ===================================================================== */

/* Pilha fixa no canto superior-direito; empilha de cima para baixo. */
.toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 4000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: var(--toast-width);
  max-width: calc(100vw - 36px);
  pointer-events: none; /* a pilha não intercepta cliques; cada toast reativa */
}

/* Cartão do toast. Borda esquerda de acento conforme o tipo. */
.salao-toast {
  pointer-events: auto;
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 11px;
  padding: 13px 14px 13px 15px;
  background: var(--toast-bg);
  color: var(--toast-fg);
  border: 1px solid var(--line);
  border-left: 4px solid var(--rose-500);
  border-radius: var(--toast-radius);
  box-shadow: var(--toast-shadow);
  overflow: hidden;
  /* entrada deslizante a partir da direita */
  animation: toastIn .34s cubic-bezier(.22, .61, .36, 1) both;
}

/* Estado de saída (controlado pelo JS) */
.salao-toast.is-leaving {
  animation: toastOut .26s cubic-bezier(.4, 0, 1, 1) both;
}

/* Ícone à esquerda, em pastilha colorida por tipo */
.salao-toast .st-ico {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  line-height: 1;
  flex-shrink: 0;
  background: var(--rose-100);
  color: var(--rose-500);
}

/* Bloco de texto */
.salao-toast .st-body { min-width: 0; padding-top: 1px; }
.salao-toast .st-title {
  font-weight: 700;
  font-size: .9rem;
  line-height: 1.25;
  margin: 0 0 1px;
  color: var(--toast-fg);
}
.salao-toast .st-msg {
  font-size: .86rem;
  line-height: 1.35;
  color: var(--toast-muted);
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
/* Sem título: a mensagem assume o peso principal */
.salao-toast.no-title .st-msg { color: var(--toast-fg); font-weight: 500; }

/* Botão fechar */
.salao-toast .st-close {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--toast-muted);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .15s ease, color .15s ease;
}
.salao-toast .st-close:hover { background: var(--cream-100); color: var(--toast-fg); }
.salao-toast .st-close:focus-visible { outline: 2px solid var(--rose-400); outline-offset: 2px; }

/* Barra de tempo opcional (largura animada pelo JS via --st-dur) */
.salao-toast .st-timer {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  transform-origin: left;
  background: var(--rose-400);
  opacity: .9;
  animation: toastTimer var(--st-dur, 4000ms) linear forwards;
}

/* ---- Variantes por tipo (acento + pastilha do ícone) ---- */
.salao-toast--sucesso { border-left-color: var(--rose-500); }
.salao-toast--sucesso .st-ico { background: var(--rose-100); color: var(--rose-500); }
.salao-toast--sucesso .st-timer { background: var(--rose-400); }

.salao-toast--erro { border-left-color: #c0392b; }
.salao-toast--erro .st-ico { background: #fdeceb; color: #b3261e; }
.salao-toast--erro .st-timer { background: #d6473b; }

.salao-toast--aviso { border-left-color: var(--gold-500); }
.salao-toast--aviso .st-ico { background: #fbf2da; color: #9c7826; }
.salao-toast--aviso .st-timer { background: var(--gold-500); }

.salao-toast--info { border-left-color: #2a5bd7; }
.salao-toast--info .st-ico { background: #eaf0fb; color: #2a5bd7; }
.salao-toast--info .st-timer { background: #3f6fe0; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(28px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
@keyframes toastOut {
  from { opacity: 1; transform: none; max-height: 220px; }
  to   { opacity: 0; transform: translateX(36px); max-height: 0;
         margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; }
}
@keyframes toastTimer {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* No mobile: ocupa quase toda a largura, ancorado no topo */
@media (max-width: 575.98px) {
  .toast-stack {
    top: 12px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
  }
}

/* Sem movimento: aparece/some sem deslize nem barra de tempo correndo */
@media (prefers-reduced-motion: reduce) {
  .salao-toast { animation: none; }
  .salao-toast.is-leaving { animation: none; opacity: 0; }
  .salao-toast .st-timer { animation: none; transform: none; }
}

/* =====================================================================
   SKELETON — placeholders com shimmer enquanto carrega
   ===================================================================== */

/* Base: gradiente que desliza horizontalmente. */
.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: var(--skeleton-base);
  background-image: linear-gradient(
    100deg,
    transparent 20%,
    var(--skeleton-shine) 50%,
    transparent 80%
  );
  background-size: 220% 100%;
  background-repeat: no-repeat;
  background-position: -120% 0;
  animation: skelShimmer 1.4s ease-in-out infinite;
  user-select: none;
}
@keyframes skelShimmer {
  from { background-position: -120% 0; }
  to   { background-position: 220% 0; }
}

/* Variações de forma */
.skeleton-text {
  height: .8em;
  border-radius: 6px;
  margin: .35em 0;
}
.skeleton-text.sm { width: 40%; }
.skeleton-text.md { width: 65%; }
.skeleton-text.lg { width: 90%; }

.skeleton-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
}

.skeleton-card {
  width: 100%;
  height: 132px;
  border-radius: var(--radius, 18px);
}

/* Sem movimento: sem shimmer, fica um bloco estático suave */
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; background-image: none; }
}

/* =====================================================================
   EMPTY-STATE — estado vazio amigável de listas
   ===================================================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 48px 24px;
  color: var(--ink-600);
}

/* Círculo com ícone em degradê esmeralda suave */
.empty-state .es-ico {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 2rem;
  color: var(--rose-500);
  margin-bottom: 8px;
  background:
    radial-gradient(circle at 50% 35%, rgba(58, 168, 116, .22), transparent 70%),
    linear-gradient(135deg, var(--rose-100), var(--cream-100));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5),
              0 8px 22px rgba(36, 131, 85, .12);
}

.empty-state .es-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--ink-900); /* token de texto: escuro no claro, claro no escuro */
  margin: 0;
}
.empty-state .es-text {
  font-size: .92rem;
  max-width: 380px;
  margin: 0 auto;
  line-height: 1.5;
}
.empty-state .es-action { margin-top: 14px; }

/* Variante compacta para listas menores / dentro de cards */
.empty-state.sm { padding: 30px 18px; }
.empty-state.sm .es-ico { width: 60px; height: 60px; font-size: 1.6rem; }
.empty-state.sm .es-title { font-size: 1.05rem; }
