/* nyvvo · Redesign v2 — Componentes-base
   Estende tokens.css. Toda classe usa prefixo .nv-* pra não colidir com Tailwind.
   Princípios: hairline borders, 1 acento, glow contido, type Geist, raios
   gerados dos tokens (--r-sm/md/lg/xl/2xl). */

/* ==========================================================================
   CARDS — variantes além do básico
   ========================================================================== */

.nv-card-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.nv-card-body { padding: 20px; }
.nv-card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  background: oklch(0.18 0.008 250);
  border-bottom-left-radius: inherit;
  border-bottom-right-radius: inherit;
}
.nv-card-title {
  font: 600 14px/1.25 var(--font-display);
  letter-spacing: -0.005em;
  color: var(--text-1);
  margin: 0;
}
.nv-card-subtitle {
  font: 400 12px/1.4 var(--font-sans);
  color: var(--text-3);
  margin: 2px 0 0;
}

/* Tamanhos de card */
.nv-card-sm { border-radius: var(--r-md); }
.nv-card-lg { border-radius: var(--r-xl); }

/* Card "stat" — número grande + label + delta */
.nv-stat {
  padding: 18px 20px;
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
}
.nv-stat-label {
  font: 500 11px/1 var(--font-sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}
.nv-stat-value {
  font: 600 28px/1.1 var(--font-display);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--text-1);
  margin: 8px 0 4px;
}
.nv-stat-delta {
  font: 500 12px/1 var(--font-sans);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.nv-stat-delta--up   { color: var(--accent-strong); }
.nv-stat-delta--down { color: var(--danger); }
.nv-stat-delta--flat { color: var(--text-3); }

/* ==========================================================================
   FORMULÁRIO — controles além do input padrão
   ========================================================================== */

/* Textarea — herda nv-input mas com altura/padding diferentes */
.nv-textarea {
  width: 100%;
  min-height: 96px;
  padding: 12px 14px;
  background: var(--bg-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  color: var(--text-1);
  font: 400 14px/1.5 var(--font-sans);
  resize: vertical;
  transition: all 120ms ease;
}
.nv-textarea::placeholder { color: var(--text-4); }
.nv-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--bg-2);
}

/* Select customizado com chevron via background-image */
.nv-select {
  width: 100%;
  height: 40px;
  padding: 0 36px 0 14px;
  background: var(--bg-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  color: var(--text-1);
  font: 400 14px/1 var(--font-sans);
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  transition: all 120ms ease;
}
.nv-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background-color: var(--bg-2);
}

/* Search com ícone à esquerda */
.nv-search {
  position: relative;
  display: inline-block;
  width: 100%;
}
.nv-search > svg, .nv-search > .nv-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-4);
  pointer-events: none;
}
.nv-search > .nv-input { padding-left: 36px; }

/* Input com label flutuante minimal */
.nv-field { display: flex; flex-direction: column; gap: 6px; }
.nv-field-hint {
  font: 400 11px/1.4 var(--font-sans);
  color: var(--text-4);
  margin-top: 2px;
}
.nv-field-error {
  font: 400 11px/1.4 var(--font-sans);
  color: var(--danger);
  margin-top: 2px;
}
.nv-field--invalid .nv-input,
.nv-field--invalid .nv-textarea,
.nv-field--invalid .nv-select {
  border-color: var(--danger);
}
.nv-field--invalid .nv-input:focus { box-shadow: 0 0 0 3px oklch(0.68 0.18 27 / 0.18); }

