/* ══════════════════════════════════════════════════
   Dennis Claw — Widget de Chat Flutuante
   Estica do Ulisses®
   ══════════════════════════════════════════════════ */

#dennis-claw-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: 'Inter', -apple-system, sans-serif;
}

/* Botão flutuante (FAB) */
#dennis-claw-fab {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #D4AC4E, #B8942E);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(212, 172, 78, 0.45), 0 2px 8px rgba(0,0,0,0.25);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  position: relative;
}
#dennis-claw-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(212, 172, 78, 0.55), 0 3px 10px rgba(0,0,0,0.3);
}
/* REQ-24 (v2.3): reduzir força visual do Dennis dentro da seção "Participar",
   sem escondê-lo — o olho deve ir primeiro ao card do Radar */
#dennis-claw-widget.is-muted #dennis-claw-fab {
  opacity: 0.55;
  transform: scale(0.85);
}
#dennis-claw-fab img {
  width: 34px;
  height: 34px;
  filter: brightness(0) invert(1);
}
#dennis-claw-fab .dennis-claw-fab-icon {
  font-size: 26px;
  line-height: 1;
}
#dennis-claw-fab.open .dennis-claw-fab-icon {
  transform: rotate(90deg);
}

/* Badge de notificação (primeira visita) */
#dennis-claw-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #E85C4A;
  color: #fff;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #0F1E1E;
  animation: dcPulse 2s infinite;
}
@keyframes dcPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* Balão de saudação inicial */
#dennis-claw-greeting {
  position: absolute;
  bottom: 72px;
  right: 0;
  background: #fff;
  color: #1a1a1a;
  padding: 12px 16px;
  border-radius: 14px 14px 4px 14px;
  max-width: 240px;
  font-size: 13.5px;
  line-height: 1.5;
  box-shadow: 0 6px 24px rgba(0,0,0,0.18);
  animation: dcFadeInUp 0.4s ease;
  cursor: pointer;
}
#dennis-claw-greeting::after {
  content: '';
  position: absolute;
  bottom: -6px;
  right: 18px;
  width: 14px;
  height: 14px;
  background: #fff;
  transform: rotate(45deg);
  box-shadow: 2px 2px 3px rgba(0,0,0,0.03);
}
#dennis-claw-greeting .dc-close-greeting {
  position: absolute;
  top: 2px;
  right: 6px;
  background: none;
  border: none;
  font-size: 14px;
  color: #999;
  cursor: pointer;
  padding: 4px;
}

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

/* REQ-06: recolhimento automático do balão inicial (não permanece aberto indefinidamente) */
#dennis-claw-greeting.dc-greeting-hide {
  animation: dcFadeOutDown 0.35s ease forwards;
  pointer-events: none;
}
@keyframes dcFadeOutDown {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(8px); }
}

/* Painel do chat */
#dennis-claw-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 430px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 140px);
  background: #12211f;
  border-radius: 20px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.35);
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(212, 172, 78, 0.25);
  z-index: 9998;
}
#dennis-claw-panel.open {
  display: flex;
  animation: dcPanelIn 0.28s ease;
}
@keyframes dcPanelIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header do painel */
#dennis-claw-header {
  background: linear-gradient(135deg, #0F1E1E, #1a2f2c);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(212, 172, 78, 0.2);
  flex-shrink: 0;
}
#dennis-claw-header .dc-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #D4AC4E, #B8942E);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  overflow: hidden;
}
#dennis-claw-header .dc-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
}
#dennis-claw-header .dc-title-block {
  flex: 1;
  min-width: 0;
}
#dennis-claw-header .dc-name {
  color: #F4F2EF;
  font-weight: 700;
  font-size: 15px;
  font-family: 'Playfair Display', serif;
}
#dennis-claw-header .dc-status {
  color: #9fd8a8;
  font-size: 11.5px;
  display: flex;
  align-items: center;
  gap: 5px;
}
#dennis-claw-header .dc-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
}
#dennis-claw-close {
  background: none;
  border: none;
  color: #cfc9c0;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 6px;
  transition: background 0.2s;
}
#dennis-claw-close:hover {
  background: rgba(255,255,255,0.08);
}

/* Área de mensagens */
#dennis-claw-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
#dennis-claw-messages::-webkit-scrollbar {
  width: 5px;
}
#dennis-claw-messages::-webkit-scrollbar-thumb {
  background: rgba(212, 172, 78, 0.3);
  border-radius: 3px;
}

.dc-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: dcMsgIn 0.25s ease;
}
@keyframes dcMsgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.dc-msg.dc-assistant {
  background: rgba(212, 172, 78, 0.12);
  color: #F4F2EF;
  align-self: flex-start;
  border: 1px solid rgba(212, 172, 78, 0.15);
}
.dc-msg.dc-user {
  background: #D4AC4E;
  color: #0F1E1E;
  align-self: flex-end;
  font-weight: 500;
}
.dc-msg a {
  color: #E8C97A;
  text-decoration: underline;
}
.dc-msg.dc-assistant a {
  color: #E8C97A;
}
.dc-msg.dc-user a {
  color: #0F1E1E;
}

/* Indicador de digitação */
.dc-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: rgba(212, 172, 78, 0.12);
  border-radius: 14px;
  border: 1px solid rgba(212, 172, 78, 0.15);
}
.dc-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #D4AC4E;
  animation: dcTyping 1.2s infinite;
}
.dc-typing span:nth-child(2) { animation-delay: 0.2s; }
.dc-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dcTyping {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* Quick replies (sugestões iniciais) */
#dennis-claw-quickreplies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
  flex-shrink: 0;
}
.dc-quick-btn {
  background: rgba(212, 172, 78, 0.1);
  border: 1px solid rgba(212, 172, 78, 0.35);
  color: #E8C97A;
  padding: 7px 12px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}
.dc-quick-btn:hover {
  background: rgba(212, 172, 78, 0.22);
}

/* Área de input */
#dennis-claw-inputbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid rgba(212, 172, 78, 0.15);
  background: rgba(0,0,0,0.15);
  flex-shrink: 0;
}
#dennis-claw-input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(212, 172, 78, 0.25);
  border-radius: 22px;
  padding: 10px 16px;
  color: #F4F2EF;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  resize: none;
  max-height: 80px;
}
#dennis-claw-input::placeholder {
  color: rgba(244,242,239,0.4);
}
#dennis-claw-input:focus {
  border-color: rgba(212, 172, 78, 0.55);
}
#dennis-claw-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #D4AC4E;
  border: none;
  color: #0F1E1E;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
}
#dennis-claw-send:hover {
  background: #E8C97A;
  transform: scale(1.05);
}
#dennis-claw-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Footer discreto */
#dennis-claw-footer {
  text-align: center;
  font-size: 10px;
  color: rgba(244,242,239,0.3);
  padding: 6px 0 10px;
  flex-shrink: 0;
}

/* Tablet: painel um pouco mais estreito, mas ainda mais proporcional que a v4 */
@media (max-width: 768px) and (min-width: 481px) {
  #dennis-claw-panel {
    width: 380px;
    height: 560px;
  }
}

/* Mobile */
@media (max-width: 480px) {
  #dennis-claw-widget {
    bottom: 16px;
    right: 16px;
  }
  #dennis-claw-fab {
    width: 54px;
    height: 54px;
  }
  #dennis-claw-panel {
    right: 16px;
    bottom: 82px;
    width: calc(100vw - 32px);
    height: calc(100vh - 140px);
  }
  #dennis-claw-greeting {
    max-width: 200px;
    font-size: 13px;
  }
}
