/***** ROOT CONTAINER STUFF *****/
html, body {
  height: 100%;
  margin: 0;
}
#app {
  height: 100%;
  display: flex;
  flex-direction: row;
  font-family: 'Alice';
  background-color: #fafafa;
  color: black;
  overflow-x: hidden;
}
#app.dark-theme {
  background-color: #303030;
  color: white;
}
#app textarea, #app button, #app input {
  font-size: inherit;
  font-family: inherit;
}

/***** Loading widget *****/
#loading {
  margin: auto;
  display: flex;
  align-items: center;
}

/***** WRAPPER for the main content of the chat page. Like, not drawers and dialogs and stuff *****/
#main-column {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  order: 0;
  width: 100%;
}

/***** CHAT HEADER is the title app bar above the chat *****/
#chat-header {
  padding: 0 16px;
  height: 64px;
  line-height: 64px;
  box-shadow: 0 0 10px rgba(0,0,0,.1);
  z-index: 3;
  font-size: 24px;
  display: flex;
  align-items: center;
}
.dark-theme #chat-header {
  box-shadow: 0 0 10px rgba(0,0,0,.4);
}
#chat-header span {
  flex-grow: 1;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#chat-header span:first-child {
  padding-left: 40px;
}
#chat-header span:last-child {
  padding-right: 40px;
}

/***** Scrollable center box which occupies most of the page. containing messages, etc *****/
#messages {
  flex: 1 1;
  overflow-y: scroll;
  padding: 10px 10px 20px;
  -webkit-overflow-scrolling: touch; /* iOS momentum scrolling */
}


/***** RP MESSAGES *****/
.message {
  word-wrap: break-word;
  margin: 20px auto 0;
  box-sizing: border-box;
  width: 100%;
  max-width: 600px;
  position: relative;
  padding: 24px 8px;
}
.message-sending {
  opacity: 0.7;
}
.message .content {
  line-height: 1.6;
  padding: 8px;
}
.message textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  border: solid 1px rgba(0,0,0,0.35);
}
/* .message mat-spinner {
  position: absolute;
  top: 2px;
  right: 22px;
  z-index: 1;
} */
.message .message-details {
  position: absolute;
  top: 1px;
  right: 48px;
  display: flex;
  align-items: center;
}
.message .message-details * {
  z-index: 1;
}
.message .timestamp {
  margin-right: 4px;
  opacity: 0.66;
}
.message .timestamp a {
  color: inherit;
}
.message .action-buttons {
  position: absolute;
  display: flex;
  top: 0;
  right: 8px;
  z-index: 1;
}
.message .icon-button {
  margin: -9px 0 0 -8px;
}
.message .icon-button i.material-icons {
  opacity: 0.66;
}

.message-narrator {
  background-color: white;
  border: 1px solid #999;
  border-radius: 8px;
}
.dark-theme .message-narrator {
  background-color:#444;
}

.message-ooc {
  border-left: 3px solid rgba(128,128,128,0.3);
  padding: 0 8px 0 14px;
}
.message-ooc + .message-ooc {
  margin-top: 10px;
}
.message-ooc .message-details {
  position: initial;
  float: right;
  border-bottom: 1px dotted rgba(128,128,128,0.3);
  padding-bottom: 3px;
  padding-right: 36px;
  margin: 0 7px 12px 20px;
}
.message-ooc .content {
  opacity: 0.66;
}
.message-ooc .content:not(textarea) {
  display: inline;
  padding: 0;
}
.message-ooc textarea.content {
  margin-top: 24px;
}

.message-chara {
  margin-top: 30px;
  border: 1px solid rgba(0,0,0,0.2);
  border-radius: 16px 16px 16px 0;
  padding-bottom: 12px;
}
.message-chara .name{
  display: inline-block;
  position: absolute;
  left: 25px;
  top: -13px;
  z-index: 1;
  background-color: inherit;
  border: 1px solid rgba(0,0,0,0.2);
  border-radius: 6px;
  padding: 4px 14px;
  font-size: 95%;
  letter-spacing: 1px;
  word-spacing: 1px;
  box-shadow: 2px 2px 4px rgba(0,0,0,0.03);
}
.dark-theme .message-chara {
  border-color: rgba(255,255,255,0.3);
}
.message-chara .content {
  background-color: white;
  color: black;
  opacity: 0.8;
  border-radius: 12px 12px 12px 0;
}
.dark-theme .message-chara .content {
  background-color: black;
  color: white;
  opacity: 0.6;
}

