:root {
  --bg-primary: #0f1117;
  --bg-surface: #181b24;
  --bg-surface-elevated: #212532;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(244, 114, 182, 0.3);
  
  --accent-pink: #f472b6;
  --accent-rose: #ec4899;
  --accent-purple: #a855f7;
  --accent-gradient: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --user-bubble: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
  --agent-bubble: #212532;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 25px rgba(236, 72, 153, 0.25);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(236, 72, 153, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(139, 92, 246, 0.08) 0%, transparent 40%);
  padding: 16px;
}

.app-container {
  width: 100%;
  max-width: 820px;
  height: 92vh;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  position: relative;
  backdrop-filter: blur(12px);
}

/* Header */
.app-header {
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background: rgba(24, 27, 36, 0.85);
  backdrop-filter: blur(8px);
  z-index: 10;
}

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

.brand-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: var(--shadow-glow);
}

.brand-info h1 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-stage {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(236, 72, 153, 0.15);
  color: var(--accent-pink);
  border: 1px solid var(--border-highlight);
}

.brand-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.status-text {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Phase Banner */
.phase-banner {
  padding: 10px 24px;
  background: rgba(244, 114, 182, 0.05);
  border-bottom: 1px solid rgba(244, 114, 182, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.banner-badge {
  background: var(--accent-gradient);
  color: white;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.72rem;
  white-space: nowrap;
}

/* Chat container */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.chat-container::-webkit-scrollbar {
  width: 6px;
}

.chat-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

/* Intro */
.system-intro {
  text-align: center;
  max-width: 520px;
  margin: 20px auto 30px auto;
  padding: 24px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
}

.intro-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.system-intro h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.system-intro p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 18px;
}

.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.78rem;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip:hover {
  background: rgba(236, 72, 153, 0.12);
  border-color: var(--border-highlight);
  color: var(--text-primary);
  transform: translateY(-1px);
}

/* Messages */
.messages-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message-row {
  display: flex;
  gap: 12px;
  max-width: 80%;
  animation: fadeIn 0.25s ease-out;
}

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

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

.message-row.agent {
  align-self: flex-start;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 4px;
}

.message-row.user .message-avatar {
  background: #374151;
  color: #f3f4f6;
}

.message-row.agent .message-avatar {
  background: var(--accent-gradient);
  color: white;
}

.message-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}

.message-row.user .message-bubble {
  background: var(--user-bubble);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 14px rgba(236, 72, 153, 0.25);
}

.message-row.agent .message-bubble {
  background: var(--agent-bubble);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}

.cursor-blink {
  display: inline-block;
  width: 6px;
  height: 14px;
  background: var(--accent-pink);
  margin-left: 4px;
  vertical-align: middle;
  animation: blink 0.8s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Input Area */
.input-area {
  padding: 16px 24px 20px 24px;
  border-top: 1px solid var(--border-color);
  background: rgba(24, 27, 36, 0.95);
}

.input-form {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 8px 6px 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-form:focus-within {
  border-color: var(--border-highlight);
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.12);
}

#messageInput {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.94rem;
  resize: none;
  max-height: 120px;
  line-height: 1.4;
  padding: 6px 0;
}

#messageInput::placeholder {
  color: var(--text-muted);
}

.send-button {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--accent-gradient);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s ease;
  flex-shrink: 0;
}

.send-button svg {
  width: 18px;
  height: 18px;
}

.send-button:hover:not(:disabled) {
  transform: scale(1.05);
}

.send-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.action-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.action-btn:hover {
  color: var(--accent-pink);
  background: rgba(236, 72, 153, 0.1);
}

.action-btn svg {
  width: 20px;
  height: 20px;
}

/* Preview de imagem */
.image-preview-container {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  border: 1px dashed var(--border-highlight);
  animation: fadeIn 0.2s ease;
}

.image-preview-wrapper {
  position: relative;
  width: 50px;
  height: 50px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.image-preview-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.remove-image-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  background: rgba(0, 0, 0, 0.75);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-preview-caption {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Gravação de áudio */
.recording-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  animation: fadeIn 0.2s ease;
}

.rec-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ef4444;
  animation: pulse 1s infinite;
}

.rec-text {
  flex: 1;
  font-size: 0.85rem;
  color: #fca5a5;
  font-weight: 500;
}

.btn-rec-cancel {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  cursor: pointer;
}

.btn-rec-send {
  background: #ef4444;
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.input-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
}
