/**
 * ZiveAI Interactive Consulting Workspace & Live Blueprint Styles
 */

.consulting-workspace {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.5rem;
  min-height: calc(100vh - 70px);
  padding: 1.5rem 0 3rem;
  position: relative;
}

/* ==========================================================================
   Left Pane: Interactive AI Consultation Chat
   ========================================================================== */
.chat-pane {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  max-height: 850px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.chat-header {
  padding: 1.1rem 1.5rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.copilot-avatar {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  flex-shrink: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #0ce9ff 0%, #009bb0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #030712;
  font-weight: 800;
  font-size: 0.9rem;
  box-shadow: 0 0 15px rgba(12, 233, 255, 0.4);
  position: relative;
}

.copilot-avatar::after {
  content: '';
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background: var(--success-400);
  border: 2px solid var(--bg-surface);
  border-radius: 50%;
}

.copilot-title-wrap h2 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.copilot-status {
  font-size: 0.75rem;
  color: var(--cyan-400);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Chat Messages Container */
.chat-messages {
  flex-grow: 1;
  padding: 1.25rem 1rem;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  scroll-behavior: smooth;
  box-sizing: border-box;
  width: 100%;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

/* Message Bubbles */
.msg-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  max-width: 90%;
  animation: msgFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

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

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

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

.msg-bubble {
  padding: 1rem 1.25rem;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.55;
  position: relative;
  word-break: break-word;
  overflow-wrap: break-word;
  box-sizing: border-box;
}

.msg-row.ai .msg-bubble {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-top-left-radius: 4px;
  color: var(--text-primary);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
}

.msg-row.user .msg-bubble {
  background: linear-gradient(135deg, rgba(12, 233, 255, 0.22) 0%, rgba(12, 233, 255, 0.08) 100%);
  border: 1px solid rgba(12, 233, 255, 0.4);
  color: #ffffff;
  border-top-right-radius: 4px;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(12, 233, 255, 0.15);
}

.msg-time {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  margin-top: 0.35rem;
  display: block;
}

/* Typing indicator */
.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.4rem 0.6rem;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--cyan-400);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}
.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

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

/* Interactive Action Tray / Choice Chips */
.chat-action-tray {
  padding: 1rem;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  animation: trayFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  margin-top: 0.35rem;
}

.chat-action-tray:empty {
  display: none;
}

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

.chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  width: 100%;
  box-sizing: border-box;
}

.choice-chip {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-full);
  padding: 0.5rem 0.95rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--trans-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  user-select: none;
  box-sizing: border-box;
  line-height: 1.35;
  white-space: normal;
  text-align: left;
  max-width: 100%;
  word-break: break-word;
}

.choice-chip:hover {
  background: rgba(12, 233, 255, 0.15);
  border-color: var(--primary-500);
  transform: translateY(-2px);
  color: #ffffff;
}

.choice-chip.active {
  background: var(--grad-primary);
  color: #030712;
  font-weight: 700;
  border-color: transparent;
  box-shadow: 0 0 15px rgba(12, 233, 255, 0.4);
}

.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  position: relative;
}

.chat-input-field {
  flex: 1 1 0;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 0.75rem 0.95rem;
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
  transition: var(--trans-normal);
}

.chat-input-field:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 20px rgba(12, 233, 255, 0.25);
}

.btn-icon-action {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--trans-fast);
  flex-shrink: 0;
  box-sizing: border-box;
  padding: 0;
}

.btn-icon-action:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.btn-icon-action.mic.recording {
  background: var(--danger-500);
  color: #ffffff;
  animation: micPulse 1.2s infinite;
}

@keyframes micPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

.btn-send-msg {
  background: var(--grad-primary);
  color: #030712;
}

.btn-send-msg:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(12, 233, 255, 0.4);
}

/* ==========================================================================
   Right Pane: Live Blueprint Canvas (Painel Vivo)
   ========================================================================== */