.message-image {
  padding-bottom: 10px;
}
.message-image .message-details {
  border-bottom: 1px dotted rgba(128,128,128,0.3);
  padding-bottom: 3px;
}
.message-image .content {
  text-align: center;
  padding: 0;
}
.message-image .content a {
  display: block;
  width: 100%;
}
.message-image .content img {
  display: block;
  margin: auto;
  max-width: 100%;
  max-height: 50vh;
}

/***** Color boxes to identify user who sent a message *****/
.color-ip-box {
  display: inline-flex;
  height: 8px;
  width: 18px;
  border: solid 1px rgba(0,0,0,0.7);
  position: relative;
}
.color-ip-box-section {
  flex-grow: 1;
}
.dark-theme .color-ip-box {
  border-color: rgba(255,255,255,0.7);
}


/***** SEND BOX: the box where you type stuff in to send as a message *****/
#send-box {
  display: flex;
  flex-direction: column;
  
  z-index: 3;

  border-color: rgba(0,0,0,0.15);
}
.dark-theme #send-box {
  border-color: rgba(255,255,255,0.4);
}

@media (max-width: 719px) {
  #send-box {
    border-top-width: 1px;
    border-top-style: solid;
  }
  #send-box > * {
    padding-left: 8px;
  }
}
@media (min-width: 720px) {
  #send-box {
    width: 700px;
    margin: auto;

    border-width: 1px;
    border-style: solid;

    margin-bottom: 10px;
    overflow: hidden;
  }
  #send-box > * {
    padding: 0 50px;
  }
}

#send-box.send-box-narrator {
  background-color: #ffffff;
}
.dark-theme #send-box.send-box-narrator {
  background-color: #444444;
}
#send-box.send-box-ooc {
  background-color: #fafafa;
}
.dark-theme #send-box.send-box-ooc {
  background-color: #303030;
}

#send-box #voice-bar { 
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  max-height: 100%;

  border-bottom-style: solid;
  border-bottom-width: 1px;

  border-bottom-color: rgba(0,0,0,0.15);

  height: 48px;

  font-size: 120%;
}

.dark-theme #send-box #voice-bar {
  border-bottom-color: rgba(255,255,255,0.4);
}

#send-box #click-to-change {
  flex: 1 1 auto;
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  height: 100%;
  transition: background-color .4s cubic-bezier(.25,.8,.25,1);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#send-box #click-to-change:hover {
  background-color: rgba(128,128,128,.3);
}

#send-box #typing-area {
  display: flex;
  flex-direction: row;
  align-items: center;
  max-height: 100%;

  background-color: rgba(255,255,255,0.8);
  color: black;
}

#send-box #typing-area textarea {
  flex-grow: 1;
  margin: 0;
  padding: 8px 0;
  border: none;
  background: transparent;
  color: inherit;
  resize: none;
  max-height: calc(30vh - 50px);
}

.dark-theme #send-box #typing-area {
  background-color: rgba(0,0,0,0.8);
  color: white;
}

#send-loader-container {
  width: 40px;
  height: 40px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

