/* Estilos específicos para o componente de entrada de mensagens */

/* Estilização da scrollbar para todo o aplicativo */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-secondary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #1f3342;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #008da3;
}

/* Container do formulário de mensagem  */
#message-form {
  /*transition: all var(--transition-speed) ease-in-out;*/
  padding: 0.02em 8px;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  background-color: var(--color-bg-tertiary);
  border-radius: 16px;
  box-sizing: border-box;
  border: none;
  position: relative;
}

/* Estilos para o formulário quando centralizado (tela vazia) */
#message-form.centered {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: 0;
  right: 0;
  margin: 0 auto;
  width: 100%;
  max-width: 800px;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
  border: none;
  background-color: var(--color-bg-tertiary);
  z-index: 10;
  padding: 8px 10px 6px 10px;
  box-sizing: border-box;
  transition: all 0.3s ease-in-out;
}

/* Ajustes para o input quando centralizado */
#message-form.centered #message-input {
  font-size: 1.1em;
  padding: 6px 12px;
  /* Mantém o input fino quando não há mensagens */
  min-height: 36px;
}

/* Ajustes para o botão quando centralizado */
#message-form.centered button {
  padding: 4px 8px;
  font-size: 1em;
}

/* Posicionamento natural para o formulário quando não está centralizado (com mensagens) */
#message-form:not(.centered),
#message-form.bottom-fixed {
  position: sticky;
  bottom: 0;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  margin-top: auto;
  padding-bottom: 8px;
  z-index: 100;
  border-radius: 16px 16px 0 0;
  background-color: var(--color-bg-tertiary);
  border: none;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.35);
  box-sizing: border-box;
  padding: 8px 10px 6px 10px;
  overflow: visible;
  display: flex;
  flex-direction: column;
  height: auto;
}

/* Container principal do input */
.message-input-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  flex: 1;
  box-sizing: border-box;
  border-radius: 12px;
  background: transparent;
  border: none;
}

/* Área do textarea */
.textarea-container {
  width: 100%;
  background: transparent;
  border-radius: 12px;
  margin-bottom: 0;
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 4px 14px;
}

.textarea-container textarea {
  flex: 1;
  width: 100%;
  padding: 6px 0;
  border-radius: 10px;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.4;
  min-height: 28px;
  max-height: 130px;
  background: transparent;
  color: var(--color-text-primary);
  box-sizing: border-box;
  border: none;
  resize: none;
  overflow-y: auto;
  display: block;
}

.textarea-container textarea::placeholder {
  color: var(--color-text-muted);
}

.textarea-container textarea:focus {
  outline: none;
  border: none;
}

.textarea-container textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Impedir que o texto cresça separado da área de botões */
.textarea-container::after {
  content: "";
  display: block;
  height: 2px;
  width: 100%;
  background: transparent;
  position: absolute;
  bottom: -2px;
  left: 0;
}

/* Ajustes para o modo centralizado */
#message-form.centered .message-input-container {
  width: 100%;
  border-radius: var(--border-radius-md);
  margin-bottom: 2px;
  /* Evita que o container cresça e "empurre" a altura do formulário */
  flex: 0 0 auto;
}

#message-form.centered .textarea-container textarea {
  min-height: 36px;
  font-size: 16px;
  resize: none;
}

/* --- Thinking Bar --- */
.sapiens-thinking-bar {
  display: none;
  align-items: center;
  padding: 8px 12px;
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
  border-radius: var(--border-radius-md) var(--border-radius-md) 0 0;
  margin-bottom: 4px;
}

.sapiens-thinking-bar.active {
  display: flex;
}

.thinking-brain-wave {
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--color-accent-primary), transparent);
  background-size: 200% 100%;
  animation: brain-wave-flow 2s infinite linear;
  border-radius: 2px;
  margin-right: 12px;
}

@keyframes brain-wave-flow {
  0% {
    background-position: 100% 0;
  }

  100% {
    background-position: -100% 0;
  }
}

