/* ══════════════════════════════════════════════════════════════════════
   VYNK AI — Painel de Inteligência Artificial
   Protocolo HIHCS | Codify World
   Standalone — não sobrescreve nenhum estilo existente do Vynk
   ══════════════════════════════════════════════════════════════════════ */

/* ── Botão flutuante ──────────────────────────────────────────────────── */
#vynkAIBtn {
  position: fixed;
  right: 18px;
  bottom: 88px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(8, 14, 28, 0.96);
  border: 1.5px solid rgba(0, 230, 118, 0.35);
  color: #00E676;
  font-size: 20px;
  cursor: pointer;
  z-index: 9600;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 16px rgba(0, 230, 118, 0.1);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  font-family: 'Sora', sans-serif;
  flex-shrink: 0;
}
#vynkAIBtn:hover {
  transform: scale(1.1);
  border-color: #00E676;
  box-shadow: 0 4px 28px rgba(0, 0, 0, 0.5), 0 0 24px rgba(0, 230, 118, 0.25);
}
#vynkAIBtn.vai-active {
  background: rgba(0, 230, 118, 0.12);
  border-color: #00E676;
  box-shadow: 0 0 0 3px rgba(0, 230, 118, 0.15), 0 4px 24px rgba(0, 0, 0, 0.4);
}
#vynkAIBtn.vai-recording {
  border-color: #FF4058;
  color: #FF4058;
  animation: vai-record-pulse 1.5s ease-in-out infinite;
}
@keyframes vai-record-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 64, 88, 0.4); }
  50%       { box-shadow: 0 0 0 8px rgba(255, 64, 88, 0); }
}

/* Badge de contagem de linhas transcritas */
#vynkAIBadge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: #00E676;
  color: #060C18;
  font-size: 9px;
  font-weight: 800;
  font-family: 'Space Mono', monospace;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  padding: 0 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #060C18;
  line-height: 1;
  display: none;
}

/* ── Painel principal ─────────────────────────────────────────────────── */
#vynkAIPanel {
  position: fixed;
  right: 18px;
  bottom: 148px;
  width: 380px;
  max-height: calc(100dvh - 180px);
  background: rgba(6, 10, 20, 0.98);
  border: 1px solid rgba(0, 230, 118, 0.18);
  border-radius: 18px;
  z-index: 9590;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(0, 230, 118, 0.06);
  font-family: 'Sora', -apple-system, sans-serif;
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.34, 1.2, 0.64, 1),
              transform 0.22s cubic-bezier(0.34, 1.2, 0.64, 1);
}
#vynkAIPanel.vai-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
/* Shimmer line no topo */
#vynkAIPanel::before {
  content: '';
  display: block;
  height: 1px;
  flex-shrink: 0;
  background: linear-gradient(90deg, transparent, #00E676, rgba(14, 165, 255, 0.6), transparent);
}

