/* style.css */

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  color: #333;
  line-height: 1.6;
  padding: 20px;
  min-height: 100vh;
}

.chat-container {
  max-width: 800px;
  margin: 0 auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 90vh;
}

/* Header Styles */
header {
  background: #4a6fa5;
  color: white;
  padding: 20px;
  text-align: center;
}

header h1 {
  font-size: 1.8rem;
  margin-bottom: 8px;
}

header p {
  font-size: 1rem;
  opacity: 0.9;
}

/* Chat History Styles */
.chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f9f9f9;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.chat-message {
  padding: 12px 16px;
  border-radius: 18px;
  max-width: 80%;
  word-wrap: break-word;
  animation: fadeIn 0.3s ease-in-out;
}

.chat-message.user {
  background: #e3f2fd;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-message.assistant {
  background: #f5f5f5;
  border: 1px solid #ddd;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-message.system {
  background: #fff8e1;
  align-self: center;
  font-size: 0.9rem;
  text-align: center;
  max-width: 90%;
  border-radius: 8px;
}

.chat-message.error {
  background: #ffebee;
  align-self: center;
  color: #c62828;
  font-size: 0.9rem;
  text-align: center;
  max-width: 90%;
  border-radius: 8px;
}

/* Input Area Styles */
.input-area {
  display: flex;
  padding: 20px;
  background: white;
  border-top: 1px solid #eee;
  gap: 10px;
}

#user-input {
  flex: 1;
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 24px;
  resize: none;
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s;
}

#user-input:focus {
  border-color: #4a6fa5;
}

#send-button {
  padding: 12px 25px;
  background: #4a6fa5;
  color: white;
  border: none;
  border-radius: 24px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: background 0.3s;
  align-self: flex-end;
}

#send-button:hover {
  background: #3a5a80;
}

#send-button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* Loader Animation */
.loader {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 3px solid rgba(74, 111, 165, 0.2);
  border-top: 3px solid #4a6fa5;
  border-radius: 50%;
  margin-right: 10px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

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

/* Responsive Styles */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }
  
  .chat-container {
    height: 95vh;
  }
  
  header h1 {
    font-size: 1.5rem;
  }
  
  .chat-history {
    padding: 15px;
  }
  
  .chat-message {
    max-width: 90%;
  }
  
  .input-area {
    padding: 15px;
  }
  
  #send-button {
    padding: 10px 20px;
  }
}

@media (max-width: 480px) {
  header {
    padding: 15px;
  }
  
  header h1 {
    font-size: 1.3rem;
  }
  
  .chat-message {
    max-width: 95%;
  }
  
  .input-area {
    flex-direction: column;
  }
  
  #send-button {
    align-self: stretch;
  }
}