.thinking-text {
  font-size: 12px;
  color: var(--color-text-secondary);
  white-space: nowrap;
}

/* Container para os anexos — layout controlled by tray section below */

.attachment-preview {
  display: flex;
  align-items: center;
  padding: 2px 4px;
  background-color: var(--color-bg-tertiary);
  border-radius: var(--border-radius-md);
  border: 1px solid var(--color-border);
  margin-right: 5px;
  font-size: 10px;
}

.attachment-preview i.fa-regular.fa-file {
  margin-right: 5px;
  color: var(--color-text-secondary);
  font-size: 14px;
}

.attachment-preview .file-name {
  margin-right: 8px;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-preview .remove-file {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: 14px;
}

.attachment-preview .remove-file:hover {
  color: var(--color-accent-danger);
}

/* Container para os botões de ações  */
.action-buttons {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  background: transparent;
  width: 100%;
  padding: 2px 6px 4px 6px;
  box-sizing: border-box;
  position: relative;
  z-index: 2;
  margin-top: 0;
  border-top: none;
}

/* Botões dentro do formulário */
.action-buttons button {
  background: none;
  border: none;
  /* Remove border de todos os botões */
  cursor: pointer;
  font-size: 16px;
  padding: 3px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Botão de envio - modificado para destacar */
.send-button-container {
  margin-left: auto;
  height: 32px;
  display: flex;
  align-items: center;
}

.send-button-container button {
  color: var(--color-accent-primary);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  border: none;
  background: transparent;
}

.send-button-container button.stop-mode {
  color: var(--color-accent-danger);
  background-color: rgba(220, 53, 69, 0.12);
  border-radius: 50%;
  border: 1.5px solid rgba(220, 53, 69, 0.4);
}

.send-button-container button.stop-mode:hover {
  background-color: var(--color-accent-danger);
  color: white;
  transform: scale(1.1);
}

.send-button-container button:hover {
  background: transparent;
  color: var(--color-accent-primary-hover);
  transform: scale(1.1);
}

.send-button-container button i {
  font-size: 19px;
}

/* Botão de arquivo */
.file-upload-button-container {
  display: flex;
  margin-right: 5px;
  align-items: center;
  border-radius: 12px;
  border: none;
  /* Removido border */
  height: 28px;
}

.file-button {
  align-items: center;
  justify-content: center;
  background: none;
  color: var(--color-text-secondary);
  padding: 4px 8px;
  cursor: pointer;
  transition: color 0.2s;
  width: 100%;
  display: inline-flex;
}

.file-button.clip {
  color: var(--color-text-secondary);
}

.file-button.clip i {
  color: var(--color-text-secondary);
  margin-right: 2px;
  align-items: center;
  font-size: 18px;
}

.file-button input[type="file"] {
  position: absolute;
  color: var(--color-text-secondary);
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}

.file-button:hover {
  color: var (--color-accent-primary);
}

.file-button:focus-within {
  outline: 1px dotted var(--color-accent-primary);
  outline-offset: 2px;
}

/* Botão de seleção de modelo */
.model-selection-container {
  display: flex;
  margin-right: 5px;
  border-radius: 20px;
  border: none;
  background: transparent;
  align-items: center;
  transition: all 0.3s ease;
  padding: 2px 8px;
  height: 28px;
}

.deepthink-btn {
  color: var(--color-text-secondary);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: normal;
  font-size: 14px;
  line-height: 1;
}

.deepthink-btn i {
  margin-right: 5px;
  color: var(--color-text-secondary);
  transition: all 0.3s ease;
  font-size: 18px;
}


.model-selection-container.active {
  background-color: var(--color-accent-primary);
  border-color: var(--color-accent-primary);
  box-shadow: 0 0 5px var(--color-accent-primary);
}

.model-selection-container.active .deepthink-btn,
.model-selection-container.active .deepthink-btn i {
  color: var(--color-bg-primary);
  font-weight: bold;
}

/* Estado hover */
.deepthink-btn:hover,
.deepthink-btn:hover i {
  color: var(--color-accent-primary);
}

/* Estado hover para container ativo */
.model-selection-container.active .deepthink-btn:hover,
.model-selection-container.active .deepthink-btn:hover i {
  color: #ffffff;
}

/* Botão de microfone */
.mic-button-container {
  display: flex;
  margin-right: 8px;
  align-items: center;
  transition: all 0.3s ease;
  height: 32px;
  border: none;
  border-radius: 12px;
  padding: 0.1px;
}

.mic-btn {
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.mic-btn:hover {
  color: var(--color-accent-primary);
}

.mic-btn.active {
  background-color: rgba(220, 53, 69, 0.25);
  color: var(--color-accent-danger);
  animation: pulse 1.5s infinite;
  border: none;
}

/* Botão de WebSearch */
.websearch-button-container {
  display: flex;
  margin-right: 5px;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  height: 32px;
  border: none;
  border-radius: 12px;
  padding: 0.1px;
}

.websearch-btn {
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.websearch-btn:hover {
  color: var(--color-accent-primary);
}

.websearch-btn.active {
  color: var(--color-accent-primary);
  background-color: rgba(0, 141, 163, 0.25);
}

/* --- Mobile (<=868px) adjustments --- */
@media (max-width: 868px) {

  /* Form occupies full width with 1rem padding on each side */
  #message-form:not(.centered),
  #message-form.bottom-fixed {
    width: calc(100vw - 2rem);
    max-width: none;
    margin: 0 auto;
    padding: 12px 10px;
    overflow: visible !important;
  }

  /* Ensure message-input-container doesn't clip dropdown */
  .message-input-container {
    overflow: visible !important;
  }

  /* Keep action-buttons layout clean on mobile */
  .action-buttons {
    flex-wrap: nowrap;
    overflow: visible !important;
  }

  /* Hide the desktop reasoning container on mobile (handled by header button) */
  #desktop-reasoning-container {
    display: none !important;
  }
}

/* Animação de pulso para o botão ativo */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
  }
}

