:root {
  --r_shaded: #830030;
  --r_dim: #49051e;
  --r_contrast: #d11642;

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

  --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);
  --close: var(--r_contrast);
  --selected-bright: var(--p_contrast_alt_confirm);
}

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

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

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

/**
 * We want the original input boxes to be hidden, but extant so they
 * can carry useful state
 */
label:has(> input) {
  cursor: pointer;
  & input {
    display: none;
  }

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

  & 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;
  }
}

.editor-window:has(.tab-container > .chat-tab.active.blacklist)
  > #filewatch-container
  > #filewatch {
  & li {
    display: inline-block;
  }
}

.editor-window:has(.tab-container > .chat-tab.active.whitelist)
  > #filewatch-container
  > #filewatch {
  & li {
    display: none;
    background-color: var(--r_dim);

    & a.name:hover::after {
      content: " ✔";
      font-weight: bold;
      color: darkgreen;
    }
  }

  & li.hide {
    background-color: var(--r_dim);
  }
}

#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;
    max-width: 60%;

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

    & div#filewatch-tabs {
      display: flex;
      flex-wrap: nowrap;
      margin: 0;
      font-size: 95%;

      border-left: 3px solid var(--border);
      border-bottom: 3px solid var(--border);

      overflow: hidden;

      & .chat-tab {
        border: 0;
        padding: 0.1rem 0.5rem 0.35rem 0.5rem;

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

        text-shadow: 3px 3px 3px var(--p_deep);

        cursor: pointer;
        user-select: none;
        flex-shrink: 0; /* For tab scrolling */

        & a.configure {
          display: inline-block;
          color: whitesmoke;
          padding: 0 0 0 0.4rem;
        }

        & a.configure:hover {
          color: var(--selected-bright);
        }

        & a.delete {
          display: inline-block;
          color: whitesmoke;
          padding: 0;
          padding: 0 0 0 0.3rem;
        }

        & a.delete:hover {
          color: var(--close);
        }
      }

      .chat-tab.whitelist::before {
        content: "🚫 ";
        font-size: smaller;
        color: whitesmoke;
      }

      & .chat-tab:first-child {
        padding-left: 0.4rem;
      }

      & span#new-tab.chat-tab:hover {
        color: var(--selected-bright);
      }

      & span.chat-tab.active {
        background-color: var(--border);
        border-color: var(--p_shaded);
        border-top-color: var(--border);
        border-right: 1px solid var(--p_deep);
        border-bottom: 0;
      }

      & span.chat-tab:last-child {
        border-radius: 0 10px 0 0;
      }

      & span.chat-tab:hover {
        background-color: var(--border);
        border-color: var(--p_shaded);
        border-top-color: var(--border);
        border-right: 1px solid var(--p_deep);
        border-bottom: 0;
      }
    }

    & #chat-scroll-indicator {
      position: fixed;
      top: auto;
      right: 3px;
      bottom: calc(30% + 3em);
      z-index: 9999;
      cursor: pointer;
      text-shadow: 0 0 5px var(--p_bright);
      font-weight: bold;
    }

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

  & #chat-filters {
    display: flex;
    /* justify-content: ; */
    user-select: none;
    font-size: 80%;

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

    border-left: 3px solid var(--border);
    border-bottom: 0;
    /* color: var(--p_deep); */

    & label {
      padding: 0.3rem 0.5rem 0.2rem 0.5rem;
      border-right: 1px solid var(--p_deep);
      background: var(--p_shaded);
      text-shadow: 3px 3px 3px var(--p_deep);

      /* background-image: linear-gradient(to top, var(--border), var(--p_shaded)); */
    }

    .options-container {
      padding: 0;
      margin: 0;
    }

    & label:last-child,
    a:last-child {
      border-right: 0px solid var(--p_deep);
    }

    label:has(a) {
      cursor: pointer;
      display: flex;
      align-content: center;
      align-items: center;
      text-align: center;
      font-weight: bold;
    }

    & .pre-spacer {
      border-radius: 0 10px 0 0;
    }

    & .post-spacer {
      border-radius: 10px 0 0 0;
    }

    & label:has(input[type="checkbox"]) {
      & span.checkbox {
        border-color: var(--p_shaded);
      }
    }

    & label:has(input[type="checkbox"]:checked) {
      background-color: var(--border);
      & span.checkbox {
        border-color: var(--border);
      }
    }

    & label:hover:has(input[type="checkbox"]) {
      background-color: var(--border);
      & span.checkbox {
        border-color: var(--border);
      }
    }

    & label:hover {
      background-color: var(--border);
      border-color: var(--p_shaded);
      border-right-color: var(--p_deep);
    }

    & a {
      float: right;
      color: white;
      /* text-decoration: none; */
      /* padding-left: 0.3rem;
      padding-right: 0.3rem; */
    }

    & .spacer {
      margin-left: auto;
      margin-right: 0;
      /* border-left: 1px solid var(--p_deep); */
    }
  }

  & 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: var(--close);
        content: "✗";
        border-right: 1px solid var(--p_deep);
      }

      & a.hide:hover {
        background-color: var(--border);
      }

      & a.name {
        cursor: pointer;
      }

      & a.name:hover {
        background-color: var(--border);
      }

      span:before {
        content: " ";
      }
    }

    li.hide {
      display: none;
      background-color: var(--r_dim);

      & 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-top: 1px solid var(--dim-border);
      margin-right: 0;
      margin-left: 0;
    }

    & li:first-child {
      border-top: 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: 1.5rem;
    width: 100%;
    height: calc(30% - 1.5rem);
    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;
  display: inline-flex;

  left: 0;
  bottom: 0;

  width: 100%;
  height: 1.5rem;
  /* 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_shaded);
  text-shadow: 3px 3px 3px var(--p_deep);
  font-size: 85%;

  & .spacer {
    margin-left: auto;
    margin-right: 0;
    border-right: 1px solid var(--p_deep);
  }

  .options-container.left {
    & :first-child {
      border-left: none;
    }
  }

  .options-container.right {
    & :last-child {
      border-right: none;
    }
  }

  .options-container {
    display: flex;
    padding: 0;
    margin: 0;
    justify-content: center;
    text-align: center;
    /* padding: 0 0.5rem 0 0.5rem; */

    & label,
    a {
      padding: 0.3rem 0.5rem 0.2rem 0.5rem;
      border-right: 1px solid var(--p_deep);
    }

    & label:hover {
      background-color: var(--border);
      & span.radio,
      span.checkbox {
        border-color: var(--border) !important;
      }
    }

    & label:has(input[type="radio"], input[type="checkbox"]) {
      & span.radio,
      span.checkbox {
        border-color: var(--p_shaded);
      }
    }

    & label:has(input[type="radio"]:checked, input[type="checkbox"]:checked) {
      background-color: var(--border);
      & span.radio,
      span.checkbox {
        border-color: var(--border);
      }
    }

    & a {
      display: flex;
      align-content: center;
      align-items: center;

      color: whitesmoke;
      padding: 0 0.5rem 0 0.5rem;
      text-align: center;
    }

    .glyph-adjust.from-small.to-mid {
      font-size: 1.5rem;
    }
  }
}

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

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

