.input-area-wrapper {
  display: flex;
  justify-content: center;
  width: 100%;
}

.input-area {
  border-top: none !important;
  border: none !important;
  padding: 0 !important;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(135, 206, 235, 0.05), rgba(173, 216, 230, 0.05)) !important;
  /* Elimina cualquier diferencia visual con el textarea */
  backdrop-filter: blur(20px);
  display: flex;
  justify-content: center;
  min-height: 88px;
  transition: none;
  max-width: 768px;
  width: 100%;
  margin: 0 auto;
  margin-bottom: -2px;
  position: relative;
  top: -15px;
  /* Eleva el input-area 10px */
}

.tokens-counter {
  display: block;
  font-style: italic;
  background: none;
  border: none;
  padding: 0;
  text-align: center;
  width: 100%;
  font-size: 0.85em;
  margin-bottom: 4px;
  color: #87CEEB;
  opacity: 0.8;
}

.input-container {
  margin-bottom: 6px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.input-side-buttons {
  display: flex;
  flex-direction: row;
  gap: 8px;
  margin-right: 0.7rem;
  align-items: center;
  justify-content: flex-end;
  background: transparent;
  border-radius: 8px;
  box-shadow: none;
  padding: 2px 0 2px 0;
  flex-wrap: nowrap;
  min-width: fit-content;
  flex-shrink: 0;
}

.input-side-buttons > * {
  height: 40px;
}

.input-icon-button {
  background: transparent;
  border: none;
  padding: 4px 7px;
  border-radius: 7px;
  color: #87CEEB;
  font-size: 0.95rem;
  box-shadow: none;
  transition: color 0.18s, text-shadow 0.18s;
  cursor: pointer;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 27px;
  height: 27px;
  flex-shrink: 0;
  position: static !important;
}

.input-icon-button.active {
  color: #b983ff;
  background: transparent;
  box-shadow: none;
  text-shadow: 0 0 16px #b983ff, 0 0 32px rgba(185, 131, 255, 0.8), 0 0 48px rgba(255, 255, 255, 0.1);
}

.input-icon-button:hover {
  color: #87CEEB;
  background: transparent;
  box-shadow: none;
  text-shadow: 0 0 8px rgba(135, 206, 235, 0.3);
}

.input-icon-button.active:hover {
  color: #b983ff;
  background: transparent;
  box-shadow: none;
  text-shadow: 0 0 16px #b983ff, 0 0 32px rgba(185, 131, 255, 0.8), 0 0 48px rgba(255, 255, 255, 0.1);
}

.input-icon-button:focus {
  outline: none;
}

.message-textarea {
  border: none !important;
  background: linear-gradient(135deg, rgba(135, 206, 235, 0.05), rgba(173, 216, 230, 0.05)) !important;
  box-shadow: none !important;
  flex: 1;
  /* Dimensiones fijas iniciales para evitar parpadeo */
  min-height: 96px;
  max-height: 160px; /* Permite crecer hasta 5 filas antes de scroll */
  padding: 0.75rem 40px 0.75rem 16px; /* Padding fijo inicial */
  font-size: 0.9rem;
  border-radius: var(--radius-lg);
  resize: none;
  color: var(--text-primary);
  position: relative;
  width: 100%;
  /* Ocultar barra de scroll */
  scrollbar-width: none;
  -ms-overflow-style: none;
  /* Prevenir cambios de layout durante la carga */
  box-sizing: border-box;
}

/* Clase para cuando el modelo tiene visión - se aplica después de cargar */
.message-textarea.has-vision {
  padding-bottom: 40px; /* Solo aplicar cuando sabemos que tiene visión */
}

.message-textarea:focus {
  border-color: #b983ff;
  background: linear-gradient(135deg, rgba(185, 131, 255, 0.1), rgba(135, 206, 235, 0.1));
  box-shadow: 0 0 20px rgba(185, 131, 255, 0.2), 0 4px 12px rgba(135, 206, 235, 0.15);
}

.message-textarea::-webkit-scrollbar {
  display: none;
}

.send-button {
  position: relative !important;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  right: 0;
  bottom: 0;
  margin-left: 0.3rem;
  margin-right: 0;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #87CEEB, #b983ff);
  color: #fff;
  border: none;
  font-size: 1rem;
  box-shadow: 0 4px 12px rgba(135, 206, 235, 0.3);
  transition: all 0.3s ease;
  z-index: 2;
  padding: 0;
}

.send-button:hover {
  background: linear-gradient(135deg, #b983ff, #87CEEB);
  box-shadow: 0 6px 16px rgba(185, 131, 255, 0.4);
  transform: translateY(-1px);
}

.send-button:disabled {
  background: var(--surface-variant);
  color: var(--text-secondary);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.new-chat-button {
  position: static;
  margin-right: 0.7rem;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: rgba(135, 206, 235, 0.1);
  color: #87CEEB;
  border: 2px solid #87CEEB;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  box-shadow: 0 2px 8px rgba(135, 206, 235, 0.2);
  transition: all 0.3s ease;
  z-index: 2;
  padding: 0;
  cursor: pointer;
}

.new-chat-button:hover {
  background: #87CEEB;
  color: #fff;
  border-color: #87CEEB;
  box-shadow: 0 4px 12px rgba(135, 206, 235, 0.4);
  transform: translateY(-1px);
}

.input-container .agent-selector {
  margin: 0;
  flex-shrink: 0;
}

.input-container .agent-selector-toggle {
  height: 32px;
  width: auto;
  min-width: 80px;
  max-width: 140px;
  border-radius: 8px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.input-container .agent-selector-toggle:hover {
  border-radius: 8px;
}

.input-container .agent-selector-toggle .agent-text {
  display: block !important;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.input-container .agent-selector-toggle .agent-name {
  font-size: 9px;
  font-weight: 400;
}

.input-container .agent-selector-toggle .agent-type {
  display: none;
}

.input-container .agent-selector .agent-selector-popup {
  position: fixed !important;
  z-index: 10000 !important;
  width: 320px;
  max-height: 400px;
  transform: none !important;
}

.input-container .agent-selector .agent-selector-popup::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 15px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid var(--popup-bg, #1e1e1e);
  z-index: 10001;
}

.input-area {
  position: relative;
  z-index: 1;
}

body .agent-selector-popup {
  position: fixed !important;
  z-index: 10000 !important;
}

.input-side-buttons .agent-selector-popup {
  bottom: 45px;
}

.image-inside-textarea {
  background: none;
  border: none;
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: #87CEEB;
  opacity: 0.85;
  transition: opacity 0.2s;
  width: 27px;
  height: 27px;
}

.image-inside-textarea:hover {
  opacity: 1;
}

.clip-inside-textarea {
  background: none;
  border: none;
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: #87CEEB;
  opacity: 0.85;
  transition: opacity 0.2s;
}

.clip-inside-textarea:hover {
  opacity: 1;
}

.textarea-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  /* Altura mínima fija para evitar saltos */
  min-height: 56px;
  /* Eliminar padding */
  padding: 0 !important;
  background: transparent !important;
}

.floating-language-selector {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 2000;
  background: rgba(30, 30, 40, 0.95);
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
  padding: 6px 12px;
  display: flex;
  align-items: center;
}

.floating-language-selector select {
  background: transparent;
  color: #fff;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  outline: none;
  padding: 2px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.floating-language-selector select:focus {
  background: #222;
}

.floating-language-selector.compact select {
  position: relative;
  z-index: 10;
}

.floating-language-selector.compact select option {
  background: #23232b;
  color: #fff;
  font-size: 13px;
  border: none;
  padding: 6px 12px;
}

.floating-language-selector.compact select:focus {
  position: relative;
  z-index: 9999;
}

.floating-language-selector.compact select:focus {
  box-shadow: 0 0 0 2px #87ceeb44;
}

.floating-language-selector.compact {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 2000;
  background: rgba(30, 30, 40, 0.92);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.13);
  padding: 2px 6px 2px 4px;
  display: flex;
  align-items: center;
  font-size: 13px;
  min-height: 28px;
  min-width: 0;
}

.floating-language-selector.compact select {
  background: transparent;
  color: #fff;
  border: none;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  padding: 0 4px;
  border-radius: 4px;
  cursor: pointer;
  min-width: 36px;
  height: 22px;
}

.floating-language-selector.compact select:focus {
  background: #222;
}

.floating-language-selector.compact svg {
  vertical-align: middle;
  color: #b3b3b3;
}

.custom-lang-dropdown {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.lang-dropdown-btn {
  display: flex;
  align-items: center;
  background: transparent;
  color: #fff;
  border: none;
  font-size: 14px;
  font-weight: 600;
  outline: none;
  padding: 3px 10px 3px 7px;
  border-radius: 4px;
  cursor: pointer;
  min-width: 36px;
  min-height: 26px;
  transition: background 0.15s;
  gap: 8px;
}

.lang-dropdown-btn:focus,
.lang-dropdown-btn:hover {
  background: #23232b;
}

.lang-dropdown-btn svg {
  font-size: 16px;
}

.lang-dropdown-btn > span {
  font-size: 14px;
  margin: 0 2px;
}

.lang-dropdown-btn .chevron {
  margin-left: 8px;
  font-size: 14px;
}

.lang-dropdown-list {
  position: absolute;
  left: 0;
  bottom: 110%;
  background: #23232b;
  color: #fff;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  min-width: 48px;
  padding: 2px 0;
  margin: 0;
  z-index: 9999;
  list-style: none;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid #23232b;
  animation: fadeInUp 0.18s cubic-bezier(0.4,0,0.2,1);
}

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

.lang-dropdown-item {
  padding: 6px 16px 6px 12px;
  cursor: pointer;
  border: none;
  background: none;
  color: #fff;
  transition: background 0.15s, color 0.15s;
}

.lang-dropdown-item.selected,
.lang-dropdown-item:hover {
  background: #2e2e3a;
  color: #87ceeb;
}

.lang-dropdown-item span {
  font-size: 18px;
  line-height: 1.2;
}

.input-bottom-buttons {
  margin-top: 4px;
  background: none !important;
  border: none !important;
  border-radius: 8px;
}

.input-bottom-buttons-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  /* Altura mínima fija para evitar saltos */
  min-height: 44px;
  background: transparent !important;
}

.input-bottom-buttons-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
  position: relative;
}

.input-bottom-buttons-right {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  position: relative;
  margin-right: 12px;
}

.image-float-button {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 10;
  background: rgba(135, 206, 235, 0.1);
  border: 1px solid #87CEEB;
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  color: #87CEEB;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 27px;
  height: 27px;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(135, 206, 235, 0.2);
  /* Inicialmente oculto para evitar parpadeo */
  opacity: 0;
  visibility: hidden;
}

/* Clase para mostrar el botón cuando el modelo tiene visión */
.image-float-button.show {
  opacity: 1;
  visibility: visible;
}

.image-float-button:hover {
  background: rgba(135, 206, 235, 0.2);
  border-color: #b983ff;
  color: #b983ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(135, 206, 235, 0.3);
}

.image-float-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(135, 206, 235, 0.2);
}

/* Estilos para los botones de agentes y tool selector para evitar parpadeo y mantener padding/espaciado fijo */
.input-bottom-buttons-left > button,
.input-bottom-buttons-left > .tools-selector {
  min-width: 27px;
  height: 27px;
  box-sizing: border-box;
  margin-right: 0px;
  margin-left: 0px;
  padding: 0 !important;
  /* Elimina cualquier cambio de padding/margin durante el render */
  transition: none !important;
}

.input-bottom-buttons-left > .tools-selector {
  min-width: 27px;
  height: 27px;
  padding: 0 !important;
}

.tools-button {
  min-width: 27px;
  height: 27px;
  padding: 0 !important;
}