/* Estilo para navegadores não suportados */
.mic-btn.not-supported {
  opacity: 0.5;
  cursor: not-allowed;
  color: var(--color-text-secondary);
  border-color: rgba(255, 255, 255, 0.05);
}

.mic-btn.not-supported:hover {
  background-color: transparent;
  color: var(--color-text-secondary);
}

/* Mensagem de erro do reconhecimento de voz */
.speech-recognition-error {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--color-bg-tertiary);
  color: var(--color-accent-danger);
  padding: 10px 20px;
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-md);
  z-index: 1000;
  border: 1px solid var(--color-accent-danger);
  font-size: 14px;
  animation: fadeIn 0.3s ease;
}

.speech-recognition-error.fade-out {
  animation: fadeOut 0.5s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, 20px);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translate(-50%, 0);
  }

  to {
    opacity: 0;
    transform: translate(-50%, 20px);
  }
}

/* --- REDESIGNED ACTION BUTTONS LAYOUT --- */
.action-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.left-actions,
.right-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Botão Plus (+) e Dropdown */
.plus-menu-container {
  position: relative;
  display: inline-block;
}

.plus-btn {
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  cursor: pointer;
}

.plus-btn:hover,
.plus-btn.active {
  background-color: transparent !important;
  color: var(--color-accent-primary);
  transform: scale(1.05);
}

/* Botão de Anexar Arquivos (independente do menu de ferramentas) */
.attach-menu-container {
  position: relative;
  display: inline-block;
}

.attach-btn {
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  cursor: pointer;
}

.attach-btn:hover,
.attach-btn.active {
  background-color: transparent !important;
  color: var(--color-accent-primary);
  transform: scale(1.05);
}

