:root {
  --primary: #440c4e;
  --primary-light: #e1c3e1;
  --background: #f1e9f1;
  --messages-bg: #e1c3e1;
  --white: #e8bdfb;
  --text: #161515;
  --border: #dddddd;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--background);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

/* ===========================
   Join Screen
=========================== */

.join-card {
  width: 100%;
  max-width: 400px;
  background: var(--white);
  padding: 2rem;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.join-card h1 {
  margin-top: 0;
  color: var(--primary);
}

.join-card p {
  margin-bottom: 1rem;
}

.join-card input {
  width: 100%;
  padding: 12px;
  margin-bottom: 1rem;
  border: 1px solid #cccccc;
  border-radius: 8px;
  font-size: 1rem;
}

.join-card button {
  width: 100%;
}

/* ===========================
   Chat Container
=========================== */

.chat-container {
  width: 100%;
  max-width: 420px;
  height: 650px;
  background: var(--primary-light);
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.chat-header {
  background: var(--primary);
  color: var(--white);
  padding: 1rem;
  text-align: center;
}

.chat-header h2 {
  margin: 0;
}

/* ===========================
   Messages
=========================== */

.chat-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--messages-bg);
  scroll-behavior: smooth;
}

.message {
  max-width: 75%;
  padding: 10px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow-wrap: break-word;
  word-break: break-word;
  animation: fadeIn 0.2s ease;
}

.message.outgoing {
  align-self: flex-end;
  background: var(--primary);
  color: var(--white);
  border-bottom-right-radius: 2px;
}

.message.incoming {
  align-self: flex-start;
  background: var(--white);
  color: var(--text);
  border-bottom-left-radius: 2px;
}
.msg-user {
  font-size: 0.72rem;
  font-weight: 600;
  opacity: 0.7;
}

.msg-text {
  font-size: 0.88rem;
  line-height: 1.35;
  font-weight: 400;
}

.msg-time {
  margin-top: 5px;
  font-size: 0.7rem;
  text-align: right;
  opacity: 0.65;
}

/* ===========================
   Reactions
=========================== */

.reactions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.reactions button {
  background: rgba(9, 2, 2, 0.2);
  border: none;
  border-radius: 20px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.85rem;
  transition:
    transform 0.2s ease,
    background 0.2s ease;
}

.reactions button:hover {
  transform: scale(1.05);
  background: rgba(255, 255, 255, 0.35);
}

.reactions button:hover {
  transform: scale(1.1);
}

/* ===========================
   Input
=========================== */

.chat-input {
  display: flex;
  gap: 10px;
  padding: 16px;
  margin-top: 12px; /* adds space above the footer */
  border-top: 1px solid var(--border);
  background: var(--white);
}

.chat-input input {
  flex: 1;
  padding: 10px;
  border: 1px solid #cccccc;
  border-radius: 8px;
  outline: none;
  font-size: 0.95rem;
}

.chat-input input:focus,
.join-card input:focus {
  border-color: var(--primary);
  outline: 2px solid rgba(68, 12, 78, 0.2);
  outline-offset: 2px;
}

button {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: var(--white);
  cursor: pointer;
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
}

button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

button:active {
  transform: translateY(1px);
}

/* ===========================
   Utilities
=========================== */

.hidden {
  display: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===========================
   Footer
=========================== */

.chat-footer {
  padding: 16px 20px;
  text-align: center;
  background: var(--primary-light);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.chat-footer p {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 400;
  color: #847788;
  letter-spacing: 0.3px;
}

/* ===========================
   Mobile
=========================== */

@media (max-width: 480px) {
  .chat-container {
    height: 100vh;
    border-radius: 0;
  }

  body {
    padding: 0;
  }

  .join-card {
    margin: 1rem;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
