/* ===================================
  Neron 1 Chat System Styles
  Professional & Minimalist Design
=================================== */

/* Chat Button - Floating Action Button */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-button {
  --chat-button-fill: #ffffff;
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  border: none;
  background-color: var(--chat-button-fill);
  cursor: pointer;
  z-index: 9998;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  overflow: hidden;
}

body.dark-mode .chat-button {
  --chat-button-fill: var(--search-input, #2a2a2a);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.chat-button:hover {
  --chat-button-fill: #f5f5f7;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.1);
  transform: scale(1.02);
}

body.dark-mode .chat-button:hover {
  --chat-button-fill: #313131;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.chat-button:focus-visible {
  outline: none;
  --chat-button-fill: #ebebed;
  box-shadow: 0 0 0 2px rgba(0, 113, 227, 0.3), 0 2px 12px rgba(0, 0, 0, 0.15);
}

body.dark-mode .chat-button:focus-visible {
  --chat-button-fill: #353535;
  box-shadow: 0 0 0 2px rgba(99, 91, 255, 0.45), 0 2px 12px rgba(0, 0, 0, 0.45);
}

.chat-button:active {
  --chat-button-fill: #e8e8ea;
  transform: scale(0.97);
}

body.dark-mode .chat-button:active {
  --chat-button-fill: #2b2b2b;
}

.chat-button-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.chat-button-icon .material-symbols-outlined {
  font-size: 34px;
}

.chat-button-icon i {
  font-size: 24px;
  color: #e2e2e2;
}

.chat-icon-gradient,
.gradient-icon {
  color: transparent;
  background: linear-gradient(45deg, #5df3d3 10%, #3beaff 40%, #e287fe 70%, #6606cc 100%);
  background-size: 300% 300%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: chatIconGlow 8s linear infinite;
}

@keyframes chatIconGlow {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Notification badge */
.chat-button.has-notification::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 10px;
  height: 10px;
  background-color: #0071e3;
  border-radius: 50%;
  border: 2px solid #ffffff;
}

body.dark-mode .chat-button.has-notification::after {
  background-color: #01e6cd;
  border: 2px solid #2a2a2a;
}

/* Chat Window Container */
.chat-container {
  position: fixed;
  bottom: 5.5rem;
  right: 1.5rem;
  width: 400px;
  height: 600px;
  min-width: 320px;
  max-width: 760px;
  min-height: 420px;
  max-height: 900px;
  background-color: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1), 0 2px 12px rgba(0, 0, 0, 0.08);
  display: none;
  flex-direction: column;
  z-index: 9999;
  overflow: hidden;
  animation: slideInUp 0.2s ease-out;
  border: 1px solid #d1d5db;
}

body.dark-mode .chat-container {
  background-color: #1e1e1e;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  border: 1px solid #3a3a3a;
}

.chat-container.open {
  display: flex;
}

.chat-container.is-resizing {
  user-select: none;
}

.chat-container.docked {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: var(--chat-docked-width, 420px);
  min-width: 320px;
  max-width: 720px;
  height: 100vh;
  max-height: 100vh;
  border-radius: 0;
  border-right: none;
  border-top: none;
  border-bottom: none;
  animation: slideInFromRight 0.3s ease-out;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.3);
}

.chat-container.docked.open {
  display: flex;
}

body.chat-docked-active {
  padding-right: var(--chat-docked-width, 420px);
  transition: padding-right 0.25s ease;
}

body.chat-docked-active .chat-button {
  right: calc(var(--chat-docked-width, 420px) + 1.5rem);
}

@media (max-width: 768px) {
  body.chat-docked-active {
    padding-right: 0;
  }

  body.chat-docked-active .chat-button {
    right: 1.5rem;
  }
}

@keyframes slideInFromRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

.chat-resize-edge,
.chat-resize-corner {
  position: absolute;
  pointer-events: auto;
  z-index: 1;
  background: transparent;
  touch-action: none;
}

.chat-container.docked .chat-resize-edge-top,
.chat-container.docked .chat-resize-edge-bottom,
.chat-container.docked .chat-resize-corner,
.chat-container.docked .chat-resize-edge-right,
.chat-container.docked .chat-resize-corner-bottom-right {
  display: none;
  pointer-events: none;
}

.chat-container.docked .chat-resize-edge-left {
  top: 0;
  bottom: 0;
  width: 12px;
  left: 0;
  cursor: ew-resize;
}

.chat-resize-edge-top,
.chat-resize-edge-bottom {
  left: 12px;
  right: 12px;
  height: 8px;
}

.chat-resize-edge-top {
  top: 0;
  cursor: ns-resize;
}

.chat-resize-edge-bottom {
  bottom: 0;
  cursor: ns-resize;
}

.chat-resize-edge-left,
.chat-resize-edge-right {
  top: 12px;
  bottom: 12px;
  width: 8px;
}

.chat-resize-edge-left {
  left: 0;
  cursor: ew-resize;
}

.chat-resize-edge-right {
  right: 0;
  cursor: ew-resize;
}

.chat-resize-corner {
  width: 16px;
  height: 16px;
  z-index: 2;
}

.chat-resize-corner-top-left {
  top: 0;
  left: 0;
  cursor: nwse-resize;
}

.chat-resize-corner-top-right {
  top: 0;
  right: 0;
  cursor: nesw-resize;
}

.chat-resize-corner-bottom-left {
  bottom: 0;
  left: 0;
  cursor: nesw-resize;
}