/* Switch (toggle) */
.nv-switch {
  --w: 36px;
  --h: 20px;
  position: relative;
  display: inline-block;
  width: var(--w);
  height: var(--h);
  flex-shrink: 0;
}
.nv-switch input { opacity: 0; width: 0; height: 0; }
.nv-switch-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-3);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  cursor: pointer;
  transition: all 160ms ease;
}
.nv-switch-slider::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 2px;
  top: 2px;
  background: var(--text-2);
  border-radius: 999px;
  transition: all 160ms ease;
}
.nv-switch input:checked + .nv-switch-slider {
  background: var(--accent);
  border-color: var(--accent);
}
.nv-switch input:checked + .nv-switch-slider::before {
  background: var(--accent-fg);
  transform: translateX(calc(var(--w) - var(--h)));
}
.nv-switch input:focus-visible + .nv-switch-slider {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Checkbox custom */
.nv-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.nv-check input { opacity: 0; width: 0; height: 0; position: absolute; }
.nv-check-box {
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--bg-3);
  display: grid;
  place-items: center;
  transition: all 120ms ease;
  flex-shrink: 0;
}
.nv-check-box svg {
  width: 12px;
  height: 12px;
  color: var(--accent-fg);
  opacity: 0;
  transform: scale(0.6);
  transition: all 120ms ease;
}
.nv-check input:checked + .nv-check-box {
  background: var(--accent);
  border-color: var(--accent);
}
.nv-check input:checked + .nv-check-box svg {
  opacity: 1;
  transform: scale(1);
}
.nv-check input:focus-visible + .nv-check-box {
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.nv-check-label {
  font: 400 13px/1.4 var(--font-sans);
  color: var(--text-1);
}

/* Radio custom */
.nv-radio {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.nv-radio input { opacity: 0; width: 0; height: 0; position: absolute; }
.nv-radio-dot {
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-3);
  display: grid;
  place-items: center;
  transition: all 120ms ease;
  flex-shrink: 0;
}
.nv-radio-dot::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent-fg);
  opacity: 0;
  transform: scale(0.6);
  transition: all 120ms ease;
}
.nv-radio input:checked + .nv-radio-dot {
  background: var(--accent);
  border-color: var(--accent);
}
.nv-radio input:checked + .nv-radio-dot::after {
  opacity: 1;
  transform: scale(1);
}

/* ==========================================================================
   AVATAR
   ========================================================================== */

.nv-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--bg-3);
  border: 1px solid var(--border-subtle);
  display: inline-grid;
  place-items: center;
  font: 600 12px/1 var(--font-sans);
  color: var(--text-2);
  letter-spacing: 0.02em;
  overflow: hidden;
  flex-shrink: 0;
}
.nv-avatar img { width: 100%; height: 100%; object-fit: cover; }
.nv-avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.nv-avatar-lg { width: 44px; height: 44px; font-size: 15px; }
.nv-avatar-xl { width: 64px; height: 64px; font-size: 20px; }

/* Status dot — bolinha indicador (online, offline, etc) */
.nv-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--text-3);
  flex-shrink: 0;
}
.nv-dot--success { background: var(--accent); }
.nv-dot--danger  { background: var(--danger); }
.nv-dot--warn    { background: var(--warn); }
.nv-dot--info    { background: var(--info); }
.nv-dot--pulse {
  position: relative;
}
.nv-dot--pulse::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 999px;
  background: inherit;
  opacity: 0.3;
  animation: nv-pulse 1.6s ease-in-out infinite;
}
@keyframes nv-pulse {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50%      { transform: scale(1.6); opacity: 0; }
}

/* ==========================================================================
   MODAL / DIALOG
   ========================================================================== */

