:root {
  --primary-color: #1e90ff;
  --secondary-color: #f0f0f0;
  --text-color: #333;
  --system-color: #666;
  --success-color: #28a745;
  --error-color: #dc3545;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', sans-serif;
  background-color: var(--secondary-color);
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.chat-container {
  width: 100%;
  max-width: 800px;
  background: white;
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 90vh;
}

.chat-header {
  background: var(--primary-color);
  color: white;
  padding: 20px;
  text-align: center;
}

.room-controls {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  flex-wrap: wrap;
}

.room-controls input {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 5px;
  min-width: 150px;
}

.room-controls button {
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  background: white;
  color: var(--primary-color);
  cursor: pointer;
  transition: all 0.3s ease;
}

.room-controls button:hover {
  background: var(--secondary-color);
}

.room-controls button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.chat-window {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: var(--secondary-color);
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.message {
  max-width: 70%;
  padding: 10px 15px;
  border-radius: 15px;
  position: relative;
  animation: fadeIn 0.3s ease;
}

.message.user {
  background: var(--primary-color);
  color: white;
  align-self: flex-end;
}

.message.system {
  background: #e9ecef;
  color: var(--system-color);
  align-self: center;
  font-style: italic;
}

.message.other {
  background: white;
  align-self: flex-start;
}

.message-timestamp {
  font-size: 0.8em;
  color: var(--system-color);
  margin-top: 5px;
}

.chat-input {
  display: flex;
  gap: 10px;
  padding: 15px;
  background: white;
  border-top: 1px solid var(--secondary-color);
}

.chat-input input {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--secondary-color);
  border-radius: 5px;
}

.chat-input button {
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  background: var(--primary-color);
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

.chat-input button:hover {
  background: #1c7fd6;
}

.chat-input button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.loading-overlay.active {
  opacity: 1;
  visibility: visible;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--primary-color);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 600px) {
  .chat-container {
    height: 100vh;
    border-radius: 0;
  }
  
  .room-controls {
    flex-direction: column;
  }
  
  .room-controls input,
  .room-controls button {
    width: 100%;
  }
}