.blueprint-pane {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(16px);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  height: calc(100vh - 120px);
  max-height: 850px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.blueprint-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.blueprint-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.blueprint-live-tag {
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: var(--cyan-400);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* Score Mini Widget */
.blueprint-score-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.mini-gauge {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: conic-gradient(var(--primary-500) calc(var(--bp-score, 50) * 1%), var(--bg-surface-elevated) 0);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 15px rgba(12, 233, 255, 0.3);
  transition: all 0.5s ease;
}

.mini-gauge-inner {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
}

/* Interactive Funnel Pipeline Nodes */
.pipeline-nodes-block h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.pipeline-nodes-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.node-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all var(--trans-normal);
}

.node-item.active {
  border-color: var(--primary-500);
  box-shadow: 0 0 12px rgba(12, 233, 255, 0.2);
}

.node-item.good { border-left: 4px solid var(--success-500); }
.node-item.warning { border-left: 4px solid var(--warning-500); }
.node-item.critical { border-left: 4px solid var(--danger-500); }

.node-info-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.node-status-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

/* Live Insights Feed */
.insights-feed-block h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.insights-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.insight-chip-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  background: rgba(12, 233, 255, 0.06);
  border: 1px solid rgba(12, 233, 255, 0.2);
  border-radius: var(--radius-md);
  font-size: 0.825rem;
  color: var(--text-primary);
  line-height: 1.4;
  animation: fadeIn 0.3s ease;
}

.insight-icon-alert {
  color: var(--warning-400);
  font-size: 1rem;
  flex-shrink: 0;
}

/* Synthesis Ready Banner */
.synthesis-ready-banner {
  background: linear-gradient(135deg, rgba(12, 233, 255, 0.18) 0%, rgba(0, 197, 220, 0.08) 100%);
  border: 1px solid rgba(12, 233, 255, 0.4);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
  animation: fadeIn 0.4s ease;
}

/* ==========================================================================
   Mobile Tabs Switcher (Hidden - Focus on Conversation)
   ========================================================================== */
.mobile-view-toggle {
  display: none !important;
  margin-bottom: 1rem;
  background: var(--bg-surface-elevated);
  padding: 0.3rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-medium);
}

.mobile-view-btn {
  flex: 1;
  padding: 0.6rem;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

.mobile-view-btn.active {
  background: var(--grad-primary);
  color: #030712;
}

@media (max-width: 900px) {
  .consulting-workspace {
    grid-template-columns: 1fr;
    height: auto;
    padding: 0.5rem 0 2rem;
    min-height: auto;
  }
  .mobile-view-toggle {
    display: none !important;
  }
  .chat-pane {
    height: calc(100vh - 130px);
    max-height: 800px;
    border-radius: var(--radius-lg);
    display: flex !important;
  }
  .chat-messages {
    padding: 0.85rem 0.65rem;
    gap: 0.85rem;
  }
  .msg-row {
    max-width: 94%;
  }
  .msg-bubble {
    padding: 0.85rem 1rem;
    font-size: 0.9rem;
  }
  .chat-action-tray {
    padding: 0.75rem;
  }
  .choice-chip {
    padding: 0.45rem 0.8rem;
    font-size: 0.8rem;
  }
  .blueprint-pane {
    display: none !important;
    height: auto;
    max-height: none;
  }
  .blueprint-pane.mobile-active {
    display: none !important;
  }
  .chat-pane.mobile-hidden {
    display: flex !important;
  }
}

/* ==========================================================================
   ZiveAI Solution Pill (Intervenção Estratégica & Métricas)
   ========================================================================== */
.zive-solution-pill {
  display: block;
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  min-height: fit-content;
  height: auto;
  box-sizing: border-box;
  background: linear-gradient(135deg, rgba(12, 233, 255, 0.12) 0%, rgba(3, 7, 18, 0.95) 100%);
  border: 1px solid rgba(12, 233, 255, 0.35);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.4rem;
  margin: 0.5rem 0;
  box-shadow: 0 8px 32px rgba(12, 233, 255, 0.15), inset 0 0 12px rgba(12, 233, 255, 0.05);
  animation: pillSlideUp 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  word-break: break-word;
  overflow-wrap: break-word;
}

.zive-solution-pill::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--grad-primary);
  border-top-left-radius: var(--radius-lg);
  border-bottom-left-radius: var(--radius-lg);
}

@keyframes pillSlideUp {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.zive-solution-pill-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.zive-pill-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cyan-400);
  background: rgba(12, 233, 255, 0.12);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(12, 233, 255, 0.25);
  flex-shrink: 0;
}

.zive-pill-stat {
  font-size: 0.825rem;
  font-weight: 800;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.zive-solution-pill h4 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 0.5rem 0;
  display: block;
  line-height: 1.35;
}

.zive-solution-pill p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
  display: block;
}

.zive-solution-pill p strong {
  color: #ffffff;
  font-weight: 700;
}

@media (max-width: 900px) {
  .zive-solution-pill {
    padding: 1rem 1.15rem;
    margin: 0.4rem 0;
  }
  .zive-solution-pill h4 {
    font-size: 0.975rem;
  }
  .zive-solution-pill p {
    font-size: 0.85rem;
    line-height: 1.5;
  }
}

