/* Define unique color variables */
:root {
  --color-primary: #09809e;
  --color-primary-hover: #07657c;
  --color-background: #09809e33;
  --color-border: #e4e4e4;
  --color-message-received: #e4e4e4;
  --color-message-sent: #dcf8c6;
  --color-white: white;
}

* {
  margin: 0;
  padding: 0;
  cursor: default;
  box-sizing: border-box;
}

body {
  font-family: "Raleway", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-optical-sizing: auto;
  background: var(--color-background);
  height: 100vh;
}

a {
  text-decoration: none;
  color: #000;
}

h1 {
  padding: 1rem;
  background: var(--color-primary);
  color: var(--color-white);
  text-align: center;
  font-size: 1.5em;
  font-weight: normal;
}

h1 a {
  color: var(--color-white);
  font-weight: bold;
}

input[type=text],
textarea {
  cursor: text;
}

input[type=button],
button,
button *,
a,
select {
  cursor: pointer;
}

input[type=text],
input[type=password],
input[type=button],
select,
button {
  border-radius: 0.5rem;
}

input[type=text],
input[type=password],
select {
  padding: 0.8rem;
  border: 1px solid var(--color-border);
}

input[type=text]:focus,
input[type=password]:focus {
  border-color: var(--color-primary);
}

input[type=button],
button {
  padding: 0.8rem 1.5rem;
  background: var(--color-primary);
  color: var(--color-white);
  border: none;
  transition: background 0.2s;
}

input[type=button]:hover,
button:hover {
  background: var(--color-primary-hover);
}

textarea {
  flex: 1;
  padding: 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: 1.5rem;
  outline: none;
  font-size: 0.9rem;
  resize: none;
}

textarea:focus {
  border-color: var(--color-primary);
}

.delete {
  color: darkred;
  font-weight: bold;
}

.chat-container {
  max-width: 800px;
  margin: 0 auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-white);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.message {
  max-width: 70%;
  padding: 0.8rem 1rem;
  border-radius: 1rem;
  position: relative;
  word-wrap: break-word;
}

.message.received {
  background: var(--color-message-received);
  align-self: flex-start;
  border-bottom-left-radius: 0.2rem;
}

.message.sent {
  background: var(--color-primary);
  color: var(--color-white);
  align-self: flex-end;
  border-bottom-right-radius: 0.2rem;
}

.message img {
  display: block;
  margin: 20px auto 0;
  max-width: 100%;
  max-height: 150px;
  border-radius: 0.3em;
}

@keyframes slideLeft {
  from {
    opacity: 0;
    transform: translateX(50px);
  }

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

@keyframes slideRight {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }

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

.message.sent:last-child {
  animation: slideLeft 0.5s ease-out;
}

.message.received:last-child {
  animation: slideRight 0.5s ease-out;
}

.choice-buttons {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
}

.choice-button {
  flex: 1;
  padding: 0.8rem;
  background: var(--color-primary);
  color: var(--color-white);
  border: none;
  border-radius: 0.5rem;
  transition: background 0.2s;
  font-size: 0.9rem;
}

.choice-button img {
  max-width: 100%;
  max-height: 150px;;
}

.choice-button:hover {
  background: var(--color-primary-hover);
}

.choice-inputs {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  border-top: 1px solid var(--color-border);
}

.choice-inputs>div {
  flex: 1;
}

.choice-inputs input {
  width: 100%;
}

.chat-input {
  padding: 1rem;
  background: var(--color-white);
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 0.5rem;
}

.chat-input>input {
  flex: 1;
}

.choice-wrapper img {
  margin-top: 20px;
}

form.create-session {
  display: flex;
  gap: 0.5rem;
  margin: 1rem;
}

form.create-session select {
  flex: 1;
}

table.sessions {
  width: 100%;
  border-style: none;
  border-collapse: collapse;
}

table.sessions th,
table.sessions td {
  padding: 0.8rem;
  text-align: left;
}

table.sessions th {
  background: var(--color-primary-hover);
  color: var(--color-white);
}

table.sessions td:first-child {
  font-weight: bold;
}

table.sessions td:nth-child(4) {
  text-align: right;
}

table.sessions .share, table.sessions .delete {
  font-weight: bold;
}

table.sessions tr:hover {
  background: var(--color-background);
}

@media (max-width: 600px) {
  .chat-container {
    height: 100vh;
    width: 100%;
  }

  .message {
    max-width: 85%;
  }

  .chat-input {
    padding: 0.8rem;
  }

  .choice-inputs {
    padding: 0.8rem;
    flex-direction: column;
  }
}