.chat-resize-corner-bottom-right {
  bottom: 0;
  right: 0;
  cursor: nwse-resize;
}

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

/* Chat Header */
.chat-header {
  background: #f5f5f7;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e5e7eb;
}

body.dark-mode .chat-header {
  background: #2a2a2a;
  border-bottom: 1px solid #3a3a3a;
}

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

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.chat-header-actions button:first-of-type {
  margin-left: 0.15rem;
}

.chat-avatar {
  display: none;
}

.chat-title {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.chat-title h3 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 500;
  color: #1d1d1f;
  letter-spacing: -0.01em;
}

body.dark-mode .chat-title h3 {
  color: #e2e2e2;
}

.chat-title-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.chat-title-icon {
  font-size: 26px;
  line-height: 1;
}

.chat-status {
  display: none;
}

.status-dot {
  display: none;
}

.chat-reset {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 6px;
  transition: background-color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-reset:hover {
  background-color: #e5e7eb;
}

body.dark-mode .chat-reset:hover {
  background-color: #333333;
}

.chat-reset i {
  font-size: 20px;
  color: #6b7280;
}

body.dark-mode .chat-reset i {
  color: #9ca3af;
}

.chat-dock-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 6px;
  transition: background-color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-dock-toggle:hover {
  background-color: #e5e7eb;
}

body.dark-mode .chat-dock-toggle:hover {
  background-color: #333333;
}

.chat-dock-toggle i {
  font-size: 20px;
  color: #6b7280;
}

body.dark-mode .chat-dock-toggle i {
  color: #9ca3af;
}

.chat-dock-toggle.active {
  background-color: #d1d5db;
}

body.dark-mode .chat-dock-toggle.active {
  background-color: #2f2f2f;
}

.chat-dock-toggle.active:hover {
  background-color: #c4c8cc;
}

body.dark-mode .chat-dock-toggle.active:hover {
  background-color: #3a3a3a;
}

.chat-dock-toggle.active i {
  color: #1d1d1f;
}

body.dark-mode .chat-dock-toggle.active i {
  color: #e4e6eb;
}

.chat-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 6px;
  transition: background-color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-close:hover {
  background-color: #e5e7eb;
}

body.dark-mode .chat-close:hover {
  background-color: #333333;
}

.chat-close i {
  font-size: 20px;
  color: #6b7280;
}

body.dark-mode .chat-close i {
  color: #9ca3af;
}

/* Chat Messages Area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  background-color: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

body.dark-mode .chat-messages {
  background-color: #1e1e1e;
}

/* Custom Scrollbar */
.chat-messages::-webkit-scrollbar {
  width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
  border: 2px solid #ffffff;
}

body.dark-mode .chat-messages::-webkit-scrollbar-thumb {
  background: #444444;
  border: 2px solid #1e1e1e;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

body.dark-mode .chat-messages::-webkit-scrollbar-thumb:hover {
  background: #555555;
}

/* Message Bubbles */
.message {
  display: flex;
  gap: 0;
  max-width: 100%;
  animation: messageSlideIn 0.2s ease-out;
}

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

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
  max-width: 85%;
}

.message.bot {
  max-width: 100%;
  align-self: flex-start;
}

.message-avatar {
  display: none;
}

.message-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
}

.message-bubble {
  background-color: transparent;
  padding: 0.5rem 0;
  border-radius: 0;
  color: #1d1d1f;
  font-size: 0.875rem;
  line-height: 1.6;
  word-wrap: break-word;
}

body.dark-mode .message-bubble {
  color: #e2e2e2;
}

.message.user .message-bubble {
  background: #e5e7eb;
  color: #1d1d1f;
  padding: 0.75rem 1rem;
  border-radius: 18px;
}

body.dark-mode .message.user .message-bubble {
  background: #323232d9;
  color: #e2e2e2;
}

.message.bot .message-bubble {
  background: transparent;
  padding: 0.5rem 0;
  border-radius: 0;
}

.message-bubble p {
  margin: 0.35rem 0;
}

.message-bubble ul,
.message-bubble ol {
  margin: 0.5rem 0 0.5rem 1.25rem;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.message-bubble li {
  line-height: 1.6;
}

.message-bubble code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace !important;
  background: #f3f4f6;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  font-size: 0.8rem;
  color: #1d1d1f;
}

body.dark-mode .message-bubble code {
  background: #1f1f1f;
  color: #e2e2e2;
}

.message-bubble .code-block {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  overflow: hidden;
  margin: 0.9rem 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.02);
}

body.dark-mode .message-bubble .code-block {
  background: #0f0f0f;
  border: 1px solid #2a2a2a;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.01);
}

.message-bubble .code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0.95rem;
  background: #f3f4f6;
  border-bottom: 1px solid #e5e7eb;
}

body.dark-mode .message-bubble .code-block-header {
  background: #151515;
  border-bottom: 1px solid #2a2a2a;
}

.message-bubble .code-block-title {
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #6b7280;
  font-weight: 600;
}

body.dark-mode .message-bubble .code-block-title {
  color: #9ca3af;
}