.plus-dropdown {
  display: none;
  position: absolute;
  bottom: 44px;
  left: 0;
  background-color: var(--color-surface);
  border: 1px solid var(--glass-border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.04);
  border-radius: 16px;
  min-width: 230px;
  z-index: 10000;
  padding: 6px 0;
  backdrop-filter: blur(16px);
}

.plus-dropdown.show {
  display: block;
  animation: fadeInMenu 0.2s ease;
}

@keyframes fadeInMenu {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.plus-list {
  display: flex;
  flex-direction: column;
}

.plus-item,
.plus-subitem {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: var(--color-text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s;
  user-select: none;
}

.plus-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.plus-item:hover,
.plus-subitem:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--color-accent-primary);
}

.plus-item i,
.plus-subitem i {
  font-size: 16px;
  width: 20px;
  text-align: center;
  color: var(--color-text-secondary);
}

.plus-item:hover i,
.plus-subitem:hover i {
  color: var(--color-accent-primary);
}

/* Indicadores de Toggle ativo */
.plus-item .toggle-indicator {
  margin-left: auto;
  color: var(--color-text-secondary);
}

.plus-item.active {
  background-color: rgba(0, 141, 163, 0.1);
  color: var(--color-accent-primary);
}

.plus-item.active .toggle-indicator {
  color: var(--color-accent-primary);
}

/* Painel de Volume de Raciocínio */
.plus-volume-panel {
  display: none;
  flex-direction: column;
  padding: 12px 20px;
  background-color: rgba(0, 0, 0, 0.12);
  border-top: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
  box-sizing: border-box;
  width: 100%;
}

.plus-volume-panel.show {
  display: flex;
}

.plus-volume-panel .slider-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.plus-volume-panel .slider-limit {
  font-size: 11px;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
  user-select: none;
}



/* Floating commands dropdown popup list above textarea */
.floating-commands-dropdown {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 0;
  width: 100%;
  max-width: 400px;
  background-color: var(--color-surface);
  border: 1px solid var(--glass-border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.04);
  border-radius: 16px;
  z-index: 11000;
  max-height: 250px;
  overflow-y: auto;
  padding: 6px 0;
  backdrop-filter: blur(16px);
  animation: fadeInMenu 0.2s ease;
}

.floating-command-item {
  display: flex;
  flex-direction: column;
  padding: 8px 16px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  user-select: none;
}

.floating-command-item:hover,
.floating-command-item.selected {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--color-accent-primary);
}

.floating-command-item .command-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
}

.floating-command-item .command-prefix {
  color: var(--color-accent-primary);
}

.floating-command-item .command-title {
  color: var(--color-text-secondary);
  font-size: 12px;
  margin-left: auto;
  font-weight: normal;
}

.floating-command-item .command-desc {
  font-size: 12px;
  color: var(--color-text-muted, #777777);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === DEEP THINK ACTIVE INDICATOR === */
#message-form:has(.model-selection-container.active) {
  box-shadow: 0 0 0 1.5px rgba(0, 141, 163, 0.45), 0 -12px 40px rgba(0, 0, 0, 0.35);
}

#message-form:has(.model-selection-container.active)::before {
  content: 'Deep Think';
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 141, 163, 0.12);
  border: 1px solid rgba(0, 141, 163, 0.35);
  border-radius: 20px;
  padding: 2px 12px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--color-accent-primary);
  white-space: nowrap;
  pointer-events: none;
}

/* === ATTACHMENT TRAY === */

/* Container: chips flow left-to-right, wrap to new line */
.message-attachments {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 5px;
  padding: 4px 2px 2px;
  width: 100%;
  align-items: center;
}

/* Toggle: always the first item and always occupies a full line */
.attachment-tray-toggle {
  flex: 0 0 100%;
  order: -1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  color: var(--color-text-secondary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.02em;
  box-sizing: border-box;
}

.attachment-tray-toggle:hover {
  background: rgba(255, 255, 255, 0.10);
  color: var(--color-text-primary);
}

.attachment-tray-toggle .tray-chevron {
  margin-left: auto;
  font-size: 10px;
  transition: transform 0.2s ease;
}

/* Collapsed: hide cards, keep toggle visible */
#message-attachments.tray-collapsed .attachment-card {
  display: none;
}

