/* ============================================================
   Primitivas de interface (porte do que o shadcn/radix, sonner e tw-animate-css davam ao SPA):
   toasts, diálogos, sheets, popover, tooltip e as animações de entrada/saída.
   ============================================================ */

/* ---- Toasts (sonner) ---- */
.o-toasts {
  position: fixed; right: 16px; bottom: 16px; z-index: 100;
  display: flex; flex-direction: column; gap: 8px; width: 356px; max-width: calc(100vw - 32px);
  pointer-events: none;
}
.o-toast {
  pointer-events: auto; display: flex; gap: 10px; align-items: flex-start;
  background: var(--background); color: var(--foreground);
  border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,.6);
  font-size: 13px; line-height: 1.35;
  opacity: 0; transform: translateY(12px); transition: opacity .25s ease, transform .25s ease;
  cursor: pointer;
}
.o-toast svg { flex: none; margin-top: 1px; }
.o-toast-visivel { opacity: 1; transform: translateY(0); }
.o-toast-titulo { font-weight: 500; }
.o-toast-desc { color: var(--muted-foreground); margin-top: 2px; font-size: 12px; }

/* ---- Diálogos e sheets (radix Dialog / Sheet / AlertDialog) ---- */
@keyframes o-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes o-zoom-in { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: scale(1); } }
@keyframes o-slide-direita { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes o-slide-esquerda { from { transform: translateX(-100%); } to { transform: translateX(0); } }
@keyframes o-slide-baixo { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes o-slide-cima { from { transform: translateY(-100%); } to { transform: translateY(0); } }
.o-fade { animation: o-fade-in .15s ease-out; }
.o-dialogo { position: relative; animation: o-zoom-in .2s ease-out; max-height: calc(100vh - 2rem); overflow-y: auto; }
.o-sheet { transition: transform .3s ease-in-out; }
.o-sheet-direita { animation: o-slide-direita .5s ease-in-out; }
.o-sheet-esquerda { animation: o-slide-esquerda .5s ease-in-out; }
.o-sheet-baixo { animation: o-slide-baixo .5s ease-in-out; }
.o-sheet-cima { animation: o-slide-cima .5s ease-in-out; }

/* ---- Popover (radix Popover) ---- */
.o-popover {
  position: absolute; z-index: 50; margin-top: 8px;
  background: var(--popover); color: var(--popover-foreground);
  border: 1px solid oklch(1 0 0 / 0.10); border-radius: 8px;
  animation: o-zoom-in .15s ease-out; transform-origin: top left;
}
.o-popover[hidden] { display: none; }

/* ---- Tooltip (radix Tooltip): title nativo não é estilizável; data-dica mostra balão ---- */
[data-dica] { position: relative; }
[data-dica]::after {
  content: attr(data-dica); position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%);
  background: var(--primary); color: var(--primary-foreground); font-size: 12px; line-height: 1.3;
  padding: 6px 10px; border-radius: 6px; white-space: pre-line; max-width: 280px; width: max-content;
  opacity: 0; pointer-events: none; transition: opacity .12s ease; z-index: 60; text-align: left; font-weight: 400;
}
[data-dica]:hover::after, [data-dica]:focus-visible::after { opacity: 1; }
[data-dica-baixo]::after { bottom: auto; top: calc(100% + 6px); }

/* ---- Animações utilitárias (tailwindcss-animate / tw-animate-css usadas nas telas) ---- */
@keyframes o-spin { to { transform: rotate(360deg); } }
.animate-spin { animation: o-spin 1s linear infinite; }
@keyframes o-ping { 75%, 100% { transform: scale(2); opacity: 0; } }
.animate-ping { animation: o-ping 1s cubic-bezier(0, 0, 0.2, 1) infinite; }
@keyframes o-pulse { 50% { opacity: .5; } }
.animate-pulse { animation: o-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
@keyframes o-bounce { 0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(0.8,0,1,1); } 50% { transform: none; animation-timing-function: cubic-bezier(0,0,0.2,1); } }
.animate-bounce { animation: o-bounce 1s infinite; }
.animate-in { animation: o-entrar .2s ease-out both; }
@keyframes o-entrar { from { opacity: var(--o-de-opacidade, 0); transform: translate3d(var(--o-de-x, 0), var(--o-de-y, 0), 0) scale(var(--o-de-escala, 1)); } to { opacity: 1; transform: none; } }
.fade-in-0 { --o-de-opacidade: 0; }
.fade-in { --o-de-opacidade: 0; }
.zoom-in-95 { --o-de-escala: .95; }
.slide-in-from-bottom-2 { --o-de-y: .5rem; }
.slide-in-from-bottom-4 { --o-de-y: 1rem; }
.slide-in-from-top-2 { --o-de-y: -.5rem; }
.slide-in-from-right-4 { --o-de-x: 1rem; }
.slide-in-from-left-4 { --o-de-x: -1rem; }
.duration-200 { animation-duration: .2s; }
.duration-300 { animation-duration: .3s; }
.duration-500 { animation-duration: .5s; }

/* ---- Acessibilidade ---- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ---- Select escuro (option herda fundo do navegador) ---- */
select option { background: #14161a; color: var(--foreground); }

/* ---- Barra de rolagem fina nas listas internas ---- */
.o-rolagem { scrollbar-width: thin; scrollbar-color: oklch(1 0 0 / 0.15) transparent; }
.o-rolagem::-webkit-scrollbar { width: 6px; height: 6px; }
.o-rolagem::-webkit-scrollbar-thumb { background: oklch(1 0 0 / 0.15); border-radius: 999px; }

/* ---- Marcação do Zeus (texto com **negrito** e listas simples) ---- */
.o-md p { margin: 0 0 .5em; }
.o-md p:last-child { margin-bottom: 0; }
.o-md ul { margin: 0 0 .5em; padding-left: 1.2em; list-style: disc; }
.o-md strong { color: var(--foreground); font-weight: 600; }
.o-md code { font-family: ui-monospace, monospace; font-size: .92em; background: oklch(1 0 0 / 0.06); padding: 0 .3em; border-radius: 4px; }