.copy-code-button {
  background: #ffffff;
  border: 1px solid #d1d5db;
  color: #374151;
  font-size: 0.75rem;
  padding: 0.2rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

body.dark-mode .copy-code-button {
  background: #1f2937;
  border: 1px solid #374151;
  color: #e5e7eb;
}

.copy-code-button:hover,
.copy-code-button:focus {
  background: #0071e3;
  border-color: #0071e3;
  color: #ffffff;
  outline: none;
}

body.dark-mode .copy-code-button:hover,
body.dark-mode .copy-code-button:focus {
  background: #2563eb;
  border-color: #2563eb;
}

.copy-code-button.copied {
  background: #5b21b6;
  border-color: #7c3aed;
  color: #ede9fe;
}

body.dark-mode .copy-code-button.copied {
  background: #4338ca;
  border-color: #4f46e5;
  color: #eef2ff;
}

.copy-code-button.error {
  background: #dc2626;
  border-color: #ef4444;
  color: #fee2e2;
}

body.dark-mode .copy-code-button.error {
  background: #b91c1c;
  border-color: #ef4444;
}

/* Prescription Block Styles - Minimalist Design */
.message-bubble .prescription-block {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  margin: 0.9rem 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  position: relative;
}

body.dark-mode .message-bubble .prescription-block {
  background: #0a0a0a;
  border: 1px solid #2a2a2a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.copy-prescription-button {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: #6b7280;
  font-size: 0.65rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  z-index: 10;
}

body.dark-mode .copy-prescription-button {
  color: #9ca3af;
}

.copy-prescription-button svg {
  flex-shrink: 0;
}

.copy-prescription-button:hover,
.copy-prescription-button:focus {
  color: #1d1d1f;
  outline: none;
}

body.dark-mode .copy-prescription-button:hover,
body.dark-mode .copy-prescription-button:focus {
  color: #e5e7eb;
}

.copy-prescription-button.copied {
  color: #1d1d1f;
}

body.dark-mode .copy-prescription-button.copied {
  color: #e5e7eb;
}

.copy-prescription-button.error {
  color: #6b7280;
}

body.dark-mode .copy-prescription-button.error {
  color: #9ca3af;
}

.message-bubble .prescription-content {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  background: #ffffff;
  padding: 1.2rem 1.5rem;
  color: #374151;
  font-size: 0.75rem;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: #d1d5db #f9fafb;
}

body.dark-mode .message-bubble .prescription-content {
  background: #000000;
  color: #d1d5db;
  scrollbar-color: #374151 #0a0a0a;
}

.message-bubble .prescription-content::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}

.message-bubble .prescription-content::-webkit-scrollbar-track {
  background: #f9fafb;
  border-radius: 999px;
}

body.dark-mode .message-bubble .prescription-content::-webkit-scrollbar-track {
  background: #0a0a0a;
}

.message-bubble .prescription-content::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 999px;
}

body.dark-mode .message-bubble .prescription-content::-webkit-scrollbar-thumb {
  background: #374151;
}

.message-bubble .prescription-content::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

body.dark-mode .message-bubble .prescription-content::-webkit-scrollbar-thumb:hover {
  background: #4b5563;
}

.message-bubble pre {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace !important;
  background: transparent;
  padding: 0.95rem 1.2rem;
  overflow-x: auto;
  margin: 0;
  font-size: 0.82rem;
  scrollbar-width: thin;
  scrollbar-color: #d1d5db #f3f4f6;
}

body.dark-mode .message-bubble pre {
  scrollbar-color: #374151 #111827;
}

.message-bubble pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
  display: block;
  white-space: pre;
}

.message-bubble pre::-webkit-scrollbar {
  height: 6px;
}

.message-bubble pre::-webkit-scrollbar-track {
  background: #111827;
  border-radius: 999px;
}

.message-bubble pre::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, #1f2937, #374151);
  border-radius: 999px;
}

.message-bubble pre::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(90deg, #4b5563, #6b7280);
}

.message-time {
  display: none;
}

/* Message Controls & Actions */
.message-controls {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.35rem;
}

.message.user .message-controls {
  justify-content: flex-end;
}

.message.bot .message-controls {
  justify-content: flex-start;
}