/***** DRAWERS, which are panels that pop in from the side of the page. For example, the character-selector drawer *****/
.drawer {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  background-color: #fafafa;
  z-index: 5;
}
.dark-theme .drawer {
  background-color: #444444;
}
@media (max-width: 1023px) {
  .drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 320px;
    transition: width .4s cubic-bezier(.25,.8,.25,1);
    box-shadow: 0 8px 10px -5px rgba(0,0,0,.2), 0 16px 24px 2px rgba(0,0,0,.14), 0 6px 30px 5px rgba(0,0,0,.12)
  }
  .drawer.drawer-right {
    right: 0;
  }
  .drawer.drawer-left {
    left: 0;
  }
}
@media (min-width: 1024px) {
  .drawer:not(.drawer-dock-1024) {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 320px;
    transition: width .4s cubic-bezier(.25,.8,.25,1);
    box-shadow: 0 8px 10px -5px rgba(0,0,0,.2), 0 16px 24px 2px rgba(0,0,0,.14), 0 6px 30px 5px rgba(0,0,0,.12)
  }
  .drawer.drawer-right:not(.drawer-dock-1024) {
    right: 0;
  }
  .drawer.drawer-left:not(.drawer-dock-1024) {
    left: 0;
  }
  .drawer.drawer-dock-1024 {
    flex: 0 0 320px;
  }
  .drawer.drawer-dock-1024.drawer-right {
    order: 1;
  }
  .drawer.drawer-dock-1024.drawer-left {
    order: -1;
  }
}
.v-enter-active.drawer, .v-leave-active.drawer {
  transition: transform 0.2s cubic-bezier(.25,.8,.25,1);
}
@media (max-width: 400px) {
  .v-enter-active.drawer, .v-leave-active.drawer {
    transition: transform 0.4s cubic-bezier(.25,.8,.25,1);
  }
}
.v-enter.drawer.drawer-right, .v-leave-to.drawer.drawer-right {
  transform: translate(320px, 0px)
}
.v-enter.drawer.drawer-left, .v-leave-to.drawer.drawer-left {
  transform: translate(-320px, 0px)
}
.drawer .drawer-header {
  padding: 0 16px;
  height: 64px;
  min-height: 64px;
  line-height: 64px;
  font-size: 24px;
  display: flex;
  align-items: center;
}
.drawer .drawer-header span:first-child {
  flex-grow: 1;
}
.drawer .drawer-body {
  display: flex;
  padding-top: 8px;
  overflow-x: hidden;
  overflow-y: auto;
  flex-direction: column;
  flex-grow: 1;
}
.drawer .drawer-item {
  width: 100%;
  height: 48px;
  min-height: 48px;
  padding: 0 16px;
  font-size: 16px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
  box-sizing: border-box;
}
.drawer .drawer-item.drawer-item-selected {
  border-left: solid 3px black;
}
.dark-theme .drawer .drawer-item.drawer-item-selected {
  border-left: solid 3px white;
}
.drawer .drawer-item > i.material-icons:first-child {
  padding-right: 16px;
}
.drawer .drawer-item > i.material-icons:last-child {
  padding-right: 8px;
}
.drawer .drawer-item span {
  flex-grow: 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drawer .drawer-divider {
  border-top: solid 1px;
  border-top-color: rgba(0,0,0,.12);
  display: block;
  margin: 0;
}
.dark-theme .drawer .drawer-divider {
  border-top-color: rgba(255,255,255,.12);
}

/***** DIALOG BOXES *****/
.dialog-container {
  z-index: 6;
}
.dialog {
  background-color: #fafafa;
  color: black;
  position: fixed;
  top: 25px;
  left: 5px;
  right: 5px;
  margin: auto;
  padding: 10px;
  box-shadow: 0 11px 15px -7px rgba(0,0,0,.2), 0 24px 38px 3px rgba(0,0,0,.14), 0 9px 46px 8px rgba(0,0,0,.12);
  border-radius: 2px;
}
.dark-theme .dialog {
  background-color: #444444;
  color: white;
}

/***** OVERLAYS, which cover and darkens the rest of the UI when a dialog/drawer is open *****/
.overlay {
  position: fixed;
  background-color: rgba(0,0,0, 0.6);
  top: 0;
  bottom: 0;
  right: 0;
  left: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
}
.v-enter-active .overlay, .v-leave-active .overlay {
  transition: opacity 0.2s cubic-bezier(.25,.8,.25,1);
}
.v-enter .overlay, .v-leave-to .overlay {
  opacity: 0;
}

.dark-theme .overlay {
  background-color: rgba(189,189,189,.6);
  color: black;
}
@media (min-width: 1024px) {
  .drawer-dock-1024 .overlay.overlay-drawer {
    display: none;
  }
}
.drawer-right .overlay.overlay-drawer {
  left: -99999px;
  right: 320px;
}
.drawer-left .overlay.overlay-drawer {
  left: 320px;
  right: -99999px;
}
@media (max-width: 400px) {
  .drawer-right .overlay.overlay-drawer {
    right: 80vw;
  }
  .drawer-left .overlay.overlay-drawer {
    left: 80vw;
  }
}

/***** ICON BUTTONS: icons you can click on, used throughout the page *****/
.icon-button {
  color: inherit;
  background: none;
  border: none;
  outline: none;
  text-decoration: none;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  transition: background-color .4s cubic-bezier(.25,.8,.25,1);
  display: flex;
  justify-content: center;
  align-items: center;
}
.icon-button:active {
  background-color: rgba(128,128,128,.3);
}
.icon-button i.material-icons {
  color: inherit;
}
.icon-button:disabled {
  cursor: auto;
  opacity: 0.26;
}

/***** CHARA ICONS, the subtle shadows so the colored icons for charas don't blend into the background *****/
i.chara-icon-shadow {
  text-shadow: 1px 1px 0 rgba(0,0,0,0.3);
}
.dark-theme i.chara-icon-shadow {
  text-shadow: 1px 1px 0 rgba(255,255,255,0.3);
}

/***** PRETTY OUTLINED BUTTONS *****/
.outline-button {
  width: 90px;
  background-color: inherit;
  border: solid 1px black;
  border-radius: 2px;
  padding: 5px;
  color: black;
  cursor: pointer;
  transition: 0.3s cubic-bezier(0.25, 0.8, 0.5, 1), color 1ms;
}
.outline-button:disabled {
  opacity: 0.4;
  cursor: auto;
}
.outline-button:not(:last-of-type) {
  margin-right: 10px;
}
.dark-theme .outline-button {
  border-color: white;
  color: white;
}
.outline-button:hover:not(:disabled) {
  background-color: rgba(128,128,128,0.3);
}


/***** Character dialog *****/
#character-dialog {
  max-width: 200px;
}
#character-dialog > div {
  display: flex;
  justify-content: space-between;
}
#character-dialog > div:not(:first-child) {
  margin-top: 5px;
}
#character-dialog input[type="text"] {
  flex: 1 1;
}
#character-dialog button {
  margin-top: 20px;
}

