/* ============================================
   AvaAssistant — ava-chat.css
   ChatGPT-style chat (light + dark mode)
   ============================================ */

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

:root {
  --white:        #ffffff;
  --bg:           #ffffff;
  --bg-sidebar:   #f9f9f9;
  --bg-input:     #ffffff; 
  --bg-hover:     #ececec;
  --bg-voice:     #f3f3f3;
  --bg-card:      #ffffff;
  
  --text:         #000000;
  --text-2:       #374151;
  --text-muted:   #9ca3af;
  --text-link:    #2563eb;

  --border:       #e5e5e5;
  --border-input: #e5e5e5;

  --accent:       #000000;
  
  --font:         -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body.dark-theme {
  --white:        #212121;
  --bg:           #212121;
  --bg-sidebar:   #171717;
  --bg-input:     #2f2f2f;
  --bg-hover:     #2f2f2f;
  --bg-voice:     #3a3a3a;
  --bg-card:      #2f2f2f;
  
  --text:         #ececec;
  --text-2:       #d1d5db;
  --text-muted:   #6b7280;
  --text-link:    #60a5fa;

  --border:       #3a3a3a;
  --border-input: #3a3a3a;

  --accent:       #ececec;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ========== SIDEBAR ========== */
.sidebar {
  width: 260px;
  height: 100%;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: none;
  transition: transform 0.25s ease, opacity 0.2s ease;
  z-index: 100;
}
.sidebar.hidden {
  transform: translateX(-100%);
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px;
}

.sidebar-close,
.new-chat-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
}
.sidebar-close:hover,
.new-chat-btn:hover { background: var(--bg-hover); }

.sidebar-histories {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
}
.sidebar-history {
  display: block;
}
.history-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 8px 4px;
}
.history-list { list-style: none; }
.history-list li {
  position: relative;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.history-list li .chat-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.history-list li:hover { background: var(--bg-hover); }
.history-list li.active { background: var(--bg-hover); font-weight: 500; }

.chat-options-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}
.history-list li:hover .chat-options-btn,
.history-list li.active .chat-options-btn,
.chat-options-btn.active {
  opacity: 1;
}
@media (hover: none) {
  .chat-options-btn {
    opacity: 1;
  }
}
.chat-options-btn:hover {
  background: var(--border);
  color: var(--text);
}