/* ── Cabeçalho ───────────────────────────────────────────────────────── */
.vai-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}
.vai-head-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: rgba(0, 230, 118, 0.1);
  border: 1px solid rgba(0, 230, 118, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.vai-head-info { flex: 1; min-width: 0; }
.vai-head-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.2px;
  line-height: 1.2;
}
.vai-head-sub {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.3);
  font-family: 'Space Mono', monospace;
  letter-spacing: 0.04em;
}
.vai-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
  transition: background 0.3s;
}
.vai-status-dot.online  { background: #00E676; box-shadow: 0 0 6px rgba(0, 230, 118, 0.5); }
.vai-status-dot.offline { background: #FF4058; }
.vai-status-dot.loading { background: #FFAA00; animation: vai-blink 1s infinite; }
@keyframes vai-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.vai-close {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  font-size: 13px;
  flex-shrink: 0;
  transition: all 0.14s;
}
.vai-close:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

/* ── Tabs ─────────────────────────────────────────────────────────────── */
.vai-tabs {
  display: flex;
  padding: 6px 8px;
  gap: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}
.vai-tab {
  flex: 1;
  padding: 6px 4px;
  border-radius: 8px;
  font-size: 10.5px;
  font-weight: 600;
  font-family: inherit;
  background: none;
  border: 1px solid transparent;
  color: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: all 0.14s;
  text-align: center;
  white-space: nowrap;
}
.vai-tab:hover:not(.active) { color: rgba(255, 255, 255, 0.7); background: rgba(255, 255, 255, 0.05); }
.vai-tab.active {
  background: rgba(0, 230, 118, 0.1);
  border-color: rgba(0, 230, 118, 0.28);
  color: #00E676;
}

/* ── Conteúdo das tabs ───────────────────────────────────────────────── */
.vai-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.vai-body::-webkit-scrollbar { width: 3px; }
.vai-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 3px; }

.vai-pane { display: none; padding: 14px; }
.vai-pane.active { display: flex; flex-direction: column; gap: 12px; }

/* ── Seção label ─────────────────────────────────────────────────────── */
.vai-section-title {
  font-size: 9.5px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ── Status card ─────────────────────────────────────────────────────── */
.vai-status-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 11px;
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.vai-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}
.vai-status-label { color: rgba(255, 255, 255, 0.4); }
.vai-status-value {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.7);
}
.vai-status-value.ok  { color: #00E676; }
.vai-status-value.err { color: #FF4058; }
.vai-status-value.warn{ color: #FFAA00; }

/* ── Botões de ação primários ─────────────────────────────────────────── */
.vai-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
  width: 100%;
}
.vai-btn-primary {
  background: linear-gradient(135deg, #009944, #00E676);
  color: #060C18;
  border-color: transparent;
}
.vai-btn-primary:hover { filter: brightness(1.12); box-shadow: 0 4px 16px rgba(0, 230, 118, 0.3); }
.vai-btn-primary:disabled { opacity: 0.38; cursor: not-allowed; filter: none; box-shadow: none; }

.vai-btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.6);
  border-color: rgba(255, 255, 255, 0.09);
}
.vai-btn-secondary:hover { border-color: rgba(0, 230, 118, 0.35); color: #00E676; background: rgba(0, 230, 118, 0.07); }
.vai-btn-secondary:disabled { opacity: 0.38; cursor: not-allowed; }

.vai-btn-danger {
  background: rgba(255, 64, 88, 0.08);
  color: #FF4058;
  border-color: rgba(255, 64, 88, 0.2);
}
.vai-btn-danger:hover { background: rgba(255, 64, 88, 0.16); }

.vai-btn-record {
  background: rgba(255, 64, 88, 0.1);
  color: #FF4058;
  border-color: rgba(255, 64, 88, 0.25);
}
.vai-btn-record.vai-recording {
  background: rgba(255, 64, 88, 0.18);
  animation: vai-blink 1.2s ease-in-out infinite;
}

/* ── Transcrição ao vivo ─────────────────────────────────────────────── */
.vai-transcript-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 11px;
  padding: 10px;
  min-height: 120px;
  max-height: 220px;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.75);
}
.vai-transcript-box::-webkit-scrollbar { width: 3px; }
.vai-transcript-box::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 3px; }
.vai-transcript-empty {
  color: rgba(255, 255, 255, 0.2);
  text-align: center;
  padding: 20px 8px;
  font-size: 11.5px;
}
.vai-transcript-line { margin-bottom: 7px; }
.vai-tl-speaker {
  font-size: 9.5px;
  font-weight: 700;
  color: #00E676;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-right: 5px;
}
.vai-tl-time {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.2);
  font-family: 'Space Mono', monospace;
  margin-right: 6px;
}
.vai-tl-text { color: rgba(255, 255, 255, 0.8); }
/* Linha ativa (última sendo transcrita) */
.vai-tl-live .vai-tl-text { color: #fff; }
.vai-tl-live .vai-tl-speaker { color: #00FF88; }

/* Contador de linhas */
.vai-transcript-count {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.25);
  font-family: 'Space Mono', monospace;
  text-align: right;
  margin-top: 4px;
}

/* ── Modos de resumo ─────────────────────────────────────────────────── */
.vai-mode-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.vai-mode-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  text-align: left;
  transition: all 0.14s;
  width: 100%;
}
.vai-mode-btn:hover:not(:disabled) {
  border-color: rgba(0, 230, 118, 0.35);
  color: #fff;
  background: rgba(0, 230, 118, 0.06);
}
.vai-mode-btn:disabled { opacity: 0.38; cursor: not-allowed; }
.vai-mode-icon {
  font-size: 18px;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}
.vai-mode-info { flex: 1; min-width: 0; }
.vai-mode-title { font-weight: 700; font-size: 12px; display: block; }
.vai-mode-desc  { font-size: 10px; color: rgba(255, 255, 255, 0.35); display: block; margin-top: 1px; }

/* ── Resultado / Ata ─────────────────────────────────────────────────── */
.vai-result-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(0, 230, 118, 0.15);
  border-radius: 11px;
  padding: 12px;
  max-height: 280px;
  overflow-y: auto;
  font-size: 11.5px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.82);
  font-family: 'Space Mono', monospace;
  white-space: pre-wrap;
  word-break: break-word;
}
.vai-result-box::-webkit-scrollbar { width: 3px; }
.vai-result-box::-webkit-scrollbar-thumb { background: rgba(0, 230, 118, 0.2); border-radius: 3px; }

.vai-result-actions {
  display: flex;
  gap: 6px;
}
.vai-result-actions .vai-btn { flex: 1; padding: 7px 10px; font-size: 11.5px; }

/* ── Loading ─────────────────────────────────────────────────────────── */
.vai-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px;
  color: rgba(255, 255, 255, 0.3);
  font-size: 12px;
}
.vai-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.08);
  border-top-color: #00E676;
  animation: vai-spin 0.75s linear infinite;
}
@keyframes vai-spin { to { transform: rotate(360deg); } }
.vai-loading-label { font-size: 11px; color: rgba(255, 255, 255, 0.25); font-family: 'Space Mono', monospace; }

/* ── Pré-reunião / Configuração ──────────────────────────────────────── */
.vai-setup-note {
  background: rgba(0, 230, 118, 0.05);
  border: 1px solid rgba(0, 230, 118, 0.12);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.55;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.vai-setup-note-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }

.vai-model-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(0, 230, 118, 0.09);
  border: 1px solid rgba(0, 230, 118, 0.2);
  font-size: 10px;
  font-weight: 700;
  font-family: 'Space Mono', monospace;
  color: #00E676;
  letter-spacing: 0.04em;
}

/* ── Divider ─────────────────────────────────────────────────────────── */
.vai-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 2px 0;
}

/* ── Toast interno ───────────────────────────────────────────────────── */
.vai-toast {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: rgba(10, 18, 32, 0.97);
  border: 1px solid rgba(0, 230, 118, 0.3);
  border-radius: 9px;
  padding: 7px 14px;
  font-size: 12px;
  color: #00E676;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 10;
}
.vai-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Responsive mobile ───────────────────────────────────────────────── */
@media (max-width: 480px) {
  #vynkAIPanel {
    right: 8px;
    left: 8px;
    width: auto;
    bottom: 140px;
    max-height: calc(100dvh - 160px);
  }
  #vynkAIBtn { right: 10px; bottom: 84px; }
}