body {
  font-family: Arial, sans-serif;
  background: #f4f4f9;
  color: #333;
  margin: 0;
  padding: 0;
}

.container {
  max-width: 700px;
  margin: 3rem auto;
  padding: 2rem;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
}

.toggle-header {
  cursor: pointer;
  text-align: center;
  padding: 0.5rem;
  font-weight: bold;
  background-color: #3498db;
  color: white;
  border-radius: 6px;
  max-width: 700px;
  margin: 1rem auto;
}

.hidden-upload {
  display: none;
}

h1, h2 {
  text-align: center;
  color: #2c3e50;
}

form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

input[type="file"] {
  padding: 0.5rem;
}

button {
  background-color: #3498db;
  color: white;
  padding: 0.7rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

button:hover {
  background-color: #2980b9;
}

.success {
  color: green;
  text-align: center;
}

.error {
  color: red;
  text-align: center;
}

.chat-container {
  width: 100%;
  max-width: 100%;
  margin: 2rem auto;
  padding: 1rem 2rem;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-sizing: border-box;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #ccc;
  padding-bottom: 0.5rem;
}

.chat-header img.logo {
  height: 32px;
}

.chat-box {
  max-height: 400px;
  overflow-y: auto;
  background: #f9f9fb;
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 0.95rem;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.chat-msg {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  max-width: 90%;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.chat-msg.user {
  background: #d2ecff;
  align-self: flex-end;
  text-align: right;
}

.chat-msg.ai {
  background: #edf3e7;
  align-self: flex-start;
  text-align: left;
}

.chat-input-container {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.chat-input-container input[type="text"] {
  flex: 1;
  padding: 0.7rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  min-width: 0;
}

.chat-input-container button {
  padding: 0.7rem 1rem;
  background: #3498db;
  border: none;
  border-radius: 6px;
  color: white;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s ease;
}

.chat-input-container button:hover {
  background: #2980b9;
}

#upload-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 1.2rem;
  color: #444;
  z-index: 1000;
}

#upload-overlay.hidden {
  display: none;
}

.spinner {
  border: 5px solid #f3f3f3;
  border-top: 5px solid #3498db;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

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

@media (max-width: 768px) {
  .container, .chat-container {
    margin: 0.5rem;
    padding: 1rem;
    border-radius: 8px;
  }

  .chat-box {
    font-size: 0.9rem;
    padding: 0.75rem;
  }

  .chat-input-container {
    flex-direction: column;
  }

  .chat-input-container input[type="text"],
  .chat-input-container button {
    width: 100%;
  }
}

.toggle-header {
  cursor: pointer;
  text-align: center;
  padding: 0.5rem;
  font-weight: bold;
  background-color: #3498db;
  color: white;
  border-radius: 6px;
  max-width: 700px;
  margin: 1rem auto;
  transition: background 0.3s ease;
}
.toggle-header:hover {
  background-color: #2980b9;
}

@media (min-width: 1440px) {
  .chat-container {
    max-width: 85%;
    padding: 2rem 4rem;
  }
}