#followlog-icon.opened:hover {
  color: var(--close);
}

#followlog-icon.opened {
  padding-top: 0.15rem;
}

#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%;
  min-width: 600px;
  height: 75%;
  outline: none;
}

dialog:has(div.popup-modal > span.title) {
  & .page-content {
    padding-top: 0.5rem;
  }
}

dialog:has(div.popup-modal.mini) {
  min-width: 500px;
  width: 30%;
  height: fit-content;
  overflow: visible;
}

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

  margin: 0;
  padding: 0;

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

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

  & span.title {
    display: inline-block;
    position: absolute;
    left: 1rem;
    top: 0.75rem;
    font-size: 85%;
    font-weight: bold;

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

  & 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(--close);
    border-color: var(--close);
    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%;

    scrollbar-width: none;
    overflow-wrap: break-word;
    overflow-y: auto;
    outline: none;

    & 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,
#tab-menu {
  & .setting-container {
    display: flex;
    flex-direction: column;
    flex-flow: row wrap;
    justify-content: space-between;
    user-select: none;

    & .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;
    }
  }
}

#help-page {
  & .section-container {
    & .note {
      font-weight: bold;
      font-style: italic;
      font-size: 85%;
      border-radius: 5px;
      color: var(--p_dark);
      background-color: var(--border);
      border: 1px solid var(--border);
      padding: 0.2rem;
      & code {
        font-size: smaller;
      }
    }
  }
}

#tab-menu {
  & div#filtered-names {
    display: none;
  }

  & div#filtered-names:has(ul > li) {
    display: inherit;
  }

  & div#filtered-names > ul {
    padding: 0;
    display: flex;
    flex-flow: wrap;
    justify-content: center;
    gap: 2px;

    & li {
      list-style-type: none;
    }
  }
}

#out-of-date {
  display: flex;
  flex-wrap: wrap;
  flex-direction: column;
  justify-items: center;
  position: absolute;
  left: 1rem;
  top: 1rem;
  background-color: var(--p_dim);
  border-radius: 5px;
  color: whitesmoke;
  text-shadow: 3px 3px 3px var(--p_deep);
  gap: 3px;
  padding: 0.5rem;
  border: 3px solid var(--p_shaded);
  user-select: none;
  text-align: center;

  & a {
    border-color: var(--p_bright);
    background-color: var(--p_bright);
  }

  & a:hover {
    border-color: var(--p_contrast);
    background-color: var(--p_contrast);
  }
}

html > body > div#editor > div#filewatch-container > ul#filewatch > li.hide {
  display: none;
}

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

.navbar-icon:hover {
  background-color: var(--border);
}

.clickable-button {
  background-color: var(--p_shaded);
  color: whitesmoke;

  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);
}

.clickable-button:hover {
  background-color: var(--border);
}

.progress-bar {
  position: absolute;
  left: 50%;
  bottom: 50%;
  width: 30%;
  background-color: var(--p_dim);
  border: 1px solid var(--border);
}

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