.message-actions {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.message:hover .message-actions {
  opacity: 1;
}

.message-action-btn {
  background: transparent;
  border: none;
  color: #6b7280;
  cursor: pointer;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

body.dark-mode .message-action-btn {
  color: #737373;
}

.message-action-btn:hover {
  background: #f3f4f6;
  color: #374151;
}

body.dark-mode .message-action-btn:hover {
  background: #2a2a2a;
  color: #b1b1b1;
}

.message-action-btn:active {
  transform: scale(0.96);
}

.message-action-btn i {
  font-size: 16px;
}

/* Editable Message Bubble */
.message-bubble-editor {
  width: 100%;
  box-sizing: border-box;
  background: #e5e7eb;
  color: #1d1d1f;
  padding: 0.75rem 1rem;
  border-radius: 18px;
  font-size: 0.875rem;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  border: 1px solid #d1d5db;
  resize: vertical;
  min-height: auto;
  line-height: 1.6;
  display: none;
  word-wrap: break-word;
  overflow-y: hidden;
}

body.dark-mode .message-bubble-editor {
  background: #323232d9;
  color: #e2e2e2;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.message-bubble-editor:focus {
  outline: none;
  border-color: #9ca3af;
  box-shadow: 0 0 0 1px rgba(0, 113, 227, 0.1);
}

body.dark-mode .message-bubble-editor:focus {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.message.editing .message-bubble {
  display: none;
}

.message.editing .message-bubble-editor {
  display: block;
}

/* Forçar largura completa ao editar - manter consistência com bubble original */
.message.user.editing {
  max-width: 85% !important;
  width: 100%;
}

/* Garantir que o editor ocupe toda a largura disponível */
.message.user.editing .message-content {
  width: 100% !important;
  flex: 1 1 100%;
  max-width: none;
  min-width: 0;
}

.message.user.editing .message-bubble-editor {
  width: 100% !important;
  max-width: none;
  box-sizing: border-box;
}

/* Para mensagens do bot, manter consistência também */
.message.bot.editing .message-bubble-editor {
  background: transparent;
  padding: 0.5rem 0;
  border-radius: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Inline Editor Actions */
.message-editor-actions {
  display: none;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  justify-content: flex-end;
}

.message.editing .message-editor-actions {
  display: flex;
}

.message-editor-btn {
  background: transparent;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 0.325rem 0.5rem;
  border-radius: 8px;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.325rem;
  transition: all 0.15s ease;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  white-space: nowrap;
}

body.dark-mode .message-editor-btn {
  color: #737373;
}

.message-editor-btn.cancel {
  background: transparent;
  color: #6b7280;
}

body.dark-mode .message-editor-btn.cancel {
  color: #737373;
}

.message-editor-btn.cancel:hover {
  background: #f3f4f6;
  color: #374151;
}

body.dark-mode .message-editor-btn.cancel:hover {
  background: #2a2a2a;
  color: #b1b1b1;
}

.message-editor-btn.save {
  background: transparent;
  color: #6b7280;
}

body.dark-mode .message-editor-btn.save {
  color: #737373;
}

.message-editor-btn.save:hover {
  background: #f3f4f6;
  color: #374151;
}

body.dark-mode .message-editor-btn.save:hover {
  background: #2a2a2a;
  color: #b1b1b1;
}

.message-editor-btn:active {
  transform: scale(0.96);
}

.message-editor-btn i {
  font-size: 14px;
}

/* Version Navigator */
.message-version-nav {
  display: none;
  align-items: center;
  gap: 0.2rem;
  min-height: 26px;
}

.message-version-nav.active {
  display: inline-flex;
}

.message-version-nav-btn {
  background: transparent;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  width: 24px;
  height: 24px;
}

body.dark-mode .message-version-nav-btn {
  color: #a1a1a1;
}

.message-version-nav-btn:hover:not(:disabled) {
  background: #f3f4f6;
  color: #1d1d1f;
}

body.dark-mode .message-version-nav-btn:hover:not(:disabled) {
  background: #2a2a2a;
  color: #e2e2e2;
}

.message-version-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.message-version-nav-btn i {
  font-size: 16px;
}

.message-version-info {
  font-size: 0.7rem;
  color: #9ca3af;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  user-select: none;
  min-width: 28px;
  text-align: center;
}

body.dark-mode .message-version-info {
  color: #737373;
}

.message.user .message-version-nav,
.message.bot .message-version-nav {
  margin: 0;
}

/* Hide actions when editing */
.message.editing .message-actions {
  display: none;
}

.message.editing .message-controls {
  display: none;
}

.message.editing .message-version-nav {
  display: none !important;
}

/* Typing Indicator */
.typing-indicator {
  display: none;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0;
  margin-top: -3rem;
}

.typing-indicator.active {
  display: flex;
}

.typing-dots {
  display: flex;
  gap: 0.3rem;
  padding: 0.5rem 0;
  background-color: transparent;
  border-radius: 0;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #9ca3af;
  animation: typingAnimation 1.4s infinite;
}

body.dark-mode .typing-dot {
  background-color: #6b7280;
}

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

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

@keyframes typingAnimation {
  0%, 60%, 100% {
    opacity: 0.3;
  }
  30% {
    opacity: 1;
  }
}

/* Mode Dropdown in Header */
.mode-dropdown {
  position: relative;
  margin-right: 0.25rem;
}


.mode-dropdown-trigger {
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  color: #374151;
  cursor: pointer;
  padding: 0.4rem 0.5rem 0.4rem 1rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1;
}

body.dark-mode .mode-dropdown-trigger {
  background-color: rgba(36, 36, 36, 0.8);
  border: 1px solid #2a2a2a;
  color: #dcdcdc;
}

.mode-dropdown-trigger:hover,
.mode-dropdown-trigger:focus-visible {
  background-color: #f3f4f6;
  outline: none;
}

body.dark-mode .mode-dropdown-trigger:hover,
body.dark-mode .mode-dropdown-trigger:focus-visible {
  background-color: rgba(48, 48, 48, 0.88);
}

.mode-dropdown-label {
  color: #374151;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  line-height: 1;
}

body.dark-mode .mode-dropdown-label {
  color: #dcdcdc;
}

.mode-dropdown-icon {
  font-size: 16px;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

body.dark-mode .mode-dropdown-icon {
  color: #8b8b8b;
}

.mode-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.25rem);
  right: 0;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1), 0 4px 12px rgba(0, 0, 0, 0.08);
  min-width: 190px;
  z-index: 1000;
  display: none;
  padding: 0.15rem 0;
}

body.dark-mode .mode-dropdown-menu {
  background: #1a1a1a;
  border: 1px solid #272727;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.mode-dropdown.open .mode-dropdown-menu {
  display: block;
}

.mode-dropdown-item {
  width: 100%;
  background: transparent;
  border: none;
  color: #374151;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-align: left;
  font-size: 0.78rem;
}

body.dark-mode .mode-dropdown-item {
  color: #d9d9d9;
}

.mode-dropdown-item + .mode-dropdown-item {
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

body.dark-mode .mode-dropdown-item + .mode-dropdown-item {
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.mode-dropdown-item:hover {
  background-color: #f3f4f6;
}

body.dark-mode .mode-dropdown-item:hover {
  background-color: rgba(55, 55, 55, 0.75);
}

.mode-dropdown-item:focus-visible {
  background-color: #e5e7eb;
  outline: 1px solid rgba(0, 113, 227, 0.2);
}

body.dark-mode .mode-dropdown-item:focus-visible {
  background-color: rgba(55, 55, 55, 0.8);
  outline: 1px solid rgba(255, 255, 255, 0.12);
}

.mode-dropdown-item.active {
  background-color: #e5e7eb;
}

body.dark-mode .mode-dropdown-item.active {
  background-color: rgba(60, 60, 60, 0.85);
}

.mode-dropdown-item i {
  font-size: 18px;
  color: #6b7280;
  flex-shrink: 0;
}

body.dark-mode .mode-dropdown-item i {
  color: #a6a6a6;
}

.mode-dropdown-item.active i {
  color: #1d1d1f;
}

body.dark-mode .mode-dropdown-item.active i {
  color: #dfe2e6;
}

.mode-dropdown-item-text {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.mode-dropdown-item.active .mode-dropdown-item-title {
  color: #1d1d1f;
}

body.dark-mode .mode-dropdown-item.active .mode-dropdown-item-title {
  color: #f0f0f0;
}

.mode-dropdown-item-title {
  font-size: 0.78rem;
  font-weight: 500;
  color: #374151;
}

body.dark-mode .mode-dropdown-item-title {
  color: #dcdcdc;
}

.mode-dropdown-item-desc {
  font-size: 0.7rem;
  color: #6b7280;
}

body.dark-mode .mode-dropdown-item-desc {
  color: #8d9399;
}

/* Chat Input Area */
.chat-input-container {
  padding: 1.1rem 1.25rem 0.5rem;
  background-color: #f9fafb;
  display: flex;
  flex-direction: column;
  /* Compact spacing between stacked controls */
  gap: 0.25rem;
}

body.dark-mode .chat-input-container {
  background-color: #1f1f1f;
}

/* Quick Action Editor (Inline) */
.quick-action-editor {
  width: 100%;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
}

body.dark-mode .quick-action-editor {
  background-color: #252525;
  border: 1px solid #343434;
}

.quick-action-editor--inline {
  margin-top: 0.35rem;
}

.quick-action-editor__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background-color: #f3f4f6;
  border-bottom: 1px solid #e5e7eb;
}

body.dark-mode .quick-action-editor__header {
  background-color: rgba(30, 30, 30, 0.6);
  border-bottom: 1px solid #2b2b2b;
}

.quick-action-editor__title {
  font-size: 0.85rem;
  font-weight: 500;
  color: #1d1d1f;
}

body.dark-mode .quick-action-editor__title {
  color: #e2e2e2;
}

.quick-action-editor__close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, color 0.15s ease;
}

body.dark-mode .quick-action-editor__close {
  color: rgba(255, 255, 255, 0.6);
}

.quick-action-editor__close:hover {
  background-color: #e5e7eb;
  color: #1d1d1f;
}

body.dark-mode .quick-action-editor__close:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
}

.quick-action-editor__close i {
  font-size: 18px;
}

.quick-action-editor__field {
  padding: 0.75rem 1rem;
}

.quick-action-editor__field:not(:last-child) {
  border-bottom: 1px solid #e5e7eb;
}

body.dark-mode .quick-action-editor__field:not(:last-child) {
  border-bottom: 1px solid #2b2b2b;
}

.quick-action-editor__label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  margin-bottom: 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

body.dark-mode .quick-action-editor__label {
  color: #a1a1a1;
}

.quick-action-editor__input,
.quick-action-editor__textarea {
  width: 100%;
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  color: #1d1d1f;
  font-size: 0.9rem;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  padding: 0.6rem 0.75rem;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

body.dark-mode .quick-action-editor__input,
body.dark-mode .quick-action-editor__textarea {
  background-color: #1e1e1e;
  border: 1px solid #343434;
  color: #e2e2e2;
}

.quick-action-editor__input:focus,
.quick-action-editor__textarea:focus {
  outline: none;
  border-color: #0071e3;
  background-color: #ffffff;
}

body.dark-mode .quick-action-editor__input:focus,
body.dark-mode .quick-action-editor__textarea:focus {
  border-color: #4a4a4a;
  background-color: #232323;
}

.quick-action-editor__input::placeholder,
.quick-action-editor__textarea::placeholder {
  color: #9ca3af;
}

body.dark-mode .quick-action-editor__input::placeholder,
body.dark-mode .quick-action-editor__textarea::placeholder {
  color: #6b6b6b;
}

.quick-action-editor__textarea {
  resize: vertical;
  min-height: 72px;
  line-height: 1.5;
}

.quick-action-editor__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background-color: #f3f4f6;
}

body.dark-mode .quick-action-editor__actions {
  background-color: rgba(30, 30, 30, 0.4);
}

.quick-action-editor__button {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  border: none;
}

.quick-action-editor__button:active {
  transform: scale(0.97);
}

.quick-action-editor__button--cancel {
  background-color: transparent;
  color: #6b7280;
}

body.dark-mode .quick-action-editor__button--cancel {
  color: #a1a1a1;
}

.quick-action-editor__button--cancel:hover {
  background-color: #e5e7eb;
  color: #1d1d1f;
}

body.dark-mode .quick-action-editor__button--cancel:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #e2e2e2;
}

.quick-action-editor__button--save {
  background-color: #0071e3;
  color: #ffffff;
}

body.dark-mode .quick-action-editor__button--save {
  background-color: #d1d1d1;
  color: #1f1f1f;
}

.quick-action-editor__button--save:hover {
  background-color: #005bb5;
}

body.dark-mode .quick-action-editor__button--save:hover {
  background-color: #c5c5c5;
}

.quick-action-editor__button--save i {
  font-size: 18px;
}

.chat-input-wrapper {
  width: 100%;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 30px;
  padding: 0.45rem 0.6rem 0.45rem 1rem;
}

body.dark-mode .chat-input-wrapper {
  background-color: #252525;
  border: none;
}

.chat-input {
  flex: 1 1 auto;
  background: transparent;
  border: none;
  color: #1d1d1f;
  font-size: 0.9rem;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  resize: none;
  max-height: 140px;
  line-height: 1.45;
  min-height: 42px;
  /* Center the single-line placeholder within the pill-shaped field */
  padding: calc((42px - 1.45em) / 2) 0;
  margin: 0;
  overflow-y: auto;
  display: block;
  width: 100%;
}

body.dark-mode .chat-input {
  color: #e2e2e2;
}

.chat-input:focus {
  outline: none;
}

.chat-input::placeholder {
  color: #9ca3af;
}

body.dark-mode .chat-input::placeholder {
  color: #737373;
}

.chat-send-button {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: #e5e7eb;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, transform 0.15s ease;
  flex-shrink: 0;
}

body.dark-mode .chat-send-button {
  background: #353535;
}

.chat-send-button:hover:not(:disabled) {
  background: #d1d5db;
}

body.dark-mode .chat-send-button:hover:not(:disabled) {
  background: #3f3f3f;
}

.chat-send-button:active:not(:disabled) {
  transform: scale(0.96);
}

.chat-send-button:focus-visible {
  outline: none;
}

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

.chat-send-button i {
  font-size: 18px;
  color: #6b7280;
}

body.dark-mode .chat-send-button i {
  color: #e2e2e2;
}

.chat-send-button.is-ready {
  background: #0071e3;
  border: none;
}

body.dark-mode .chat-send-button.is-ready {
  background: #d1d1d1;
}

.chat-send-button.is-ready:hover:not(:disabled) {
  background: #005bb5;
}

body.dark-mode .chat-send-button.is-ready:hover:not(:disabled) {
  background: #c9c9c9;
}

.chat-send-button.is-ready i {
  color: #ffffff;
}

body.dark-mode .chat-send-button.is-ready i {
  color: #1f1f1f;
}

/* Chat Disclaimer */
.chat-disclaimer {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.6rem;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #9ca3af;
  padding: 0.15rem 0.75rem 0.2rem;
  line-height: 1.3;
}

body.dark-mode .chat-disclaimer {
  color: #737373;
}

/* Welcome Message */
.welcome-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  text-align: center;
  padding: 3.5rem 1.5rem 1.5rem;
  min-height: 220px;
}

