/**
 * UI Fixes for Vigthoria LLM Chat
 * Addresses issues with thinking animation, send button, and connection status indicators
 * Version: 1.0 (May 2025)
 */

/* Connection status indicators */
.ollama-status-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  margin-right: 8px;
  position: relative;
  overflow: visible;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.ollama-status-indicator::before {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  transition: all 0.3s ease;
  z-index: 1;
}

.ollama-status-indicator.connected::before {
  background-color: #00FF9C;
  box-shadow: 0 0 8px #00FF9C, 0 0 12px #00FF9C;
  animation: pulse-green 2s infinite;
}

/* For the Neural Connection label in header */
.neural-connection .ollama-status-indicator.connected::before {
  background-color: #00FF9C;
  box-shadow: 0 0 8px #00FF9C, 0 0 12px #00FF9C;
  animation: pulse-green 2s infinite;
}

.ollama-status-indicator.connecting::before,
.ollama-status-indicator.initializing::before {
  background-color: #FFD700;
  box-shadow: 0 0 8px #FFD700, 0 0 12px #FFD700;
  animation: pulse-yellow 2s infinite;
}

/* For the Neural Connection label in header */
.neural-connection .ollama-status-indicator.connecting::before,
.neural-connection .ollama-status-indicator.initializing::before {
  background-color: #FFD700;
  box-shadow: 0 0 8px #FFD700, 0 0 12px #FFD700;
  animation: pulse-yellow 2s infinite;
}

.ollama-status-indicator.disconnected::before {
  background-color: #FF3860;
  box-shadow: 0 0 8px #FF3860, 0 0 12px #FF3860;
  animation: pulse-red 1.5s infinite;
}

/* For the Neural Connection label in header */
.neural-connection .ollama-status-indicator.disconnected::before {
  background-color: #FF3860;
  box-shadow: 0 0 8px #FF3860, 0 0 12px #FF3860;
  animation: pulse-red 1.5s infinite;
}

@keyframes pulse-green {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes pulse-yellow {
  0% { opacity: 1; transform: scale(1); }
  25% { opacity: 0.7; transform: scale(1.1); }
  50% { opacity: 0.9; transform: scale(1); }
  75% { opacity: 0.7; transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes pulse-red {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.2); }
  100% { opacity: 1; transform: scale(1); }
}

/* Thinking animation dots - HORIZONTAL layout */
.thinking-dots {
  display: inline-flex;
  position: relative;
  height: 20px;
  margin-left: 10px;
  align-items: center;
}

.thinking-dots span {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #00FFEE;
  margin: 0 3px;
  opacity: 0.3;
}

.thinking-dots span:nth-child(1) {
  animation: thinking-dot 1.4s infinite ease-in-out both;
  animation-delay: -0.32s;
}

.thinking-dots span:nth-child(2) {
  animation: thinking-dot 1.4s infinite ease-in-out both;
  animation-delay: -0.16s;
}

.thinking-dots span:nth-child(3) {
  animation: thinking-dot 1.4s infinite ease-in-out both;
}

@keyframes thinking-dot {
  0%, 80%, 100% { 
    transform: scale(0.5);
    opacity: 0.3;
  }
  40% { 
    transform: scale(1.0);
    opacity: 1.0;
  }
}

.system.thinking {
  display: flex;
  align-items: center;
  font-style: italic;
  color: #00FFEE;
  opacity: 0.8;
  padding: 10px 15px;
  background: rgba(0, 255, 238, 0.05);
  border-radius: 8px;
  margin: 10px 0;
  animation: thinking-fade 1s infinite alternate;
}

@keyframes thinking-fade {
  0% { opacity: 0.6; }
  100% { opacity: 0.9; }
}

/* Send button fix */
.send-button {
  position: absolute;
  right: 15px;
  bottom: 15px;
  background: linear-gradient(135deg, #00FFEE, #0088FF);
  border: none;
  border-radius: 50%;
  width: 40px;
}

/* Send button hover state */
.send-button:hover,
#send-button:hover,
button[type="submit"]:hover,
.chat-input-actions button[type="submit"]:hover {
    background-color: var(--accent-hover, #0051a8) !important;
    box-shadow: 0 0 5px rgba(0, 112, 243, 0.5) !important;
}

/* Active send button state */
.send-button:active,
#send-button:active,
button[type="submit"]:active {
    transform: scale(0.98) !important;
}

.send-button i {
  color: #000;
  font-size: 18px;
}

/* Ensure chat input is properly positioned relative to send button */
.chat-input-container {
  position: relative;
  width: 100%;
}

#chat-input {
  width: calc(100% - 60px);
  padding-right: 50px;
}

/* Fix for message display */
.chat-message {
  margin: 10px 0;
  padding: 12px;
  border-radius: 8px;
  position: relative;
  animation: message-appear 0.3s ease-out;
}

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

.chat-message.system {
  background-color: rgba(0, 136, 255, 0.1);
  border: 1px solid rgba(0, 136, 255, 0.3);
  color: rgba(255, 255, 255, 0.8);
}

.chat-message.user {
  background-color: rgba(0, 255, 238, 0.1);
  border: 1px solid rgba(0, 255, 238, 0.3);
  margin-left: 40px;
}

.chat-message.assistant {
  background-color: rgba(255, 0, 160, 0.1);
  border: 1px solid rgba(255, 0, 160, 0.3);
  margin-right: 40px;
}

/* Make sure the chat controls are visible */
.chat-controls {
  display: flex;
  align-items: center;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  margin-bottom: 10px;
}