.nv-modal-backdrop {
  position: fixed;
  inset: 0;
  background: oklch(0.08 0 0 / 0.6);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  animation: nv-fade-in 180ms ease;
}
@keyframes nv-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.nv-modal {
  background: var(--bg-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: nv-modal-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes nv-modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.nv-modal-lg { max-width: 720px; }
.nv-modal-xl { max-width: 960px; }
.nv-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.nv-modal-title {
  font: 600 18px/1.25 var(--font-display);
  letter-spacing: -0.015em;
  color: var(--text-1);
  margin: 0;
}
.nv-modal-subtitle {
  font: 400 13px/1.4 var(--font-sans);
  color: var(--text-3);
  margin: 4px 0 0;
}
.nv-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1 1 auto;
}
.nv-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  background: oklch(0.18 0.008 250);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.nv-modal-close {
  background: transparent;
  border: 0;
  color: var(--text-3);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  transition: all 120ms ease;
}
.nv-modal-close:hover { background: var(--bg-2); color: var(--text-1); }

/* ==========================================================================
   DROPDOWN / MENU
   ========================================================================== */

.nv-menu {
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  padding: 6px;
  min-width: 200px;
  z-index: 50;
}
.nv-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  font: 400 13px/1 var(--font-sans);
  color: var(--text-1);
  cursor: pointer;
  user-select: none;
  transition: all 100ms ease;
}
.nv-menu-item:hover {
  background: var(--bg-3);
}
.nv-menu-item[data-active="true"] {
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.nv-menu-item--danger { color: var(--danger); }
.nv-menu-item--danger:hover { background: oklch(0.68 0.18 27 / 0.14); }
.nv-menu-item-icon { width: 14px; height: 14px; flex-shrink: 0; color: var(--text-3); }
.nv-menu-item-shortcut {
  margin-left: auto;
  font: 400 11px/1 var(--font-mono);
  color: var(--text-4);
}
.nv-menu-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 6px -6px;
}
.nv-menu-label {
  font: 500 11px/1 var(--font-sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-4);
  padding: 8px 10px 4px;
}

/* ==========================================================================
   TABS
   ========================================================================== */

.nv-tabs {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0;
  width: 100%;
}
.nv-tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 10px 14px;
  margin-bottom: -1px;
  font: 500 13px/1 var(--font-sans);
  color: var(--text-3);
  cursor: pointer;
  transition: all 120ms ease;
  white-space: nowrap;
}
.nv-tab:hover { color: var(--text-1); }
.nv-tab[data-active="true"] {
  color: var(--text-1);
  border-bottom-color: var(--accent);
}

/* Tabs "pill" — alternativa segmentada (toggle group) */
.nv-tabs-pill {
  display: inline-flex;
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  padding: 3px;
  gap: 2px;
}
.nv-tabs-pill .nv-tab {
  padding: 6px 12px;
  border-bottom: 0;
  border-radius: 7px;
  font-weight: 500;
  font-size: 12px;
  margin-bottom: 0;
}
.nv-tabs-pill .nv-tab[data-active="true"] {
  background: var(--bg-3);
  color: var(--text-1);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   TOOLTIP — pure CSS via data-tooltip attribute
   ========================================================================== */

[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: oklch(0.10 0.005 250);
  color: var(--text-1);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 5px 9px;
  font: 500 11px/1.3 var(--font-sans);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 120ms ease;
  box-shadow: var(--shadow-md);
  z-index: 60;
}
[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   TABLE — minimal, hairline, hover row
   ========================================================================== */

.nv-table {
  width: 100%;
  border-collapse: collapse;
  font: 400 13px/1.5 var(--font-sans);
  color: var(--text-1);
}
.nv-table thead th {
  font: 500 11px/1 var(--font-sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: oklch(0.17 0.008 250);
}
.nv-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.nv-table tbody tr {
  transition: background 100ms ease;
}
.nv-table tbody tr:hover {
  background: var(--bg-2);
}
.nv-table tbody tr:last-child td { border-bottom: 0; }
.nv-table-num {
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.nv-table-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

/* ==========================================================================
   PROGRESS BAR (linear)
   ========================================================================== */

.nv-progress {
  width: 100%;
  height: 6px;
  background: var(--bg-3);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.nv-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.nv-progress-bar--soft { background: var(--accent-soft); }
.nv-progress--lg { height: 10px; }
.nv-progress--sm { height: 4px; }

/* ==========================================================================
   LOADING — spinner + skeleton
   ========================================================================== */

.nv-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--bg-3);
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: nv-spin 720ms linear infinite;
  display: inline-block;
}
@keyframes nv-spin {
  to { transform: rotate(360deg); }
}
.nv-spinner--sm { width: 12px; height: 12px; border-width: 1.5px; }
.nv-spinner--lg { width: 24px; height: 24px; border-width: 3px; }

.nv-skeleton {
  display: block;
  background: linear-gradient(
    90deg,
    var(--bg-2) 0%,
    var(--bg-3) 50%,
    var(--bg-2) 100%
  );
  background-size: 200% 100%;
  animation: nv-skeleton-shimmer 1.4s linear infinite;
  border-radius: 6px;
  height: 14px;
}
@keyframes nv-skeleton-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}
.nv-skeleton--circle { border-radius: 999px; }
.nv-skeleton--block  { height: 80px; border-radius: var(--r-md); }

/* ==========================================================================
   EMPTY STATE
   ========================================================================== */

.nv-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-3);
}
.nv-empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  color: var(--text-3);
}
.nv-empty-title {
  font: 600 16px/1.3 var(--font-display);
  color: var(--text-1);
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.nv-empty-body {
  font: 400 13px/1.5 var(--font-sans);
  color: var(--text-3);
  max-width: 360px;
  margin: 0 auto 18px;
}

/* ==========================================================================
   KBD — visualização de atalho de teclado
   ========================================================================== */

.nv-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: var(--bg-3);
  border: 1px solid var(--border-soft);
  border-bottom-width: 2px;
  border-radius: 5px;
  font: 500 11px/1 var(--font-mono);
  color: var(--text-2);
  letter-spacing: 0.02em;
}

