:root {
  --p_deep: #121018;
  --p_dark: #1d1a28;
  --p_dim: #36324d;
  --p_shaded: #443e60;
  --p_lighter: #524a73;
  --p_bright: #695aa4;
  --p_contrast: #8f7be0;

  --chat_say: #f7f7f7;
  --chat_yell: #ffff00;
  --chat_tell: #ffb8de;
  --chat_party: #66e5ff;
  --chat_shout: #ffa666;
  --chat_emote: #bafff0;
  --chat_linkshell: #d4ff7d;
  --chat_freecompany: #abdbe5;

  --border: var(--p_bright);
  --dim-border: var(--p_shaded);
}

html {
  overflow: hidden;
  height: 100%;
}

label:has(> input) {
  cursor: pointer;
}

label input {
  display: none;
}

label span.radio {
  height: 10px;
  width: 10px;
  border: 1px solid var(--p_shaded);
  display: inline-block;
  position: relative;
  border-radius: 10px;
}

label span.checkbox {
  height: 10px;
  width: 10px;
  border: 1px solid var(--p_shaded);
  display: inline-block;
  position: relative;
}

input[type="checkbox"]:checked + span:before,
input[type="radio"]:checked + span:before {
  content: "\2714";
  position: absolute;
  top: -5px;
  left: 0;
}

body {
  /* background-color: #222; */
  background-color: var(--p_deep);
  color: white;

  height: 100%;
  overflow: auto;
  box-sizing: border-box;
  margin: 0;
  font-size: 1rem;
}

#editor {
  height: 100%;
  width: 100%;
  scrollbar-width: none;
  overflow-x: hidden;
  overflow-y: auto;
  display: inline-flex;
  margin: 0;

  & ul#preview,
  ul#filewatch {
    height: 70%;
    border: none;
    outline: none;
    resize: none;
    font-family: monospace;
    list-style-type: none;
    box-sizing: border-box;
    scrollbar-width: none;
    overflow-wrap: break-word;
    overflow-y: auto;
    margin: 0;
    padding-top: 0.5rem;
  }

  & div#filewatch-container {
    flex-direction: column;
    margin: inherit;
    padding: inherit;
    width: 60%;
    height: 70%;
    overflow-y: hidden;
    overflow-x: hidden;
    justify-content: space-between;
    box-sizing: border-box;
    min-width: 600px;

    font-family:
      "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS", sans-serif;

    & #chat-scroll-indicator {
      position: absolute;
      top: auto;
      right: 2px;
      bottom: calc(30% + 3em);
      z-index: 9999;
      cursor: pointer;
    }

    & #chat-scroll-indicator::after {
      content: "↴";
    }

    & #chat-filters {
      display: flex;
      justify-content: space-evenly;
      user-select: none;
      font-size: medium;

      margin-top: auto;
      margin-bottom: 0;

      border-top: 4px solid var(--border);
      background-color: var(--border);
      color: var(--p_deep);

      & label {
        padding-left: 0.3rem;
        padding-right: 0.3rem;
      }

      & .seperator {
        margin: 0;
        padding: 0;
      }

      & .seperator::after {
        content: "";
        padding: 0;
        padding-right: 2px;
        border-right: 1px solid var(--p_dark);
      }

      & a {
        float: right;
        color: var(--p_dark);
        text-decoration: none;
        padding-left: 0.3rem;
        padding-right: 0.3rem;
      }

      & .spacer {
        margin-left: auto;
        margin-right: 0;
      }
    }
  }

  & ul#filewatch {
    border-left: 3px solid var(--border);
    top: 0;
    left: 50%;
    width: 100%;
    height: 100%;
    font-size: 80%;

    padding-right: 1rem;
    padding-left: 1rem;
    margin-bottom: 0;
    margin: 0;

    & li {
      display: inline-block;

      & a {
        background-color: var(--p_shaded);
        cursor: pointer;
        user-select: none;
        border-radius: 6px;
        padding-left: 5px;
        padding-right: 5px;
        vertical-align: middle;
        text-shadow: 3px 3px 3px var(--p_deep);

        border: 1px solid var(--p_shaded);
      }

      & a.hide {
        display: none;
        color: red;
        content: "✗";
      }

      & a.name:hover {
        text-decoration: 3px solid red line-through;
      }

      span:before {
        content: " ";
      }
    }

    li.hide {
      display: none;
      & a.hide {
        display: inline-block;
        color: green;
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
      }

      & a.name {
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
      }
    }

    li:hover,
    li.hide:hover {
      & a.hide {
        display: inline-block !important;
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
      }

      & a.name {
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
      }
    }
  }

  & ul#preview {
    width: 100%;

    padding-right: 1rem;
    padding-left: 1rem;
    margin-bottom: 0;

    scrollbar-width: none;
    overflow-wrap: break-word;
    overflow-y: auto;
    margin: 0;
    padding-top: 0.5rem;
    user-select: none;

    & li {
      cursor: pointer;
    }
  }

  & ul {
    & li {
      display: inline-flex;
      padding-top: 0.5rem;
      padding-bottom: 0.5rem;
      width: 100%;
      border-bottom: 1px solid var(--dim-border);
      margin-right: 0;
      margin-left: 0;
    }

    & li:last-child {
      border-bottom: none;
    }

    & li.focused {
      & span.chat-preview {
        padding-left: 0.4rem;
      }
    }

    & li.focused:before {
      content: "";
      border: 0.3rem solid var(--p_lighter);
      font-size: xx-large;
      align-content: center;
    }

    & span.content {
      margin-left: 0;
      margin-right: auto;
    }

    & span.metadata {
      width: 5em;
      padding-left: 2rem;
      margin-left: auto;
      margin-right: 0;
      text-align: right;
      white-space: pre-wrap;
      color: var(--p_lighter);
    }

    & .party {
      color: var(--chat_party);
    }

    & .say {
      color: var(--chat_say);
    }

    & .yell {
      color: var(--chat_yell);
    }

    & .shout {
      color: var(--chat_shout);
    }

    & .emote {
      color: var(--chat_emote);
    }

    & .tell {
      color: var(--chat_tell);
    }

    & .freecompany {
      color: var(--chat_freecompany);
    }

    & .linkshell {
      color: var(--chat_linkshell);
    }

    & .command {
      color: var(--chat_say);
    }

    & span.command:before {
      content: url("https://cdn.discordapp.com/emojis/435886977531772941.webp");
      display: inline-block;
      padding-right: 0;
      padding-left: 0;
      padding-top: 1px;
      vertical-align: middle;
    }

    & span.command:after {
      content: url("https://cdn.discordapp.com/emojis/435886988764250133.webp");
      display: inline-block;
      padding-top: 2px;
      padding-left: 0;
      padding-right: 0;
      vertical-align: middle;
    }

    & span.overlimit {
      color: red !important;
    }

    & li:has(> span.copied) {
      background-color: var(--p_contrast);

      & span.copied {
        color: var(--p_dark);
      }

      & span.metadata {
        color: var(--p_dark);
      }
    }
  }

  & textarea {
    position: fixed;
    bottom: 2rem;
    width: 100%;
    height: calc(30% - 2rem);
    box-sizing: border-box;
    outline: none;
    resize: none;
    font-family: monospace;
    font-size: 1rem;
  }

  #textbox {
    border: 3px solid var(--border);
    border-left: none;
    border-right: none;
    border-bottom: none;
    width: 100%;
    padding: 1em;
    overflow-y: scroll;
    background-color: var(--p_dark);
    color: white;
    scrollbar-width: none;
    overflow-y: auto;
  }
}