.welcome-line {
  margin: 0;
  font-weight: 300;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  color: #6b7280;
}

body.dark-mode .welcome-line {
  color: #a1a1a1;
}

.welcome-line.is-highlight {
  color: #1d1d1f;
  font-size: 1.3rem;
}

body.dark-mode .welcome-line.is-highlight {
  color: #e2e2e2;
}

/* Quick Actions */
.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.75rem 1.25rem;
  margin: 0.25rem 0 0.75rem;
  background: none;
  border: none;
}

.quick-actions.quick-actions--compact {
  padding: 0.45rem 1rem;
  background: none;
}

.quick-action-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.quick-action-button {
  flex: 1 1 auto;
  background-color: #f3f4f6;
  border: 1px solid #e5e7eb;
  color: #374151;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  text-align: left;
  transition: background-color 0.15s ease, transform 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  position: relative;
}

body.dark-mode .quick-action-button {
  background-color: rgba(37, 37, 37, 0.95);
  border: none;
  color: #e0e0e0;
}

.quick-action-button:hover {
  background-color: #e5e7eb;
}

body.dark-mode .quick-action-button:hover {
  background-color: rgba(46, 46, 46, 0.95);
}

.quick-action-button:hover .quick-action-controls {
  opacity: 1;
}

.quick-action-button i {
  color: #6b7280;
  font-size: 18px;
  flex-shrink: 0;
}