.chat-options-menu {
  position: absolute;
  right: 10px;
  top: 30px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  display: none;
  flex-direction: column;
  z-index: 100;
  min-width: 120px;
  overflow: hidden;
}
.chat-options-menu.show { display: flex; }
.chat-option {
  background: none;
  border: none;
  padding: 8px 12px;
  text-align: left;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-option:hover { background: var(--bg-hover); }
.chat-option.delete { color: #ef4444; }
.chat-option.delete:hover { background: rgba(239, 68, 68, 0.1); }


.sidebar-bottom {
  padding: 8px;
  border-top: 1px solid var(--border);
  position: relative;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  transition: background 0.15s;
}
.sidebar-user:hover { background: var(--bg-hover); }
.sidebar-user .user-info {
  flex: 1;
  min-width: 0;
}
.sidebar-user .user-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
}
.sidebar-user .user-email {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Settings Panel */
.settings-panel {
  position: absolute;
  bottom: 70px;
  left: 8px;
  right: 8px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  z-index: 300;
  overflow: hidden;
  display: none;
  flex-direction: column;
  animation: settings-appear 0.15s ease;
}
.settings-panel.show { display: flex; }
@keyframes settings-appear {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.settings-header {
  padding: 12px 14px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.settings-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  transition: background 0.12s;
}
.settings-item:hover { background: var(--bg-hover); }
.settings-item svg { flex-shrink: 0; color: var(--text-muted); }
.settings-item span { flex: 1; }
.settings-item.danger { color: #ef4444; }
.settings-item.danger svg { color: #ef4444; }
.settings-item.danger:hover { background: rgba(239,68,68,0.08); }

.settings-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* Dark Mode Toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  gap: 10px;
}
.theme-toggle svg { flex-shrink: 0; color: var(--text-muted); }
.theme-toggle span { flex: 1; }
.toggle-switch {
  width: 36px;
  height: 20px;
  background: var(--border);
  border-radius: 20px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: left 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
body.dark-theme .toggle-switch {
  background: #10b981;
}
body.dark-theme .toggle-switch::after {
  left: 19px;
}

.settings-account-info {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.settings-account-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}
.settings-account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.settings-account-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.settings-account-email {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 99;
}

/* ========== MAIN ========== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
}

/* ========== TOP BAR ========== */
.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px; /* Espaço entre hamburguer e nome */
}

.topbar-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.12s;
  /* Margem negativa à esquerda para alinhar perfeitamente com a margem global */
  margin-left: -8px; 
}
.topbar-btn:hover { background: var(--bg-hover); }

.sidebar:not(.hidden) ~ .main .topbar-icon-btn#menuBtn,
.sidebar:not(.hidden) ~ .sidebar-overlay ~ .main .topbar-icon-btn#menuBtn {
  display: none;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background 0.12s;
}
.topbar-brand:hover { background: var(--bg-hover); }

.brand-container {
  position: relative;
}

.brand-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.brand-chevron {
  color: var(--text-muted);
}
.brand-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
  background: none;
  border: none;
  outline: none;
  box-shadow: none;
  padding: 0;
  border-radius: 0;
}
body.dark-theme .brand-logo {
  content: url('images/logo_white_v4.png');
}

/* Dropdown */
.model-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 8px;
  width: 320px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  padding: 8px;
  display: none;
  flex-direction: column;
  gap: 4px;
  z-index: 1000;
}

.model-dropdown.show {
  display: flex;
}

.model-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.model-option:hover {
  background: var(--bg-hover);
}

.model-info {
  display: flex;
  flex-direction: column;
}

.model-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
}

.model-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.model-check {
  color: var(--text);
  opacity: 0;
}

.model-option.active .model-check {
  opacity: 1;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.15s;
}
.topbar-icon-btn:hover {
  background: var(--bg-hover);
}

/* ========== MORE DROPDOWN ========== */
.topbar-right {
  position: relative;
}

.more-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 210px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 1100;
}
.more-dropdown.show { display: flex; }

.more-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}
.more-option:hover { background: var(--bg-hover); }
.more-option-danger { color: #e53e3e; }
.more-option-danger:hover { background: rgba(229,62,62,0.08); }

.more-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ========== FILE PREVIEW STRIP ========== */
.file-preview-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 16px 0;
}
.file-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text);
  max-width: 200px;
}
.file-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}
.file-chip-remove:hover { color: var(--text); }

/* Image preview thumbnail */
.file-chip-img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

/* Register tab on login modal */
.modal-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.modal-tab {
  flex: 1;
  padding: 10px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.modal-tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
}

/* ========== CHAT SCROLL ========== */
.chat-scroll {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ========== WELCOME ========== */
.welcome {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.welcome-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  max-width: 600px;
  width: 100%;
}

.welcome-greeting {
  font-size: clamp(24px, 5vw, 32px);
  font-weight: 500;
  color: var(--text);
  text-align: center;
  line-height: 1.3;
}

/* Suggestion Chips */
.suggestions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  width: 100%;
}