/* Individual chip */
.attachment-card {
  display: inline-flex;
  align-items: center;
  max-width: 180px;
  flex-shrink: 0;
}

.attachment-card .attachment-info {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  color: var(--color-text-primary);
  transition: background 0.15s ease;
  width: 100%;
  min-width: 0;
}

.attachment-card .attachment-info:hover {
  background: rgba(255, 255, 255, 0.09);
}

.attachment-card .attachment-icon {
  font-size: 13px;
  flex-shrink: 0;
  width: 16px;
  text-align: center;
}

.attachment-card .attachment-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.attachment-card .attachment-name {
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text-primary);
  line-height: 1.2;
}

.attachment-card .attachment-ext {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  line-height: 1;
}

.attachment-card .remove-attachment-btn {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 1px 2px;
  opacity: 0.3;
  transition: opacity 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
  font-size: 10px;
  line-height: 1;
}

.attachment-card:hover .remove-attachment-btn {
  opacity: 1;
  color: var(--color-accent-danger);
}

/* Type-specific tints */
.attachment-card[data-type="github"] .attachment-info {
  background: rgba(110, 64, 201, 0.1);
}

/* Editing-message indicator, shown above the composer while an edit is in progress */
.message-edit-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 6px;
  padding: 4px 8px 4px 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  color: var(--color-text-primary);
  font-size: 12px;
}

.message-edit-indicator i.fa-pen {
  font-size: 11px;
  color: var(--color-text-secondary);
}

.message-edit-indicator .cancel-edit-btn {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 2px 4px;
  font-size: 11px;
  line-height: 1;
  transition: color 0.15s ease;
}

.message-edit-indicator .cancel-edit-btn:hover {
  color: var(--color-accent-danger);
}

.attachment-card[data-type="github"] .attachment-icon {
  color: #a78be8;
}

.attachment-card[data-type="file"] .attachment-info {
  background: rgba(0, 141, 163, 0.06);
}

.attachment-card[data-type="file"] .attachment-icon {
  color: var(--color-accent-primary);
}

.attachment-card[data-type="folder"] .attachment-info {
  background: rgba(255, 193, 7, 0.08);
}

.attachment-card[data-type="folder"] .attachment-icon {
  color: #ffc107;
}


/* === THINKING BUTTON & POPOVER (DROPDOWN) === */

.thinking-menu-container {
  position: relative;
  display: inline-block;
}

.thinking-btn {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--color-text-secondary);
  border-radius: 99px;
  height: 32px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.thinking-btn:hover {
  border-color: var(--glass-border-active);
  background-color: rgba(255, 255, 255, 0.02);
  color: var(--color-text-primary);
}

.light-theme .thinking-btn:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

.thinking-btn.active {
  border-color: var(--color-accent-primary);
  color: var(--color-accent-primary);
}

.thinking-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.thinking-btn i.fa-brain {
  font-size: 14px;
}

.thinking-btn .thinking-chevron {
  font-size: 10px;
  opacity: 0.7;
  transition: transform 0.2s ease;
}

.thinking-btn.active .thinking-chevron {
  transform: rotate(180deg);
}

/* Popover styling */
.thinking-dropdown {
  display: none;
  position: absolute;
  bottom: 44px;
  left: 0;
  width: 600px;
  max-width: calc(100vw - 32px);
  background-color: var(--color-surface);
  border: 1px solid var(--glass-border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.04);
  border-radius: 16px;
  z-index: 10000;
  padding: 20px 24px;
  backdrop-filter: blur(16px);
  box-sizing: border-box;
}

.thinking-dropdown.show {
  display: block;
  animation: fadeInMenu 0.2s ease;
}

.thinking-dropdown-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 20px;
}

