/* ============================================================
   PLAYTECH ERP — AI CHAT SIDE PANEL (DRAWER)
   Design System: Slate / Navy / Teal / Emerald (No Purple)
   ============================================================ */

/* ─── BOTÃO FLUTUANTE DISCRETO (FAB) ─── */
.playtech-ai-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9990;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 10px 14px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.4), 0 8px 10px -6px rgba(15, 23, 42, 0.2);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  user-select: none;
}

.playtech-ai-fab:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 16px 30px -8px rgba(15, 23, 42, 0.5), 0 0 16px rgba(13, 148, 136, 0.35);
  border-color: rgba(45, 212, 191, 0.4);
}

.playtech-ai-fab:active {
  transform: translateY(0) scale(0.98);
}

.playtech-ai-fab-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #0d9488 0%, #0369a1 100%);
  border-radius: 50%;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(13, 148, 136, 0.4);
}

.playtech-ai-fab-status-dot {
  position: absolute;
  top: -1px;
  right: -1px;
  width: 9px;
  height: 9px;
  background-color: #10b981;
  border: 2px solid #0f172a;
  border-radius: 50%;
  box-shadow: 0 0 6px #10b981;
}

.playtech-ai-fab-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: #f8fafc;
}

.playtech-ai-fab-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  background: rgba(45, 212, 191, 0.2);
  color: #2dd4bf;
  border-radius: 6px;
  border: 1px solid rgba(45, 212, 191, 0.3);
  text-transform: uppercase;
}

/* ─── BACKDROP DESFOCADO (OVERLAY) ─── */
.playtech-ai-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.playtech-ai-backdrop.active {
  opacity: 1;
  visibility: visible;
}

/* ─── DRAWER / SIDE PANEL LATERAL DIREITO ─── */
.playtech-ai-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 440px;
  max-width: 92vw;
  height: 100vh;
  background: #ffffff;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 35px -8px rgba(15, 23, 42, 0.28);
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.playtech-ai-drawer.active {
  transform: translateX(0);
}

/* ─── HEADER DO DRAWER ─── */
.playtech-ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
}

.playtech-ai-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.playtech-ai-avatar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border-radius: 12px;
  color: #2dd4bf;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.2);
}

.playtech-ai-avatar-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background-color: #10b981;
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 6px #10b981;
}

.playtech-ai-title-wrap h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.playtech-ai-title-wrap p {
  margin: 2px 0 0 0;
  font-size: 12px;
  color: #64748b;
}

.playtech-ai-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.playtech-ai-btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
}

.playtech-ai-btn-icon:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.playtech-ai-btn-icon.close-btn:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

/* ─── CORPO DE MENSAGENS (SCROLL) ─── */
.playtech-ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #f8fafc;
}

/* Cartão de Boas-Vindas */
.playtech-ai-welcome-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.playtech-ai-welcome-card h4 {
  margin: 0 0 6px 0;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.playtech-ai-welcome-card p {
  margin: 0 0 12px 0;
  font-size: 13px;
  color: #475569;
  line-height: 1.45;
}

.playtech-ai-chips-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #94a3b8;
  margin-bottom: 8px;
}

.playtech-ai-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.playtech-ai-chip {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #1e293b;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.playtech-ai-chip:hover {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
  transform: translateY(-1px);
}

/* Balões de Mensagem */
.playtech-ai-msg {
  display: flex;
  flex-direction: column;
  max-width: 86%;
  animation: fadeInMsg 0.25s ease-out;
}

@keyframes fadeInMsg {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.playtech-ai-msg.user {
  align-self: flex-end;
}

.playtech-ai-msg.ai {
  align-self: flex-start;
}

.playtech-ai-bubble {
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}

.playtech-ai-msg.user .playtech-ai-bubble {
  background: #1e293b;
  color: #ffffff;
  border-radius: 16px 16px 4px 16px;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.15);
}

.playtech-ai-msg.ai .playtech-ai-bubble {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-radius: 16px 16px 16px 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.playtech-ai-time {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 4px;
  align-self: flex-end;
}

.playtech-ai-msg.ai .playtech-ai-time {
  align-self: flex-start;
  margin-left: 4px;
}

/* Formatação rica na resposta da IA */
.playtech-ai-bubble strong {
  font-weight: 700;
  color: #0f172a;
}

.playtech-ai-msg.user .playtech-ai-bubble strong {
  color: #ffffff;
}

.playtech-ai-bubble ul,
.playtech-ai-bubble ol {
  margin: 6px 0;
  padding-left: 18px;
}

.playtech-ai-bubble li {
  margin-bottom: 4px;
}

.playtech-ai-bubble code {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 2px 5px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #0369a1;
}

.playtech-ai-currency-tag {
  background: #ecfdf5;
  color: #047857;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid #a7f3d0;
}

/* Indicador de Digitação (Typing Indicator) */
.playtech-ai-typing {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px 16px 16px 4px;
  width: fit-content;
  color: #64748b;
  font-size: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  animation: fadeInMsg 0.25s ease-out;
}

.playtech-ai-dots {
  display: flex;
  gap: 4px;
}

.playtech-ai-dots span {
  width: 6px;
  height: 6px;
  background: #0d9488;
  border-radius: 50%;
  animation: pulseDot 1.4s infinite ease-in-out both;
}

.playtech-ai-dots span:nth-child(1) { animation-delay: -0.32s; }
.playtech-ai-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes pulseDot {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1.1);
    opacity: 1;
  }
}

/* ─── FOOTER DO DRAWER (INPUT) ─── */
.playtech-ai-footer {
  padding: 14px 18px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
}

.playtech-ai-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 8px 12px;
  transition: all 0.2s ease;
}

.playtech-ai-input-wrap:focus-within {
  border-color: #0d9488;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
  background: #ffffff;
}

.playtech-ai-textarea {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: 13px;
  color: #0f172a;
  resize: none;
  max-height: 100px;
  line-height: 1.45;
}

.playtech-ai-textarea::placeholder {
  color: #94a3b8;
}

.playtech-ai-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #0f172a;
  border: none;
  border-radius: 8px;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.playtech-ai-send-btn:hover:not(:disabled) {
  background: #0d9488;
  transform: translateY(-1px);
}

.playtech-ai-send-btn:disabled {
  background: #cbd5e1;
  color: #94a3b8;
  cursor: not-allowed;
  transform: none;
}

.playtech-ai-hint {
  margin: 6px 0 0 0;
  font-size: 11px;
  color: #94a3b8;
  text-align: right;
}

/* Responsividade Mobile */
@media (max-width: 640px) {
  .playtech-ai-drawer {
    width: 100vw;
    max-width: 100vw;
  }
  .playtech-ai-fab {
    bottom: 16px;
    right: 16px;
    padding: 10px 14px;
  }
  .playtech-ai-fab-label,
  .playtech-ai-fab-badge {
    display: none;
  }
}