/* ==========================================================================
   BREADCRUMB
   ========================================================================== */

.nv-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font: 400 13px/1 var(--font-sans);
  color: var(--text-3);
}
.nv-breadcrumb a {
  color: var(--text-3);
  text-decoration: none;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all 100ms ease;
}
.nv-breadcrumb a:hover {
  color: var(--text-1);
  background: var(--bg-2);
}
.nv-breadcrumb-sep {
  color: var(--text-4);
  font-size: 11px;
}
.nv-breadcrumb-current {
  color: var(--text-1);
  font-weight: 500;
}

/* ==========================================================================
   PAGINATION
   ========================================================================== */

.nv-pagination {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.nv-page {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--text-2);
  font: 500 12px/1 var(--font-sans);
  cursor: pointer;
  transition: all 120ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nv-page:hover { background: var(--bg-2); color: var(--text-1); }
.nv-page[data-active="true"] {
  background: var(--bg-2);
  border-color: var(--border-soft);
  color: var(--text-1);
}
.nv-page[disabled], .nv-page[aria-disabled="true"] {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==========================================================================
   COMMAND PALETTE — item de busca/comando
   ========================================================================== */

.nv-cmd {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  font: 400 13px/1 var(--font-sans);
  color: var(--text-1);
  transition: all 100ms ease;
}
.nv-cmd:hover, .nv-cmd[data-selected="true"] {
  background: var(--bg-2);
}
.nv-cmd-icon { width: 16px; height: 16px; color: var(--text-3); flex-shrink: 0; }
.nv-cmd-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nv-cmd-meta {
  font: 400 11px/1 var(--font-mono);
  color: var(--text-4);
  flex-shrink: 0;
}

/* ==========================================================================
   NOTIFICATION DOT — bolinha em cima de ícone (badge)
   ========================================================================== */

.nv-notif {
  position: relative;
  display: inline-block;
}
.nv-notif::after {
  content: "";
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--danger);
  border: 2px solid var(--bg-0);
}

/* ==========================================================================
   Utilities — espaçamento, layout, tipográfico (poucas, evitar virar Tailwind)
   ========================================================================== */

.nv-stack-sm { display: flex; flex-direction: column; gap: 6px; }
.nv-stack    { display: flex; flex-direction: column; gap: 12px; }
.nv-stack-lg { display: flex; flex-direction: column; gap: 24px; }
.nv-row      { display: flex; align-items: center; gap: 8px; }
.nv-row-md   { display: flex; align-items: center; gap: 14px; }
.nv-row-spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.nv-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.nv-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.nv-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

.nv-muted   { color: var(--text-3); }
.nv-strong  { color: var(--text-1); }
.nv-accent  { color: var(--accent); }
