* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: #000;
  color: #fff;
  overflow: hidden;
}

#root {
  width: 100vw;
  height: 100vh;
}

.app {
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
  position: relative;
  overflow: hidden;
  padding:0 10px;
}

.app::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 50%, rgba(139, 0, 0, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 50%, rgba(139, 0, 0, 0.1) 0%, transparent 50%);
  pointer-events: none;
}

.chat-container {
  width: 100%;
  max-width: 800px;
  height: 80vh;
  display: flex;
  flex-direction: column;
  background: rgba(10, 10, 10, 0.95);
  border-left: 2px solid rgba(139, 0, 0, 0.3);
  border-right: 2px solid rgba(139, 0, 0, 0.3);
  box-shadow: 0 0 50px rgba(139, 0, 0, 0.2);
  position: relative;
}

.chat-header {
  padding: 20px 30px;
  border-bottom: 2px solid rgba(139, 0, 0, 0.3);
  border-top: 2px solid rgba(139, 0, 0, 0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

.chat-header h1 {
  font-size: 28px;
  font-weight: bold;
  color: #8b0000;
  text-shadow: 0 0 10px rgba(139, 0, 0, 0.5);
  letter-spacing: 2px;
  font-family: 'Arial Black', sans-serif;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #666;
  font-size: 14px;
}


.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8b0000;
  box-shadow: 0 0 8px rgba(139, 0, 0, 0.8);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 30px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 0; /* Important for flex scrolling */
}

.messages-container::-webkit-scrollbar {
  width: 8px;
}

.messages-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

.messages-container::-webkit-scrollbar-thumb {
  background: rgba(139, 0, 0, 0.5);
  border-radius: 4px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 0, 0, 0.7);
}

.message {
  display: flex;
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.user {
  justify-content: flex-end;
}

.message.assistant {
  justify-content: flex-start;
}

.message-content {
  max-width: 70%;
  padding: 12px 18px;
  border-radius: 12px;
  word-wrap: break-word;
  line-height: 1.5;
}

.message.user .message-content {
  background: rgba(139, 0, 0, 0.3);
  border: 1px solid rgba(139, 0, 0, 0.5);
  color: #fff;
}

.message.assistant .message-content {
  background: rgba(30, 30, 30, 0.8);
  border: 1px solid rgba(139, 0, 0, 0.3);
  color: #e0e0e0;
  font-style: italic;
}

/* Markdown styling for assistant messages */
.message.assistant .message-content p {
  margin: 0.5em 0;
}

.message.assistant .message-content p:first-child {
  margin-top: 0;
}

.message.assistant .message-content p:last-child {
  margin-bottom: 0;
}

.message.assistant .message-content strong {
  color: #fff;
  font-weight: bold;
}

.message.assistant .message-content em {
  font-style: italic;
}

.message.assistant .message-content code {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  color: #8b0000;
}

.message.assistant .message-content pre {
  background: rgba(0, 0, 0, 0.5);
  padding: 10px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 0.5em 0;
}

.message.assistant .message-content pre code {
  background: transparent;
  padding: 0;
  color: #e0e0e0;
}

.message.assistant .message-content ul,
.message.assistant .message-content ol {
  margin: 0.5em 0;
  padding-left: 1.5em;
}

.message.assistant .message-content li {
  margin: 0.25em 0;
}

.message.assistant .message-content blockquote {
  border-left: 3px solid rgba(139, 0, 0, 0.5);
  padding-left: 1em;
  margin: 0.5em 0;
  color: #ccc;
}

.message.assistant .message-content a {
  color: #8b0000;
  text-decoration: underline;
}

.message.assistant .message-content a:hover {
  color: #ff0000;
}

.typing-indicator {
  display: inline-block;
  animation: typing 1.5s infinite;
}

@keyframes typing {
  0%, 60%, 100% {
    opacity: 0.3;
  }
  30% {
    opacity: 1;
  }
}

.input-container {
  padding: 20px 30px;
  border-top: 2px solid rgba(139, 0, 0, 0.3);
  border-bottom: 2px solid rgba(139, 0, 0, 0.3);
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.input-container .input-wrapper {
  width: 100%;
}

.input-wrapper {
  flex: 1;
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0; /* Allow flex items to shrink below content size */
}

.chat-input {
  flex: 1;
  padding: 12px 18px;
  background: rgba(20, 20, 20, 0.8);
  border: 1px solid rgba(139, 0, 0, 0.3);
  border-radius: 8px;
  color: #fff;
  font-size: 16px;
  outline: none;
  transition: all 0.3s ease;
  min-width: 0; /* Allow input to shrink */
}

.chat-input:focus {
  border-color: rgba(139, 0, 0, 0.6);
  box-shadow: 0 0 10px rgba(139, 0, 0, 0.2);
}

.chat-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-input::placeholder {
  color: #666;
}

.voice-button {
  padding: 12px 16px;
  background: rgba(139, 0, 0, 0.3);
  border: 1px solid rgba(139, 0, 0, 0.5);
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-size: 20px;
  transition: all 0.3s ease;
  min-width: 50px;
  flex-shrink: 0; /* Prevent voice button from shrinking */
  order: 3; /* Place voice button last */
}

.voice-button:hover:not(:disabled) {
  background: rgba(139, 0, 0, 0.5);
  box-shadow: 0 0 15px rgba(139, 0, 0, 0.4);
}

.voice-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.voice-button.listening {
  background: rgba(139, 0, 0, 0.7);
  animation: pulse-button 1.5s infinite;
}

@keyframes pulse-button {
  0%, 100% {
    box-shadow: 0 0 10px rgba(139, 0, 0, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(139, 0, 0, 0.8);
  }
}

.submit-button {
  padding: 12px 24px;
  background: rgba(139, 0, 0, 0.6);
  border: 1px solid rgba(139, 0, 0, 0.8);
  border-radius: 8px;
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  flex-shrink: 0; /* Prevent submit button from shrinking */
}

.submit-button:hover:not(:disabled) {
  background: rgba(139, 0, 0, 0.8);
  box-shadow: 0 0 15px rgba(139, 0, 0, 0.5);
  transform: translateY(-1px);
}

.submit-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .chat-container {
    max-width: 100%;
  }

  .chat-header h1 {
    font-size: 22px;
  }

  .message-content {
    max-width: 85%;
  }

  .input-container {
    padding: 15px 10px;
    gap: 6px;
    flex-wrap: nowrap; /* Prevent wrapping */
  }

  .input-wrapper {
    gap: 6px;
    flex: 1;
    min-width: 0; /* Allow wrapper to shrink */
  }

  .chat-input {
    font-size: 14px;
    padding: 10px 12px;
    min-width: 0; /* Allow input to shrink on mobile */
  }

  .voice-button {
    padding: 10px 12px;
    font-size: 18px;
    min-width: 44px;
    flex-shrink: 0;
  }

  .submit-button {
    padding: 10px 14px;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.5px;
  }
}