/* =========================================================================
   ANIMATED AI CHAT
   Adaptado dos componentes 21st.dev "V0 AI Chat" (265) e "Animated AI Chat" (236)
   Aparência de Claude.ai real, com streaming de resposta.
   ========================================================================= */

.aichat {
  position: relative;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #0F111A 0%, #0B0D14 100%);
  border: 1px solid var(--border, #1E222C);
  border-radius: 14px;
  overflow: hidden;
  box-shadow:
    0 40px 100px -30px rgba(0, 0, 0, 0.9),
    0 0 80px -20px rgba(217, 119, 87, 0.20),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: box-shadow 0.5s cubic-bezier(0.22, 1, 0.36, 1), transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.aichat:hover {
  transform: translateY(-3px);
  box-shadow:
    0 50px 130px -30px rgba(0, 0, 0, 0.9),
    0 0 100px -10px rgba(217, 119, 87, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* Animated border glow */
.aichat::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg,
    rgba(217, 119, 87, 0.4),
    rgba(217, 119, 87, 0.05),
    rgba(217, 119, 87, 0.4));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
          mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  opacity: 0.6;
}

/* ── Top bar ── */
.aichat__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border, #1E222C);
}

.aichat__dots {
  display: flex;
  gap: 6px;
}
.aichat__dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2A2F3B;
}
.aichat__dots i:nth-child(1) { background: #FF5F57; }
.aichat__dots i:nth-child(2) { background: #FEBC2E; }
.aichat__dots i:nth-child(3) { background: #28C840; }

.aichat__title {
  font-family: var(--mono, 'JetBrains Mono', monospace);
  font-size: 11px;
  color: var(--muted, #6B7280);
  letter-spacing: 0.04em;
  margin-left: 4px;
}

.aichat__live {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono, monospace);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #00C896;
}
.aichat__live::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #00C896;
  box-shadow: 0 0 8px rgba(0, 200, 150, 0.8);
  animation: aichat-pulse 1.6s ease-in-out infinite;
}
@keyframes aichat-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.85); }
}

/* ── Tabs (cenários) ── */
.aichat__tabs {
  display: flex;
  gap: 4px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border, #1E222C);
  background: rgba(255, 255, 255, 0.01);
}

.aichat__tab {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 8px;
  font-family: var(--font, 'Inter', sans-serif);
  font-size: 11px;
  color: var(--muted, #6B7280);
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.aichat__tab svg {
  width: 12px;
  height: 12px;
  opacity: 0.7;
}
.aichat__tab:hover {
  color: var(--text, #F5F6F8);
  background: rgba(255, 255, 255, 0.03);
}
.aichat__tab.is-active {
  background: rgba(217, 119, 87, 0.10);
  border-color: rgba(217, 119, 87, 0.28);
  color: var(--accent, #D97757);
}
.aichat__tab.is-active svg {
  opacity: 1;
}

/* ── Body (mensagens) ── */
.aichat__body {
  padding: 24px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(217, 119, 87, 0.3) transparent;
}
.aichat__body::-webkit-scrollbar { width: 4px; }
.aichat__body::-webkit-scrollbar-thumb {
  background: rgba(217, 119, 87, 0.3);
  border-radius: 2px;
}

/* ── Skill injection pill ── */
.aichat__inject {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  margin-bottom: 4px;
  align-self: flex-start;
  background: rgba(217, 119, 87, 0.08);
  border: 1px solid rgba(217, 119, 87, 0.25);
  border-radius: 100px;
  font-family: var(--mono, monospace);
  font-size: 10px;
  color: var(--accent, #D97757);
  letter-spacing: 0.04em;
  opacity: 0;
  transform: translateY(-4px);
  animation: aichat-fade-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.aichat__inject svg {
  width: 11px;
  height: 11px;
}

@keyframes aichat-fade-in {
  to { opacity: 1; transform: translateY(0); }
}

/* ── Mensagens (bubble) ── */
.aichat__msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  width: 100%;
  opacity: 0;
  transform: translateY(6px);
  animation: aichat-msg-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes aichat-msg-in {
  to { opacity: 1; transform: translateY(0); }
}

.aichat__av {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font, 'Inter', sans-serif);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.aichat__av--user {
  background: #1F2330;
  color: var(--muted, #6B7280);
  border: 1px solid var(--border, #1E222C);
}
.aichat__av--claude {
  background: linear-gradient(135deg, #E8915A, #C04E24);
  color: #fff;
  box-shadow: 0 0 14px rgba(217, 119, 87, 0.4);
}

.aichat__bubble {
  flex: 1;
  width: 100%;
  min-width: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  padding-top: 3px;
  font-family: var(--font, 'Inter', sans-serif);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text, #F5F6F8);
  word-wrap: break-word;
}
.aichat__msg--claude .aichat__bubble {
  background: transparent;
  border: none;
}

/* ── Streaming text & cursor ── */
.aichat__stream {
  display: inline;
}
.aichat__stream::after {
  content: "▍";
  display: inline-block;
  color: var(--accent, #D97757);
  margin-left: 2px;
  animation: aichat-blink 1s steps(2) infinite;
  font-weight: 400;
  transform: translateY(1px);
}
.aichat__stream.is-done::after { display: none; }
@keyframes aichat-blink {
  0%, 50%   { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Code/Output blocks dentro de bubble */
.aichat__block {
  margin: 8px 0 0;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  font-family: var(--mono, monospace);
  font-size: 11.5px;
  color: #C8CCD4;
  line-height: 1.6;
}
.aichat__block-label {
  display: block;
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(217, 119, 87, 0.7);
  margin-bottom: 4px;
}

/* ── Typing dots (Claude pensando) ── */
.aichat__typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
}
.aichat__typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent, #D97757);
  opacity: 0.4;
  animation: aichat-type 1.4s ease-in-out infinite;
}
.aichat__typing i:nth-child(2) { animation-delay: 0.18s; }
.aichat__typing i:nth-child(3) { animation-delay: 0.36s; }
@keyframes aichat-type {
  0%, 60%, 100% { opacity: 0.4; transform: scale(0.8); }
  30%           { opacity: 1; transform: scale(1.1); }
}

/* ── Input fake (rodapé) ── */
.aichat__input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid var(--border, #1E222C);
  font-family: var(--font, 'Inter', sans-serif);
  font-size: 12px;
  color: var(--muted, #6B7280);
}
.aichat__input::before {
  content: "Pergunte ao Claude com a skill ativa…";
  flex: 1;
  letter-spacing: -0.01em;
}
.aichat__input-send {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, #E8915A, #C04E24);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

@media (prefers-reduced-motion: reduce) {
  .aichat,
  .aichat__msg,
  .aichat__inject,
  .aichat__stream::after,
  .aichat__typing i,
  .aichat__live::before { animation: none !important; transition: none !important; }
  .aichat__msg,
  .aichat__inject { opacity: 1; transform: none; }
}