nav {
  position: fixed;
  box-sizing: border-box;
  user-select: none;

  left: 0;
  bottom: 0;

  width: 100%;
  height: 2rem;
  padding: 0.3rem 0.5em;

  font-family: "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS", sans-serif;

  color: var(--p_deep);
  background-color: var(--p_bright);
  border-top: 1px solid var(--p_shaded);

  & label.radio-container {
    border-left: 1px solid var(--p_shaded);
    padding-left: 0.5rem;
    padding-right: 0.2rem;
  }

  & label.radio-container:first-child {
    border: none;
    padding-left: 0;
  }

  & #controls {
    float: right;
  }

  & .navitem {
    border-right: 1px solid #36324d;
    margin-right: 0.5rem;
    padding-right: 0.2rem;
  }

  & a {
    color: var(--p_deep);
  }

  #followlog-icon.unopened:before {
    content: "⟲";
  }

  #followlog-icon.opened:before {
    content: "\2718";
  }
}

#save a,
#open a {
  display: none;
  text-decoration: none;
}

#open > input {
  display: none;
}

#about {
  & form {
    text-align: right;
  }
}

dialog {
  margin-left: auto;
  margin-right: auto;
  margin-top: 5rem;
  padding: 0;
  color: transparent;
  background-color: transparent;
  width: 50%;
  height: 500px;
}

.popup-modal {
  display: inline-flex;
  height: 99%;
  width: 99%;

  margin: 0;
  padding: 0;

  border: 2px solid var(--p_lighter);
  border-radius: 1rem;

  background-color: var(--p_dark);
  color: var(--p_bright);

  & span.close {
    display: inline-block;
    position: absolute;
    right: 1rem;
    top: 0.75rem;

    border-radius: 100%;
    height: 10px;
    width: 10px;

    border: 1px solid var(--p_bright);
    background-color: var(--p_bright);
  }

  & span.close:hover {
    background-color: var(--p_contrast);
    border-color: var(--p_contrast);
    cursor: pointer;
  }

  & .close {
    color: var(--p_deep);
    text-align: center;
    vertical-align: middle;

    margin: 0 auto;
    padding: 0;
  }

  & .modal-menu {
    display: flex;
    flex-direction: column;
    background-color: var(--p_lighter);
    color: var(--p_dark);
    text-align: right;
    user-select: none;

    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
    font-family:
      "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS", sans-serif;

    & span.option {
      padding: 0.3rem;
      margin: 0;
    }

    & span.option:first-child {
      border-top-left-radius: 10px;
    }

    & .option:hover {
      background-color: var(--p_bright);
      cursor: pointer;
    }
  }

  & .separater {
    border: 1px solid var(--p_dim);
    margin: 0;
    padding: 0;
  }

  & hr {
    border: 1px solid var(--p_dim);
    padding: 0;
    margin: 0;
  }

  & .page-content {
    color: var(--p_contrast);
    margin: 1rem;
    width: 100%;

    & h2 {
      text-align: left;
      color: var(--p_contrast);
      margin-top: auto;
    }

    & form {
      text-align: right;
    }

    & hr {
      border: 1px solid var(--p_dim);
      margin-top: 0.5rem;
      margin-bottom: 0.5rem;
    }

    & a {
      text-decoration: underline;
      font-style: italic;
      color: var(--p_contrast);
    }
  }
}

#settings-page {
  & .setting-container {
    display: flex;
    flex-direction: column;
    flex-flow: row wrap;
    justify-content: space-between;

    & .setting-name {
      font-family: monospace;
      align-content: left;
      width: auto;
    }

    & .setting-description {
      font-style: italic;
      font-size: 85%;

      text-justify: right;
      text-align: right;
    }

    & .setting-input {
      align-content: right;
      width: auto;
    }
  }
}

.navbar-icon {
  text-decoration: none;
  font-weight: bold;
  font-size: 1em;
}

@media print {
  nav {
    display: none;
  }
}
