/* ==========================================================================
   DR3 Imobiliária & Construtora — AI Concierge 24/7 (IPL-0004 / ADR-0009)
   Design System Ultra-Luxury Headless: Noble Black (#0D0F12) & Champagne Gold (#C5A059)
   ========================================================================== */

/* 1. Hub Flutuante (Container Principal) */
.dr3-concierge-hub {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--z-floating, 9999);
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-family-base, 'Plus Jakarta Sans', sans-serif);
}

/* 2. Tooltip / Status Pill no Desktop */
.concierge-badge-tooltip {
  background: rgba(13, 15, 18, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(197, 160, 89, 0.35);
  padding: 8px 16px;
  border-radius: var(--radius-full, 999px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-silver-200, #E2E8F0);
  white-space: nowrap;
  pointer-events: none;
  animation: fadeInTooltip 0.4s ease-out;
}

.concierge-badge-tooltip .status-dot {
  width: 8px;
  height: 8px;
  background-color: #10B981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10B981;
  display: inline-block;
}

.concierge-badge-tooltip strong {
  color: var(--color-gold-400, #C5A059);
}

@media (min-width: 768px) {
  .concierge-badge-tooltip {
    display: flex;
  }
}

/* 3. Botão Flutuante Circular */
.concierge-trigger-btn {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1C2028 0%, #0D0F12 100%);
  border: 1.5px solid var(--color-gold-400, #C5A059);
  color: var(--color-gold-400, #C5A059);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.7), 0 0 16px rgba(197, 160, 89, 0.25);
  cursor: pointer;
  position: relative;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease;
  outline: none;
  padding: 0;
}

.concierge-trigger-btn:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), 0 0 24px rgba(197, 160, 89, 0.45);
  color: #F3E9D2;
}

.concierge-trigger-btn::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid rgba(197, 160, 89, 0.4);
  animation: conciergePulse 2.4s infinite;
  pointer-events: none;
}

@keyframes conciergePulse {
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.18); opacity: 0; }
  100% { transform: scale(1); opacity: 0; }
}

.concierge-trigger-btn .icon-concierge,
.concierge-trigger-btn .icon-close {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.concierge-trigger-btn .icon-close {
  display: none;
  font-size: 1.4rem;
  line-height: 1;
}

.dr3-concierge-hub.is-open .concierge-trigger-btn .icon-concierge {
  display: none;
}

.dr3-concierge-hub.is-open .concierge-trigger-btn .icon-close {
  display: block;
}

/* 4. Janela / Gaveta Flutuante do Concierge */
.concierge-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 410px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 120px);
  background: #11141B;
  border: 1px solid rgba(197, 160, 89, 0.35);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.88), 0 0 1px 1px rgba(197, 160, 89, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: var(--z-floating, 9999);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.96);
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
              transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
              visibility 0.3s;
}