body.dark-mode .quick-action-button i {
  color: rgba(255, 255, 255, 0.6);
}

.quick-action-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-action-controls {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  margin-left: auto;
  padding-left: 0.5rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.quick-action-control {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s ease, transform 0.1s ease;
  flex-shrink: 0;
}

.quick-action-control:hover {
  color: #1d1d1f;
}

body.dark-mode .quick-action-control {
  color: rgba(255, 255, 255, 0.45);
}

body.dark-mode .quick-action-control:hover {
  color: rgba(255, 255, 255, 0.85);
}

.quick-action-control:active {
  transform: scale(0.95);
}

.quick-action-control--delete:hover {
  color: #ff8888;
}

.quick-action-control .material-icons {
  font-size: 16px;
}

.quick-actions-add-inline {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #d2d2d7;
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: transparent;
  border-left: none;
  border-right: none;
  border-bottom: none;
  color: #6b7280;
  padding-left: 0.6rem;
  padding-right: 0.6rem;
  padding-bottom: 0.35rem;
  border-radius: 0;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 400;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.quick-actions-add-inline:hover {
  background-color: rgba(0, 0, 0, 0.03);
  color: #1d1d1f;
  border-top-color: #b8b8bb;
}

.quick-actions-add-inline:active {
  background-color: rgba(0, 0, 0, 0.05);
  transform: scale(0.98);
}

.quick-actions-add-inline:focus-visible {
  outline: 2px solid rgba(0, 113, 227, 0.25);
  outline-offset: -2px;
  color: #0071e3;
}

body.dark-mode .quick-actions-add-inline {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.5);
}

body.dark-mode .quick-actions-add-inline:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.85);
  border-top-color: rgba(255, 255, 255, 0.12);
}

