:root {
  --primary-color: #5dc4dc;
  --secondary-color: #1e3c87;
  --accent-color: #f7c500;
  --light-bg: #f0f9fb;
  --border-radius: 12px;
  --font-family: 'Roboto', Arial, sans-serif;
  --box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

html {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: #f7f7f7;
}

body {
  height: 100%;
  margin: 0 auto;
  padding: 0;
  overflow: hidden;
  font-family: var(--font-family);
  color: #333;
  background-color: white;
  display: flex;
  flex-direction: column;
  max-width: 450px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
  position: relative;
}

/* Header styles */
header {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  background-color: white;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  flex: 0 0 auto;
}

h1 {
  color: var(--secondary-color);
  font-size: 16px;
  margin: 0;
  margin-left: 8px;
  font-weight: 500;
  flex-grow: 1;
}

.logo {
  margin: 0;
}

.logo img {
  width: 32px;
  height: auto;
}

.user-menu {
  margin-left: auto;
}

.logout-link {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.logout-link:hover {
  background-color: #f0f0f0;
}

/* Messages container */
main.messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  background-color: var(--light-bg);
}

.message {
  margin-bottom: 16px;
  padding: 14px;
  border-radius: var(--border-radius);
  max-width: 80%;
  line-height: 1.5;
}

.user-message {
  background-color: #e8f0fe;
  color: var(--secondary-color);
  align-self: flex-end;
  margin-left: auto;
}

.server-message {
  background-color: white;
  color: #333;
  align-self: flex-start;
}

/* Footer input area */
footer.chat-input-area {
  display: flex;
  padding: 12px 16px;
  background-color: white;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  position: sticky;
  bottom: 0;
  flex: 0 0 auto;
  z-index: 10;
}

#message-input {
  flex-grow: 1;
  padding: 12px 16px;
  border: 1px solid #e1e4e8;
  border-radius: var(--border-radius);
  margin-right: 12px;
  font-family: var(--font-family);
  font-size: 14px;
  outline: none;
}

#message-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(93, 196, 220, 0.2);
}

button {
  padding: 12px 24px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-weight: 600;
  font-family: var(--font-family);
  font-size: 14px;
  transition: background-color 0.2s;
}

button:hover {
  background-color: #4ab6cf;
}

.loading #message-input,
.loading button {
  opacity: 0.7;
  pointer-events: none;
}

/* Typing indicator */
.typing-indicator {
  display: inline-block;
}

.typing-indicator span {
  display: inline-block;
  animation: typingDot 1.4s infinite;
  font-size: 1.2em;
  line-height: 0.1;
  margin-left: 2px;
}

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

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

@keyframes typingDot {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.6;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* Login styles */
.login-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background-color: var(--light-bg);
}

.login-form {
  width: 100%;
  max-width: 320px;
  background-color: white;
  padding: 24px;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--secondary-color);
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid #e1e4e8;
  border-radius: 6px;
  font-size: 14px;
}

.form-group input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(93, 196, 220, 0.2);
  outline: none;
}

.login-button {
  width: 100%;
  margin-top: 8px;
  padding: 12px;
}

.error-message {
  background-color: #ffebee;
  color: #d32f2f;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 16px;
  width: 100%;
  max-width: 320px;
  text-align: center;
}

/* Responsive adjustments */
@media (max-width: 450px) {
  body {
    max-width: 100%;
    box-shadow: none;
  }

  .message {
    max-width: 90%;
  }

  button {
    padding: 12px 16px;
  }
}