.dr3-concierge-hub.is-open ~ .concierge-window,
.concierge-window.is-active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* 5. Cabeçalho do Concierge */
.concierge-header {
  background: linear-gradient(180deg, #181C24 0%, #11141B 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 18px 20px 14px;
  position: relative;
}

.concierge-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.concierge-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.concierge-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #0D0F12;
  border: 1px solid var(--color-gold-400, #C5A059);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-gold-400, #C5A059);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.concierge-title-wrap h3 {
  font-size: 0.96rem;
  font-weight: 700;
  color: #FFFFFF;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.concierge-title-wrap h3 .gold {
  color: var(--color-gold-400, #C5A059);
}

.concierge-status-line {
  font-size: 0.72rem;
  color: #10B981;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.concierge-status-line::before {
  content: '';
  width: 6px;
  height: 6px;
  background-color: #10B981;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px #10B981;
}

.concierge-close-btn {
  background: transparent;
  border: none;
  color: var(--color-silver-400, #94A3B8);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.2s ease, background 0.2s ease;
  line-height: 1;
}

.concierge-close-btn:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.08);
}

/* 6. Banner Contextual do Imóvel */
.concierge-context-banner {
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(197, 160, 89, 0.1);
  border: 1px solid rgba(197, 160, 89, 0.3);
  border-radius: 8px;
  display: none;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  color: #F3E9D2;
}

.concierge-context-banner.has-property {
  display: flex;
}

.context-info {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-clear-btn {
  background: transparent;
  border: none;
  color: var(--color-gold-400, #C5A059);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0 4px;
}

/* 7. Barra de Navegação das Abas */
.concierge-tabs {
  display: flex;
  background: #0B0D12;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.concierge-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 10px 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-silver-400, #94A3B8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.concierge-tab-btn:hover {
  color: #FFFFFF;
}

.concierge-tab-btn.active {
  color: var(--color-gold-400, #C5A059);
  border-bottom-color: var(--color-gold-400, #C5A059);
  background: rgba(197, 160, 89, 0.04);
}

/* 8. Corpo das Abas */
.concierge-tab-panel {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.concierge-tab-panel.active {
  display: flex;
}

/* ABA 1: Chat IA */
.concierge-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.chat-message {
  display: flex;
  gap: 8px;
  max-width: 90%;
  animation: messageAppear 0.25s ease-out;
}

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

.chat-message.concierge {
  align-self: flex-start;
}

.chat-message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-bubble {
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 0.84rem;
  line-height: 1.45;
}

.chat-message.concierge .chat-bubble {
  background: #171A22;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--color-silver-200, #E2E8F0);
  border-bottom-left-radius: 4px;
}

.chat-message.user .chat-bubble {
  background: linear-gradient(135deg, #C5A059 0%, #DFBA73 100%);
  color: #0D0F12;
  font-weight: 600;
  border-bottom-right-radius: 4px;
}

/* Chips de Sugestão Rápida */
.concierge-quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 10px;
}

.quick-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(197, 160, 89, 0.3);
  color: var(--color-silver-300, #CBD5E1);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-chip:hover {
  background: rgba(197, 160, 89, 0.18);
  border-color: var(--color-gold-400, #C5A059);
  color: #FFFFFF;
}

/* Barra de Entrada de Chat */
.concierge-chat-input-bar {
  padding: 12px 14px;
  background: #0B0D12;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 8px;
}

.concierge-chat-input-bar input {
  flex: 1;
  background: #171A22;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  font-size: 0.84rem;
  padding: 10px 14px;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s ease;
}

.concierge-chat-input-bar input:focus {
  border-color: var(--color-gold-400, #C5A059);
}

.concierge-send-btn {
  background: linear-gradient(135deg, #C5A059 0%, #E6CA85 100%);
  border: none;
  color: #0D0F12;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
  font-weight: bold;
}

.concierge-send-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.concierge-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Indicador de Digitação */
.chat-typing-indicator {
  display: inline-flex;
  gap: 4px;
  padding: 8px 12px;
  background: #171A22;
  border-radius: 12px;
  border-bottom-left-radius: 4px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background-color: var(--color-gold-400, #C5A059);
  border-radius: 50%;
  animation: typingBounce 1.2s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-5px); }
}

/* ABA 2: Formulário de Agendamento */
.concierge-schedule-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.schedule-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.schedule-field label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-silver-300, #CBD5E1);
}

.schedule-field input,
.schedule-field textarea {
  background: #171A22;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.84rem;
  outline: none;
}

.schedule-field input:focus,
.schedule-field textarea:focus {
  border-color: var(--color-gold-400, #C5A059);
}

.turn-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.turn-btn {
  background: #171A22;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--color-silver-300, #CBD5E1);
  padding: 9px 6px;
  border-radius: 8px;
  font-size: 0.74rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.turn-btn.active {
  background: rgba(197, 160, 89, 0.15);
  border-color: var(--color-gold-400, #C5A059);
  color: var(--color-gold-400, #C5A059);
}

.schedule-submit-btn {
  background: linear-gradient(135deg, #C5A059 0%, #E6CA85 100%);
  color: #0D0F12;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 12px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  margin-top: 4px;
  transition: opacity 0.2s ease;
}

.schedule-submit-btn:hover {
  opacity: 0.92;
}

/* ABA 3: Canal WhatsApp Direto */
.concierge-whatsapp-body {
  flex: 1;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
}

.wa-specialist-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(197, 160, 89, 0.15);
  border: 1.5px solid var(--color-gold-400, #C5A059);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-gold-400, #C5A059);
}

.wa-specialist-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #FFFFFF;
}

.wa-specialist-creci {
  font-size: 0.76rem;
  color: var(--color-silver-400, #94A3B8);
  margin-top: 2px;
}

.wa-specialist-desc {
  font-size: 0.84rem;
  color: var(--color-silver-300, #CBD5E1);
  line-height: 1.5;
  max-width: 320px;
}

.btn-open-wa-direct {
  background: linear-gradient(135deg, #25D366 0%, #1EBE5D 100%);
  color: #FFFFFF;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 13px 24px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 24px rgba(37, 211, 102, 0.35);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.btn-open-wa-direct:hover {
  transform: translateY(-2px);
  opacity: 0.95;
}

/* Responsividade Mobile */
@media (max-width: 480px) {
  .dr3-concierge-hub {
    bottom: 16px;
    right: 16px;
  }
  
  .concierge-window {
    bottom: 84px;
    right: 12px;
    width: calc(100vw - 24px);
    height: calc(100vh - 100px);
  }
}