body.dark-mode .quick-actions-add-inline:active {
  background-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .quick-actions-add-inline:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.9);
}

.quick-actions-add-inline .material-icons {
  font-size: 17px;
  opacity: 0.75;
  transition: opacity 0.15s ease;
}

.quick-actions-add-inline:hover .material-icons {
  opacity: 1;
}

/* Responsive Design */
/* ===================================
   Mobile Optimizations
=================================== */

@media (max-width: 768px) {
  .chat-container {
    width: 100%;
    height: 100%;
    bottom: 0;
    right: 0;
    border-radius: 0;
    border: none;
    min-width: auto;
    max-width: 100%;
    min-height: 100%;
    max-height: 100%;
  }

  .chat-container.docked {
    width: 100%;
    max-width: 100%;
  }

  .chat-header {
    border-radius: 0;
    padding: 0.875rem 1rem;
  }

  .chat-button {
    bottom: 1.5rem;
    right: 1.5rem;
    width: 58px;
    height: 58px;
  }

  .chat-dock-toggle {
    display: none;
  }

  .chat-resize-edge,
  .chat-resize-corner {
    display: none;
  }

  /* Optimize messages area for mobile */
  .chat-messages {
    padding: 1rem;
    gap: 1rem;
  }

  /* Better touch targets */
  .chat-close,
  .chat-reset {
    min-width: 44px;
    min-height: 44px;
    padding: 0.625rem;
  }

  .chat-send-button {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
  }

  /* Improve input area spacing */
  .chat-input-wrapper {
    padding: 0.5rem 0.75rem 0.5rem 1rem;
    gap: 0.625rem;
  }

  .chat-input {
    font-size: 1rem; /* Prevent zoom on iOS */
    max-height: 120px;
  }

  /* Quick actions optimization */
  .quick-actions-container {
    padding: 0.75rem 1rem;
    gap: 0.625rem;
  }

  .quick-action-button {
    padding: 0.625rem 0.875rem;
    font-size: 0.8rem;
    min-height: 44px;
  }

  /* Welcome message adjustment */
  .welcome-message {
    padding: 2rem 1rem 1rem;
    gap: 0.5rem;
  }

  .welcome-line {
    font-size: 1rem;
  }

  /* Chat disclaimer mobile */
  .chat-disclaimer {
    padding: 0.375rem 1rem 0.5rem;
    font-size: 0.625rem;
  }

  /* Bubble editor mobile - manter consistência com bubble original */
  .message-bubble-editor {
    font-size: 0.85rem;
    min-height: auto;
    padding: 0.625rem 0.875rem;
  }

  .message.user.editing {
    max-width: 85% !important;
    width: 100%;
  }

  .message.user.editing .message-content {
    width: 100% !important;
  }

  .message.user.editing .message-bubble-editor {
    width: 100% !important;
  }

  .message-editor-actions {
    margin-top: 0.45rem;
  }

  .message-editor-btn {
    padding: 0.325rem 0.5rem;
    font-size: 0.7rem;
  }

  .message-editor-btn i {
    font-size: 14px;
  }

  .message-controls {
    gap: 0.3rem;
  }

  /* Version navigator mobile */
  .message-version-nav {
    gap: 0.25rem;
  }

  .message-version-nav-btn {
    width: 28px;
    height: 28px;
  }

  .message-version-info {
    font-size: 0.675rem;
    min-width: 34px;
  }
}