/***** Image dialog *****/
#image-dialog {
  max-width: 300px;
}
#image-dialog > div {
  display: flex;
  justify-content: flex-start;
}
#image-dialog > div:not(:first-child) {
  margin-top: 5px;
}
#image-dialog input[type="text"] {
  flex: 1 1;
}

/***** "Preview Container" is used in the image/audio dialogs to preview embedded content *****/
.preview-container {
  background-image:
    linear-gradient(45deg, rgba(0,0,0,0.2) 25%, rgba(255,255,255,0.2) 25%),
    linear-gradient(-45deg, rgba(0,0,0,0.2) 25%, rgba(255,255,255,0.2) 25%),
    linear-gradient(45deg, rgba(255,255,255,0.2) 75%, rgba(0,0,0,0.2) 75%),
    linear-gradient(-45deg, rgba(255,255,255,0.2) 75%, rgba(0,0,0,0.2) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;

  width: 300px;
  max-width: 100%;
  height: 200px;

  display: flex;
}
.preview-container.preview-container-busted {
  background: none;
}
.preview-container img {
  max-width: 100%;
  max-height: 100%;
  margin: auto;
}


/***** Download dialog *****/
#download-dialog {
  max-width: 200px;
}


/***** MESSAGE HISTORY DIALOG *****/
#history-dialog {
  max-width: 700px;
}
#history-dialog-messages {
  max-height: 280px;
  overflow-y: scroll;
  box-shadow: inset 0 -2px 10px rgba(128,128,128,0.4);
  border-radius: 10px;
  margin-bottom: 10px;
  padding: 4px;
}


/***** NOTICE THAT SHOWS WHEN YOU START A NEW RP *****/
#welcome {
  margin: 3vh auto 0;
  padding: 20px;
  max-width: 400px;
}
#welcome a {
  word-break: break-word;
  font-size: 115%;
  text-decoration: none;
  border-bottom: 1px dotted rgb(124, 77, 255);
  color: rgb(124, 77, 255);
  opacity: 0.87;
}
.dark-theme #welcome a {
  color: rgb(255,193,7);
  border-bottom-color: rgb(255,193,7);
}

/***** NOTICE THAT SHOWS WHEN YOU HAVE A LONG RP, and you can't see it all on the chat page *****/
#archive-advice {
  font-style: italic;
  margin: 3vh auto 0;
  padding: 10px;
  text-align: center;
}
#archive-advice a {
  text-decoration: none;
  border-bottom: 1px dotted rgb(124, 77, 255);
  color: rgb(124, 77, 255);
  opacity: 0.87;
}
.dark-theme #archive-advice a {
  color: rgb(255,193,7);
  border-bottom-color: rgb(255,193,7);
}


/***** CONNECTION LOST *****/
#connection-indicator {
  padding: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  background-color: #d32f2f;
}
#connection-indicator i.material-icons {
  margin-right: 5px;
}


/***** PAGE NUMBER LINKS on the archive index *****/
#archive-index {
  max-width: 600px;
  margin: 2vh auto 0;
}
.page-number-link {
  width: 60px;
  line-height: 50px;
  font-size: 150%;
  display: inline-flex;
  justify-content: center;
  align-content: center;
  color: inherit;
  text-decoration: none;
}

/***** PAGINATOR SUBHEADER on an archive page *****/
#pager {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  background-color: #eee;
}
.dark-theme #pager {
  background-color: #555;
}

/***** Generated action tags in messages *****/
.message-star-tag {
  padding: 0.1em 0.3em;
  border-radius: 8px;
  opacity: 0.9;
  border: 1px solid rgba(0,0,0,0.2);
  box-shadow:2px 2px 4px rgba(0,0,0,0.03);
}