.thinking-dropdown-content {
  display: flex;
  gap: 24px;
  margin-bottom: 20px;
}

.thinking-column {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.thinking-column-divider {
  width: 1px;
  background-color: var(--glass-border);
  align-self: stretch;
}

.thinking-column-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 4px;
}

.thinking-column-header i {
  font-size: 12px;
  color: var(--color-text-muted);
  cursor: pointer;
}

.thinking-column-desc {
  font-size: 11.5px;
  color: var(--color-text-muted);
  margin-bottom: 16px;
  line-height: 1.4;
}

/* Coluna 1 - Modo de Raciocínio */
.thinking-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.thinking-radio-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  position: relative;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.thinking-radio-option:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

.light-theme .thinking-radio-option:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

.thinking-radio-option input[type="radio"] {
  display: none;
}

.radio-custom {
  width: 16px;
  height: 16px;
  border: 2px solid var(--color-text-muted);
  border-radius: 50%;
  display: inline-block;
  position: relative;
  flex-shrink: 0;
  margin-top: 2px;
  box-sizing: border-box;
}

.thinking-radio-option input[type="radio"]:checked+.radio-custom {
  border-color: var(--color-accent-primary);
}

.thinking-radio-option input[type="radio"]:checked+.radio-custom::after {
  content: "";
  width: 8px;
  height: 8px;
  background-color: var(--color-accent-primary);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.radio-label-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.option-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.option-desc {
  font-size: 11.5px;
  color: var(--color-text-muted);
  line-height: 1.35;
}

/* Coluna 2 - Esforço de Raciocínio (Slider) */
.thinking-slider-container {
  display: flex;
  flex-direction: column;
  margin-top: 10px;
}

.thinking-slider-labels {
  position: relative;
  margin-bottom: 8px;
  height: 20px;
  width: 100%;
}

.thinking-slider-limits {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  width: 100%;
}

.slider-label-side {
  font-size: 12px;
  color: var(--color-text-secondary);
  user-select: none;
}

.thinking-slider-value {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  color: var(--color-accent-primary);
  font-weight: 600;
  font-size: 13.5px;
}

.thinking-slider-wrapper {
  position: relative;
  width: 100%;
  height: 20px;
  display: flex;
  align-items: center;
}

.thinking-range-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  margin: 0;
  z-index: 2;
  position: relative;
}

.light-theme .thinking-range-slider {
  background: rgba(0, 0, 0, 0.1);
}

.thinking-slider-track-fill {
  position: absolute;
  left: 0;
  height: 6px;
  background: var(--color-accent-primary);
  border-radius: 3px 0 0 3px;
  z-index: 1;
  pointer-events: none;
}

.thinking-range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-accent-primary);
  cursor: pointer;
  transition: transform 0.1s ease;
  border: none;
}

.thinking-range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.thinking-range-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-accent-primary);
  cursor: pointer;
  transition: transform 0.1s ease;
  border: none;
}

.thinking-range-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
}

.thinking-slider-subtext {
  font-size: 11.5px;
  color: var(--color-text-muted);
  margin-top: 12px;
  line-height: 1.35;
}

/* Rodapé do Popover */
.thinking-dropdown-footer {
  border-top: 1px solid var(--glass-border);
  padding-top: 16px;
  margin-top: 16px;
}

.tip-box {
  display: flex;
  gap: 8px;
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--color-text-secondary);
}

.light-theme .tip-box {
  background-color: rgba(0, 0, 0, 0.01);
}

.tip-icon {
  font-size: 14px;
}

/* Responsividade do Popover */
@media (max-width: 768px) {
  .thinking-dropdown {
    position: fixed;
    bottom: 80px;
    left: 16px;
    right: 16px;
    width: auto;
    max-width: none;
    transform: none;
    padding: 16px 20px;
  }

  .thinking-dropdown-content {
    flex-direction: column;
    gap: 16px;
  }

  .thinking-column-divider {
    height: 1px;
    width: 100%;
    align-self: auto;
  }
}