/* ============================================================
   nova-ux.css — Nova versão LBX
   UX/UI moderna preservando o design system existente:
   --pine #113c35 · --mint #b9e6d0 · --coral #df725b
   Playfair Display (títulos) · Manrope (texto) · DM Mono (dados)
   ============================================================ */

/* Acessibilidade: foco sempre visível */
:focus-visible {
  outline: 3px solid #20745f;
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Toasts ---------- */
.nova-toast-container {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 9000;
  display: grid;
  gap: 10px;
  max-width: min(380px, calc(100vw - 36px));
}

.nova-toast {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--paper, #fffefa);
  color: var(--ink, #172a28);
  box-shadow: 0 18px 50px rgba(24, 54, 47, 0.18);
  border-left: 5px solid var(--pine, #113c35);
  font: 500 0.9rem/1.5 Manrope, Arial, sans-serif;
  opacity: 0;
  transform: translateX(24px);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.nova-toast.show { opacity: 1; transform: translateX(0); }
.nova-toast p { margin: 0; flex: 1; }
.nova-toast-icon { font-weight: 800; line-height: 1.2; }

.nova-toast--success { border-left-color: #2e7d5b; }
.nova-toast--success .nova-toast-icon { color: #2e7d5b; }
.nova-toast--warning { border-left-color: #c98a1b; }
.nova-toast--warning .nova-toast-icon { color: #c98a1b; }
.nova-toast--error { border-left-color: #b4443c; }
.nova-toast--error .nova-toast-icon { color: #b4443c; }
.nova-toast--info .nova-toast-icon { color: var(--pine, #113c35); }

/* ---------- Skeletons ---------- */
.nova-skeleton-host { display: grid; gap: 12px; }
.nova-skeleton-line {
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(90deg, #e6eeea 25%, #f3f8f5 50%, #e6eeea 75%);
  background-size: 200% 100%;
  animation: nova-shimmer 1.4s infinite linear;
}
@keyframes nova-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* ---------- Botões ---------- */
.portal-button,
.nova-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: 0;
  border-radius: 9px;
  background: var(--pine, #113c35);
  color: #fff;
  font: 800 0.88rem/1 Manrope, sans-serif;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.portal-button:hover:not(:disabled),
.nova-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(17, 60, 53, 0.28);
  background: #0f332c;
}

.portal-button:active:not(:disabled) { transform: translateY(0); }
.portal-button:disabled { opacity: 0.55; cursor: not-allowed; }
.portal-button.busy { position: relative; color: transparent; }
.portal-button.busy::after {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: nova-spin 0.7s linear infinite;
}
@keyframes nova-spin { to { transform: rotate(360deg); } }

.ux-secondary {
  padding: 11px 18px;
  border: 1px solid var(--pine, #113c35);
  border-radius: 9px;
  background: transparent;
  color: var(--pine, #113c35);
  font: 800 0.85rem/1 Manrope, sans-serif;
  cursor: pointer;
  transition: background 0.18s ease;
}
.ux-secondary:hover { background: #eef5f1; }

/* ---------- Sticky header com sombra ---------- */
.portal-header { transition: box-shadow 0.25s ease; }
.portal-header.nova-stuck { box-shadow: 0 10px 30px rgba(13, 48, 43, 0.18); }

/* ---------- Badge de atualização no menu ---------- */
.nova-badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--coral, #df725b);
  color: #fff;
  font: 800 0.62rem/1 DM Mono, monospace;
}

/* ---------- Página de atualizações ---------- */
.nova-updates { display: grid; gap: 18px; }

.nova-update-card {
  background: var(--paper, #fffefa);
  border: 1px solid var(--line, #dce5e1);
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: var(--shadow, 0 18px 50px rgba(24, 54, 47, 0.09));
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.nova-update-card:hover { transform: translateY(-2px); box-shadow: 0 24px 60px rgba(24, 54, 47, 0.14); }

.nova-update-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.nova-update-module { font: 700 1.05rem "Playfair Display", serif; color: var(--ink, #172a28); }
.nova-version-tag {
  padding: 3px 10px;
  border-radius: 999px;
  background: #edf5f1;
  color: var(--pine, #113c35);
  font: 700 0.72rem DM Mono, monospace;
}
.nova-version-tag.pending { background: var(--coral, #df725b); color: #fff; }
.nova-critical-tag {
  padding: 3px 10px;
  border-radius: 999px;
  background: #fdf0ee;
  color: #b4443c;
  font: 800 0.68rem Manrope, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.nova-changelog { margin: 6px 0 0; color: var(--muted, #687572); font-size: 0.9rem; }
.nova-update-meta { margin: 10px 0 0; font: 500 0.74rem DM Mono, monospace; color: var(--muted, #687572); }

.nova-update-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

/* ---------- Versão do sistema no cabeçalho ---------- */
.lbx-version-tag {
  padding: 3px 10px;
  border-radius: 999px;
  background: #edf5f1;
  color: var(--pine, #113c35);
  font: 700 0.68rem DM Mono, monospace;
  white-space: nowrap;
  border: 1px solid var(--line, #dce5e1);
}

/* ---------- Versão em produção vs navegador ---------- */
.lbx-version-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.lbx-version-grid > div {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line, #dce5e1);
  background: #f7faf8;
  display: grid;
  gap: 4px;
}
.lbx-version-grid small {
  font: 800 0.66rem Manrope, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted, #687572);
}
.lbx-version-grid strong { font: 700 1.1rem DM Mono, monospace; color: var(--ink, #172a28); }
.lbx-version-grid span { font-size: 0.8rem; color: var(--muted, #687572); }

/* ---------- Upload da base LIA ---------- */
.nova-knowledge .knowledge-description { color: var(--muted, #687572); font-size: 0.92rem; }
.nova-knowledge code {
  padding: 2px 7px;
  border-radius: 6px;
  background: #edf5f1;
  color: var(--pine, #113c35);
  font: 700 0.74rem DM Mono, monospace;
}

.nova-dropzone-form { margin-top: 18px; }

.nova-dropzone {
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 34px 20px;
  border: 2px dashed #b8d4c9;
  border-radius: 14px;
  background: #f7faf8;
  color: var(--pine, #113c35);
  font: 700 0.95rem Manrope, sans-serif;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.nova-dropzone:hover, .nova-dropzone.dragover {
  border-color: var(--pine, #113c35);
  background: #eef5f1;
  transform: scale(1.005);
}
.nova-dropzone-icon { font-size: 1.9rem; }
.nova-dropzone small { font: 500 0.78rem Manrope, sans-serif; color: var(--muted, #687572); }

.nova-file-list { display: grid; gap: 10px; margin-top: 16px; }
.nova-file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line, #dce5e1);
  border-radius: 11px;
  background: #fff;
  transition: border-color 0.2s ease;
}
.nova-file-item.busy { border-color: #c9b27a; }
.nova-file-item.done { border-color: #9ed4b8; }
.nova-file-item.error { border-color: #e5a89d; }
.nova-file-icon { font-size: 1.25rem; }
.nova-file-name { flex: 1; font: 700 0.88rem Manrope, sans-serif; overflow-wrap: anywhere; }
.nova-file-size { font: 500 0.74rem DM Mono, monospace; color: var(--muted, #687572); }
.nova-file-state { font: 700 0.76rem DM Mono, monospace; color: var(--pine, #113c35); min-width: 92px; text-align: right; }
.nova-file-remove {
  border: 0;
  background: #eef2f0;
  color: var(--muted, #687572);
  width: 26px; height: 26px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.nova-file-remove:hover { background: #f6e3df; color: #b4443c; }

.nova-form-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.nova-status { min-height: 20px; margin: 12px 0 0; font: 600 0.84rem Manrope, sans-serif; }
.nova-status[data-kind="error"] { color: #b4443c; }
.nova-status[data-kind="success"] { color: #2e7d5b; }

.nova-preview {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line, #dce5e1);
}
.nova-preview h3 { font: 700 1.02rem "Playfair Display", serif; margin: 0 0 12px; }
.nova-preview-list { display: grid; gap: 10px; max-height: 340px; overflow: auto; padding-right: 6px; }
.nova-preview-item {
  padding: 12px 14px;
  border: 1px solid var(--line, #dce5e1);
  border-radius: 11px;
  background: #fff;
}
.nova-preview-item strong { display: block; font-size: 0.86rem; margin-bottom: 4px; }
.nova-preview-kind {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: #edf5f1;
  color: var(--pine, #113c35);
  font: 700 0.64rem DM Mono, monospace;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.nova-preview-item p { margin: 0; font-size: 0.82rem; color: var(--muted, #687572); white-space: pre-wrap; }

.nova-test { margin-top: 22px; }
.nova-test summary {
  cursor: pointer;
  font: 800 0.85rem Manrope, sans-serif;
  color: var(--pine, #113c35);
  padding: 8px 0;
}
.nova-test .search-line { display: flex; gap: 8px; margin: 10px 0; }
.nova-test .search-line input {
  flex: 1;
  border: 1px solid #cbd8d3;
  border-radius: 8px;
  padding: 11px 13px;
  font: inherit;
}

/* ---------- Empty state ---------- */
.nova-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 44px 20px;
  text-align: center;
  color: var(--muted, #687572);
}
.nova-empty-icon { font-size: 2.4rem; opacity: 0.7; }
.nova-empty h3 { margin: 0; font: 700 1.05rem "Playfair Display", serif; color: var(--ink, #172a28); }
.nova-empty p { margin: 0; max-width: 420px; font-size: 0.88rem; }

/* ---------- Banner de atualização crítica ---------- */
.nova-update-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 18px;
  padding: 14px 18px;
  border-radius: 12px;
  background: #fdf0ee;
  border: 1px solid #e5a89d;
  color: #7c2d27;
  font: 600 0.88rem Manrope, sans-serif;
}
.nova-update-banner .portal-button { padding: 9px 16px; font-size: 0.8rem; }

/* ---------- Responsivo ---------- */
@media (max-width: 700px) {
  .nova-toast-container { right: 12px; left: 12px; max-width: none; }
  .nova-update-card { padding: 16px; }
  .nova-file-item { flex-wrap: wrap; }
  .nova-file-state { min-width: 0; }
  .nova-form-actions .portal-button,
  .nova-form-actions .ux-secondary { width: 100%; }
}

/* ---------- Movimento reduzido ---------- */
@media (prefers-reduced-motion: reduce) {
  .nova-toast, .nova-update-card, .nova-dropzone, .portal-button { transition: none; }
  .nova-skeleton-line { animation: none; }
}

/* ---------- Conversa da LIA (menu Home / busca) ---------- */
.nova-chat {
  display: grid;
  gap: 14px;
  max-height: 540px;
  overflow: auto;
  padding: 6px 4px 4px;
}
.nova-chat-tools { display: flex; justify-content: flex-end; margin-top: 12px; }
.nova-msg { display: flex; gap: 10px; align-items: flex-start; max-width: 88%; }
.nova-msg--user { margin-left: auto; justify-content: flex-end; }
.nova-msg--user p {
  margin: 0;
  padding: 12px 16px;
  border-radius: 16px 16px 4px 16px;
  background: var(--pine, #113c35);
  color: #fff;
  font: 500 0.92rem/1.55 Manrope, sans-serif;
  box-shadow: 0 8px 24px rgba(17, 60, 53, 0.18);
}
.nova-msg-avatar {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--pine, #113c35);
  color: #d2ae72;
  font: 800 0.62rem DM Mono, monospace;
  letter-spacing: 0.04em;
}
.nova-msg-body {
  padding: 12px 16px;
  border-radius: 16px 16px 16px 4px;
  background: #f1f7f3;
  border: 1px solid var(--line, #dce5e1);
  color: var(--ink, #172a28);
}
.nova-msg-body p { margin: 0; font: 500 0.93rem/1.6 Manrope, sans-serif; white-space: pre-wrap; }
.nova-msg-status { display: block; margin-bottom: 6px; color: var(--coral, #df725b); font: 700 0.72rem/1.4 Manrope, sans-serif; }
.nova-msg-sources { margin-top: 10px; }
.nova-msg-sources summary { cursor: pointer; font: 800 0.76rem Manrope, sans-serif; color: var(--pine, #113c35); }
.nova-msg-sources ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted, #687572); font: 500 0.76rem/1.5 DM Mono, monospace; }
.nova-msg-sources li { margin-bottom: 3px; overflow-wrap: anywhere; }
.nova-typing-body { display: flex; gap: 5px; align-items: center; padding: 15px 18px; }
.nova-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--pine, #113c35);
  opacity: 0.35;
  animation: nova-blink 1.1s infinite ease-in-out;
}
.nova-dot:nth-child(2) { animation-delay: 0.18s; }
.nova-dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes nova-blink {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 0.9; transform: translateY(-2px); }
}

/* ---------- Vídeo da apresentação em popup ---------- */
.nova-video-modal {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: grid;
  place-items: center;
  padding: clamp(12px, 3vw, 40px);
  background: rgba(9, 26, 23, 0.82);
  animation: nova-fade 0.25s ease;
}
@keyframes nova-fade { from { opacity: 0; } to { opacity: 1; } }
.nova-video-frame { position: relative; width: min(1100px, 100%); max-height: 100%; display: grid; }
.nova-video-player {
  width: 100%;
  max-height: 78vh;
  border-radius: 14px;
  background: #000;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.nova-video-close {
  position: absolute;
  top: -14px; right: -14px;
  width: 40px; height: 40px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: var(--pine, #113c35);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.nova-video-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 84px; height: 84px;
  border: 0;
  border-radius: 50%;
  background: rgba(17, 60, 53, 0.85);
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
}
.nova-video-caption { margin: 12px 4px 0; color: #e7f0ec; font: 600 0.8rem Manrope, sans-serif; text-align: center; }
.nova-slide-video {
  margin-top: 16px;
  padding: 13px 22px;
  border: 0;
  border-radius: 10px;
  background: var(--coral, #df725b);
  color: #fff;
  font: 800 0.9rem Manrope, sans-serif;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(223, 114, 91, 0.32);
  transition: transform 0.18s ease;
}
.nova-slide-video:hover:not(:disabled) { transform: translateY(-1px); }
.nova-slide-video:disabled { opacity: 0.6; cursor: progress; }

/* ---------- Campos detectados na base LIA ---------- */
.nova-detected {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid #cfe3d8;
  border-radius: 12px;
  background: #f4faf6;
}
.nova-detected h4 { margin: 0 0 10px; font: 700 0.95rem "Playfair Display", serif; color: var(--pine, #113c35); }
.nova-detected-list { display: grid; gap: 8px; }
.nova-detected-item { display: grid; gap: 2px; }
.nova-detected-item strong { font: 800 0.72rem Manrope, sans-serif; color: var(--pine, #113c35); text-transform: uppercase; letter-spacing: 0.03em; }
.nova-detected-item span { font: 500 0.86rem/1.5 Manrope, sans-serif; color: var(--ink, #172a28); overflow-wrap: anywhere; }
.nova-detected-note { margin: 10px 0 0; font: 500 0.76rem Manrope, sans-serif; color: var(--muted, #687572); }

@media (max-width: 700px) {
  .nova-msg { max-width: 100%; }
  .nova-video-player { max-height: 64vh; }
  .nova-video-close { top: -10px; right: -6px; }
}

@media (prefers-reduced-motion: reduce) {
  .nova-dot { animation: none; }
  .nova-video-modal { animation: none; }
}

