* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  height: 100vh;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem; /* Add padding for small screens */
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  max-width: 1200px;
  background: white;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.05);
  border-radius: 10px; /* Slight rounding for desktop */
}

.chat-header {
  display: flex;
  align-items: center;
  padding: 1rem;
  background: #ffffff;
  border-bottom: 1px solid #eee;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.chatbot-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 1rem;
  border: 2px solid #6c5ce7;
  object-fit: cover;
}

.chat-header h3 {
  font-size: 1.2rem;
  color: #2d3436;
  font-weight: 600;
}

.chat-box {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: #fafafa;
}

.message {
  max-width: 70%;
  padding: 0.75rem 1rem;
  border-radius: 1.25rem;
  animation: slideIn 0.3s ease;
  position: relative;
}

.bot-message {
  background: white;
  border: 1px solid #eee;
  align-self: flex-start;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.user-message {
  background: #6c5ce7;
  color: white;
  align-self: flex-end;
}

.message-timestamp {
  font-size: 0.7rem;
  color: #666;
  margin-bottom: 0.5rem;
  opacity: 0.8;
}

.input-container {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  background: white;
  border-top: 1px solid #eee;
  flex-wrap: wrap; /* Allow wrapping on very small screens */
}

input[type="text"] {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid #eee;
  border-radius: 2rem;
  font-size: 1rem;
  transition: all 0.3s ease;
  min-width: 0; /* Ensure it shrinks properly */
}

input[type="text"]:focus {
  border-color: #6c5ce7;
  outline: none;
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

button {
  padding: 0.75rem;
  border: none;
  border-radius: 50%; /* Circular buttons for consistency */
  background: #6c5ce7;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 40px; /* Fixed size for uniformity */
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

button:hover {
  background: #5b4bc4;
  transform: translateY(-1px);
}

.typing-indicator {
  display: none;
  padding: 0.75rem 1rem;
  background: white;
  border-radius: 1.25rem;
  width: fit-content;
  margin: 0 1rem 1rem;
  border: 1px solid #eee;
}

.typing-indicator .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #6c5ce7;
  margin: 0 2px;
  animation: bounce 1.4s infinite ease-in-out;
}

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

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

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-4px);
  }
}

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

/* Custom Scrollbar */
.chat-box::-webkit-scrollbar {
  width: 6px;
}

.chat-box::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
}

.chat-box::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}

/* Voice Control Styling */
.voice-control {
  background: #e0e0e0;
  color: #666;
}

.voice-control:hover {
  background: #d0d0d0;
}

.voice-control.active {
  background: #6c5ce7;
  color: white;
}

#mic-button.recording {
  background: #ff4444;
  color: white;
  animation: pulse 1.5s infinite;
}

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

/* Link Styling */
.message-content a {
  color: #6c5ce7;
  text-decoration: none;
  word-break: break-all;
}

.message-content a:hover {
  text-decoration: underline;
}

.bot-message .message-content a {
  color: #6c5ce7;
}

.user-message .message-content a {
  color: #ffffff;
  opacity: 0.9;
}

/* Responsive Design */
@media (max-width: 768px) {
  body {
    padding: 0.5rem;
  }

  .chat-container {
    border-radius: 0;
    height: 100vh;
  }

  .chat-header {
    padding: 0.75rem;
  }

  .chatbot-avatar {
    width: 35px;
    height: 35px;
  }

  .chat-header h3 {
    font-size: 1rem;
  }

  .chat-box {
    padding: 0.75rem;
  }

  .message {
    max-width: 85%;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
  }

  .message-timestamp {
    font-size: 0.65rem;
  }

  .input-container {
    padding: 0.75rem;
    gap: 0.25rem;
  }

  input[type="text"] {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }

  button {
    width: 35px;
    height: 35px;
    padding: 0;
  }

  button svg {
    width: 18px;
    height: 18px;
  }
}

@media (max-width: 480px) {
  .input-container {
    flex-direction: row;
    align-items: stretch;
  }

  input[type="text"] {
    width: 100%;
    margin-bottom: 0.5rem;
  }

  button {
    width: 40px;
    height: 40px;
    margin: 0 auto;
  }

  .voice-control {
    width: 40px;
    height: 40px;
  }
}