@media (max-width: 480px) {
  .chat-button {
    width: 54px;
    height: 54px;
    bottom: 1.25rem;
    right: 1.25rem;
  }

  /* More compact on small screens */
  .chat-messages {
    padding: 0.875rem;
    gap: 0.875rem;
  }

  .message.user {
    max-width: 85%;
  }

  .message.bot {
    max-width: 92%;
  }

  /* Reduce message bubble padding */
  .message-bubble {
    padding: 0.625rem 0.875rem;
    font-size: 0.9rem;
  }

  .message-controls {
    margin-top: 0.28rem;
    gap: 0.25rem;
  }

  /* Message actions mobile */
  .message-actions {
    opacity: 1; /* Always visible on mobile */
  }

  .message-action-btn {
    width: 26px;
    height: 26px;
  }

  /* Bubble editor mobile (480px) - manter consistência com bubble original */
  .message-bubble-editor {
    font-size: 0.8rem;
    min-height: auto;
    padding: 0.625rem 0.75rem;
  }

  .message.user.editing {
    max-width: 85% !important;
    width: 100%;
  }

  .message.user.editing .message-content {
    width: 100% !important;
  }

  .message.user.editing .message-bubble-editor {
    width: 100% !important;
  }

  .message-editor-actions {
    margin-top: 0.4rem;
    gap: 0.4rem;
  }

  .message-editor-btn {
    padding: 0.375rem 0.625rem;
    font-size: 0.675rem;
    min-height: 32px;
  }

  .message-editor-btn i {
    font-size: 13px;
  }

  /* Version navigator mobile (480px) */
  .message-version-nav-btn {
    width: 26px;
    height: 26px;
  }

  .message-version-info {
    font-size: 0.65rem;
    min-width: 32px;
  }

  /* Header adjustments */
  .chat-header {
    padding: 0.75rem 0.875rem;
  }

  .chat-title {
    font-size: 0.95rem;
  }

  /* Input area */
  .chat-input-wrapper {
    padding: 0.45rem 0.625rem 0.45rem 0.875rem;
  }

  .chat-input {
    font-size: 1rem;
    max-height: 100px;
  }

  .chat-send-button {
    width: 38px;
    height: 38px;
  }

  .chat-send-button i {
    font-size: 17px;
  }

  /* Quick actions even more compact */
  .quick-actions-container {
    padding: 0.625rem 0.875rem;
    gap: 0.5rem;
  }

  .quick-action-button {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
  }

  .quick-action-button i {
    font-size: 16px;
  }

  /* Welcome message */
  .welcome-message {
    padding: 1.5rem 0.875rem 0.875rem;
  }

  .welcome-line {
    font-size: 0.95rem;
  }

  /* Chat disclaimer */
  .chat-disclaimer {
    padding: 0.325rem 0.875rem 0.45rem;
    font-size: 0.6rem;
  }

  /* Code blocks in messages */
  .message-bubble pre {
    font-size: 0.8rem;
    padding: 0.5rem;
  }

  /* Copy buttons in code blocks */
  .code-block-header {
    padding: 0.375rem 0.5rem;
    font-size: 0.7rem;
  }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .chat-messages {
    padding: 0.75rem;
  }

  .chat-input {
    max-height: 80px;
  }

  .welcome-message {
    padding: 1.25rem 1rem 0.75rem;
    min-height: 140px;
  }
}

/* Accessibility */
.chat-button:focus-visible,
.chat-reset:focus-visible,
.chat-close:focus-visible,
.chat-send-button:focus-visible,
.quick-action-button:focus-visible {
  outline: 2px solid #01e6cd;
  outline-offset: 2px;
}

.chat-input:focus-visible {
  outline: none;
}

/* Touch optimization */
@media (hover: none) and (pointer: coarse) {
  /* Remove hover effects on touch devices */
  .chat-button:hover {
    transform: none;
  }

  .chat-send-button:hover:not(:disabled),
  .quick-action-button:hover,
  .chat-close:hover,
  .chat-reset:hover {
    transform: none;
  }

  /* Add active states for better feedback */
  .chat-button:active {
    transform: scale(0.95);
  }

  .chat-send-button:active:not(:disabled),
  .quick-action-button:active,
  .chat-close:active,
  .chat-reset:active {
    transform: scale(0.94);
    transition: transform 0.1s ease;
  }

  /* Ensure touch-friendly scrolling */
  .chat-messages {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }

  .chat-input {
    -webkit-overflow-scrolling: touch;
  }
}

/* Loading state for messages */
.message-bubble.loading {
  opacity: 0.6;
}

/* Loading state for messages */
.message-bubble.loading {
  opacity: 0.6;
}

/* Error state */
.message-bubble.error {
  background-color: #3a2020;
  border: 1px solid #5a3030;
}

.message.bot .message-bubble.error {
  color: #ff8888;
}

/* ===================================
  Confirmation Modal - ChatGPT Style
=================================== */

.confirmation-modal-content {
  max-width: 440px;
  padding: 1.5rem;
  background-color: #2c2c2c;
  border: none;
  animation: confirmModalFadeIn 0.2s ease-out;
}

@keyframes confirmModalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(-8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.confirmation-modal-header {
  margin-bottom: 1rem;
}

.confirmation-modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #e2e2e2;
  margin: 0;
  letter-spacing: -0.01em;
}

.confirmation-modal-body {
  margin-bottom: 1.5rem;
}

.confirmation-modal-message {
  font-size: 0.9rem;
  color: #b4b4b4;
  line-height: 1.5;
  margin: 0;
}

.confirmation-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.625rem;
}

.confirmation-btn {
  padding: 0.625rem 1.25rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 80px;
  font-family: inherit;
}

.confirmation-btn:focus-visible {
  outline: 2px solid rgba(99, 91, 255, 0.5);
  outline-offset: 2px;
}

.confirmation-btn-cancel {
  background-color: transparent;
  color: #e2e2e2;
  border: 1px solid #4a4a4a;
}

.confirmation-btn-cancel:hover {
  background-color: #2a2a2a;
  border-color: #5a5a5a;
}

.confirmation-btn-cancel:active {
  background-color: #252525;
  transform: scale(0.98);
}

.confirmation-btn-confirm {
  background-color: #d93d3d;
  color: #ffffff;
}

.confirmation-btn-confirm:hover {
  background-color: #e24c4c;
}

.confirmation-btn-confirm:active {
  background-color: #c73434;
  transform: scale(0.98);
}

/* Mobile responsiveness */
@media (max-width: 480px) {
  .confirmation-modal-content {
    max-width: calc(100vw - 2rem);
    padding: 1.25rem;
  }

  .confirmation-modal-actions {
    flex-direction: column-reverse;
    gap: 0.5rem;
  }

  .confirmation-btn {
    width: 100%;
  }
}