.suggestion-chip {
  background: var(--white);
  border: 1px solid var(--border);
  padding: 14px 20px;
  border-radius: 16px;
  font-size: 14px;
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.suggestion-chip:hover {
  background: var(--bg-hover);
  border-color: #d1d1d1;
}

@media (min-width: 640px) {
  .suggestions {
    grid-template-columns: 1fr 1fr;
  }
}

/* ========== MESSAGES ========== */
.messages {
  display: none;
  flex-direction: column;
  width: 100%;
  max-width: 768px;
  margin: 0 auto;
  padding: 24px 32px 120px;
  gap: 24px;
}
.messages.active {
  display: flex;
  flex: 1;
}

.msg {
  display: flex;
  width: 100%;
  animation: fadeIn 0.25s ease;
}

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

/* User Bubble (Right) */
.msg.user {
  justify-content: flex-end;
}
.msg.user .msg-text {
  background: #f4f4f4;
  color: #0d0d0d;
  padding: 12px 18px;
  border-radius: 24px;
  font-size: 16px;
  line-height: 1.5;
  max-width: 80%;
  word-wrap: break-word;
}

/* Assistant Text (Left) */
.msg.assistant {
  justify-content: flex-start;
  gap: 12px;
  align-items: flex-start;
}
.msg.assistant .msg-avatar {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  margin-top: 4px;
}
.msg.assistant .msg-text {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  word-wrap: break-word;
  max-width: 95%;
  padding: 4px 8px;
}

.msg-text p { margin-bottom: 12px; }
.msg-text p:last-child { margin-bottom: 0; }
.msg-text strong { font-weight: 600; }
.msg-text code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 14px;
  background: #f7f7f8;
  padding: 2px 6px;
  border-radius: 6px;
}
.msg-text pre {
  background: #f7f7f8;
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  margin: 12px 0;
}
.msg-text pre code { background: none; padding: 0; }
.msg-text ul, .msg-text ol { padding-left: 24px; margin-bottom: 12px; }
.msg-text a { color: var(--text-link); text-decoration: underline; }

/* Typing indicator for assistant */
.typing-dots-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}
.typing-status-text {
  font-size: 13px;
  color: var(--text-muted);
  animation: pulse-text 2s infinite ease-in-out;
}
@keyframes pulse-text {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
.typing-dots {
  display: flex;
  gap: 4px;
  padding: 8px 0;
}
.typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: bounce 1.2s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

/* ========== INPUT AREA ========== */
.input-area {
  padding: 0 16px 12px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.input-bar {
  display: flex;
  align-items: flex-end;
  width: 100%;
  max-width: 768px;
  background: var(--bg-input);
  border-radius: 28px; /* Formato pílula */
  padding: 12px 14px;
  gap: 8px;
  border: 1px solid var(--border-input);
  /* Uma sombra super suave igual a da imagem */
  box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}
.input-bar:focus-within {
  border-color: #d1d1d1;
}

.input-plus {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 50%;
  margin-bottom: 2px;
}
.input-plus:hover { background: var(--bg-hover); }

.input-field {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  resize: none;
  outline: none;
  max-height: 200px;
  padding: 6px 0;
  margin-bottom: 0px;
}
.input-field::placeholder {
  color: var(--text-muted);
}

.input-icon-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 50%;
}
.input-icon-btn:hover { background: var(--bg-hover); }

.input-voice-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: black;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.12s;
}
.input-voice-circle:hover { opacity: 0.8; }

.input-send {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  border-radius: 50%;
  transition: opacity 0.12s;
}
.input-send:hover { opacity: 0.8; }

.disclaimer {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 12px;
  max-width: 600px;
}
.disclaimer a { color: var(--text-muted); text-decoration: underline; }
.disclaimer a:hover { color: var(--text-2); }

