/* Chat Interface Styles */
.chat-wrapper {
  width: 100%;
  height: 500px;
  background-size: 100% 100%;
  position: relative;
  grid-column: 2 / 12;
  margin: 0 auto 1.66rem auto;
}
@media (max-width: 600px) {
  .chat-wrapper {
    grid-column: 1 / 13;
  }
}

/* Make everything animate because animations are cool. */
form.chat * {
  transition: all 0.5s;
  box-sizing: border-box;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
}

form.chat {
  margin: 15px 0;
  cursor: default;
  position: absolute;
  display: block;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
  -webkit-touch-callout: none; /* iOS Safari */
  -webkit-user-select: none; /* Chrome/Safari/Opera */
  -khtml-user-select: none; /* Konqueror */
  -moz-user-select: none; /* Firefox */
  -ms-user-select: none; /* IE/Edge */
  user-select: none;
}

form.chat .messages {
  display: block;
  overflow-x: hidden;
  overflow-y: scroll;
  position: relative;
  height: 85%;
  width: 100%;
  padding-left: 0.5rem;
  border-bottom: 1px solid #ecf0f1;
}

/* Customize the scrollbar to look like Messages.app */
form.chat ::-webkit-scrollbar {
  width: 3px;
  height: 1px;
  transition: all 0.5s;
  z-index: 10;
}

form.chat ::-webkit-scrollbar-track {
  background-color: white;
}

form.chat ::-webkit-scrollbar-thumb {
  background-color: #bec4c8;
  border-radius: 3px;
}

/* Basic message formatting. */
form.chat .message {
  display: block;
  width: 98%;
  padding: 0.5%;
}

form.chat .message p {
  line-height: 20px;
  margin: 0;
  padding: 10px 0;
}

form.chat .reader,
form.chat .ash {
  word-wrap: break-word;
  margin-bottom: 20px;
  position: relative;
  padding: 0px 15px;
  color: white;
  border-radius: 25px;
  clear: both;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  max-width: 90%;
}

/* Formatting specific to "my" messages. */
form.chat .reader {
  background: #2668d0;
  color: white;
  float: right;
  clear: both;
  border-bottom-right-radius: 20px 0px;
}

form.chat .reader:before {
  content: "";
  position: absolute;
  z-index: 1;
  bottom: -2px;
  right: -8px;
  height: 19px;
  border-right: 20px solid #2668d0;
  border-bottom-left-radius: 16px 14px;
  -webkit-transform: translate(0, -2px);
  transform: translate(0, -2px);
  border-bottom-left-radius: 15px 0px;
  transform: translate(-1px, -2px);
}

form.chat .reader:after {
  content: "";
  position: absolute;
  z-index: 1;
  bottom: -2px;
  right: -42px;
  width: 12px;
  height: 20px;
  background: white;
  border-bottom-left-radius: 10px;
  -webkit-transform: translate(-30px, -2px);
  transform: translate(-30px, -2px);
}

/* Formatting specific to "their" messages */
form.chat .ash {
  background: #e5e5ea;
  color: black;
  float: left;
  clear: both;
  border-bottom-left-radius: 30px 0px;
}

form.chat .ash:before {
  content: "";
  position: absolute;
  z-index: 2;
  bottom: -2px;
  left: -7px;
  height: 19px;
  border-left: 20px solid #e5e5ea;
  border-bottom-right-radius: 16px 14px;
  -webkit-transform: translate(0, -2px);
  transform: translate(0, -2px);
  border-bottom-right-radius: 15px 0px;
  transform: translate(-1px, -2px);
}

form.chat .ash:after {
  content: "";
  position: absolute;
  z-index: 3;
  bottom: -2px;
  left: 4px;
  width: 26px;
  height: 20px;
  background: white;
  border-bottom-right-radius: 10px;
  -webkit-transform: translate(-30px, -2px);
  transform: translate(-30px, -2px);
}

/* Formatting for the input at the bottom. */
form.chat #input {
  font-size: 15px;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  border: 0;
  padding: 0 10px;
  height: 15%;
  outline: 0;
  display: table;
  width: calc(100% - 60px);
  float: left;
}

form.chat #input p {
  color: black;
  display: table-cell;
  vertical-align: middle;
  line-height: 20px;
  margin: 0;
}

form.chat input[type="submit"] {
  font-size: 15px;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  border: 0;
  padding: 0 15px;
  height: 15%;
  outline: 0;
  width: 60px;
  background: transparent;
  color: #0072c6;
  font-weight: 700;
  text-align: right;
  float: right;
}

/* "Spinner" really means "loading indicator" here. */
form.chat span.spinner {
  -moz-animation: loading-bar 0.5s 1;
  -webkit-animation: loading-bar 0.5s 1;
  animation: loading-bar 0.5s 1;
  display: block;
  height: 2px;
  background-color: #2668d0;
  transition: width 0.2s;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4;
}

/* Loading bar animation */
@keyframes loading-bar {
  0% {
    width: 0%;
  }
  90% {
    width: 90%;
  }
  100% {
    width: 100%;
  }
}