/* ========== MODAL ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-box {
  background: var(--white);
  border-radius: 12px;
  width: 100%;
  max-width: 440px;
  padding: 32px;
  position: relative;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  transform: scale(0.96);
  transition: transform 0.25s ease;
}
.modal-overlay.active .modal-box { transform: scale(1); }

.google-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 10px;
  background: var(--bg);
  border: 1px solid var(--border-input);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  margin-top: 16px;
  margin-bottom: 16px;
  transition: background 0.15s;
}
.google-login-btn:hover {
  background: var(--bg-hover);
}

.login-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 16px 0;
  color: var(--text-muted);
  font-size: 12px;
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-input);
}
.login-divider span {
  padding: 0 10px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}
.modal-close:hover { color: var(--text); }

.modal-title { font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.modal-desc { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }

.lead-form label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 16px;
}
.lead-form input,
.lead-form select,
.lead-form textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border-input);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
}
.lead-form input:focus,
.lead-form select:focus,
.lead-form textarea:focus { border-color: var(--text-muted); }

.lead-submit {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: var(--white);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 8px;
}
.lead-submit:hover { opacity: 0.85; }

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  body {
    font-size: 15px;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    z-index: 200;
    box-shadow: 10px 0 30px rgba(0,0,0,0.1);
  }
  .sidebar.hidden { transform: translateX(-100%); opacity: 1; pointer-events: none; }
  
  .sidebar-overlay {
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
  }
  .sidebar-overlay.active { display: block; }
  
  .topbar {
    padding: 0 8px;
  }

  .topbar-icon-btn#menuBtn { display: flex !important; }
  
  .messages { 
    padding: 16px 12px 140px; 
    gap: 20px;
  }

  .msg.user .msg-text {
    max-width: 90%;
    font-size: 15px;
    padding: 10px 16px;
  }

  .msg.assistant .msg-text {
    font-size: 15px;
  }

  .input-area {
    padding: 0 12px 24px; /* Mais espaço no fundo no mobile */
    background: linear-gradient(to top, var(--white) 60%, transparent);
    position: sticky;
    bottom: 0;
  }

  .input-bar {
    padding: 8px 12px;
    border-radius: 24px;
  }

  .input-field {
    font-size: 15px;
  }

  .suggestion-chip {
    padding: 12px 16px;
    font-size: 13px;
  }

  .modal-box { 
    margin: 16px; 
    padding: 24px; 
    width: calc(100% - 32px);
  }
}

/* Safe areas for notched phones */
@supports (padding: env(safe-area-inset-bottom)) {
  .input-area {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
}

/* ========== TYPEWRITER CURSOR ========== */
.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: currentColor;
  margin-left: 1px;
  vertical-align: text-bottom;
  border-radius: 1px;
  animation: cursor-blink 0.6s step-end infinite;
  opacity: 0.8;
}
@keyframes cursor-blink {
  0%, 100% { opacity: 0.8; }
  50%       { opacity: 0; }
}

/* ========== MESSAGE ACTIONS BAR ========== */
.msg-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 6px;
  padding: 0 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* Show on hover (desktop) */
.msg.assistant:hover .msg-actions {
  opacity: 1;
}

/* Always show on touch devices */
@media (hover: none) {
  .msg-actions {
    opacity: 1;
  }
}

.msg-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s, transform 0.15s;
  padding: 0;
  position: relative;
}

.msg-action-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.msg-action-btn:active {
  transform: scale(0.9);
}

.msg-action-btn.auth-required {
  display: none;
}

body.user-logged-in .msg-action-btn.auth-required {
  display: flex;
}

/* Active/selected state for like/dislike */
.msg-action-btn.liked {
  color: #10b981;
}
.msg-action-btn.liked:hover {
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

.msg-action-btn.disliked {
  color: #ef4444;
}
.msg-action-btn.disliked:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* Tooltip for action buttons */
.msg-action-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  background: var(--text);
  color: var(--bg);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 10;
}

.msg-action-btn:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* Copy success animation */
.msg-action-btn.copied {
  color: #10b981;
}

/* Feedback toast */
.feedback-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}

.feedback-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* More actions dropdown for messages */
.msg-more-menu {
  position: absolute;
  bottom: calc(100% + 4px);
  right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  padding: 4px;
  display: none;
  flex-direction: column;
  min-width: 160px;
  z-index: 50;
  animation: msg-menu-appear 0.12s ease;
}

.msg-more-menu.show {
  display: flex;
}

@keyframes msg-menu-appear {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msg-more-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
  white-space: nowrap;
}

.msg-more-option:hover {
  background: var(--bg-hover);
}

.msg-more-option svg {
  flex-shrink: 0;
  color: var(--text-muted);
}

/* Wrapper needed for action bar positioning */
.msg-content-wrap {
  display: flex;
  flex-direction: column;
  max-width: 95%;
}
