@import 'variables';
@import 'mixins';

.articleformcontainer {
  padding: 24px 0 96px;
}

.article-form-video-preview {
  text-align: center;
  padding-top: 60px;
  margin: auto;
  max-width: 880px;
  .article-form-video-image-url {
    padding-top: 15px;
    font-family: $monospace;
    input {
      padding: 3px;
      font-size: 1em;
      border-radius: 3px;
      border: 1px solid darken($light-medium-gray, 5%);
      border: var(
        --theme-container-border,
        1px solid darken($light-medium-gray, 5%)
      );
      width: 340px;
      margin: 10px;
      &[type='submit'] {
        padding: 3px 8px;
        border: 1px solid $green;
        border-radius: 100px;
        width: 200px;
      }
    }
  }
}

.articleform {
  margin: 0 auto;
  width: 97%;
  max-width: 860px;
  padding: 0px 6px;
  @include dev-card;
  position: relative;
  box-sizing: border-box;

  @media screen and (min-width: 500px) {
    padding: 0px 12px;
  }
  @media screen and (min-width: 600px) {
    width: calc(97% - 30px);
  }
  @media screen and (min-width: 800px) {
    width: calc(95% - 40px);
    padding: 0px 20px;
  }
  .container {
    border: 1px solid $light-medium-gray;
  }
  .help-guide-title {
    padding-top: 20px;
  }
}

.articleform__form {
  display: flex;
  flex-direction: column;
  margin-top: 1px;
}

.articleform__errors {
  background: $red;
  color: white;
  font-weight: bold;
  margin-top: 12px;
  border-radius: 3px;
  padding: 15px;
}

.articleform__orgsettings {
  padding: 0px;
  padding-left: 0px;
  margin: 20px 2px 0px;
  font-size: 16px;
  select {
    margin-left: 7px;
    vertical-align: middle;
  }
  @media screen and (min-width: 600px) {
    font-size: 18px;
    padding-left: 10px;
  }
}

.articleform__mainimage {
  text-align: center;
  width: 60%;
  border-radius: 8px;
  background: $light-gray;
  background: var(--body-bg);
  margin-top: 10px;
  cursor: pointer;
  @media screen and (min-width: 550px) {
    width: 40%;
  }
  @media screen and (min-width: 985px) {
    width: 30%;
  }
  img {
    width: 100%;
    height: calc(28vw - 42px);
    background: #fcfcfc;
    border-radius: 8px;
    @media screen and (min-width: 550px) {
      height: calc(16.8vw - 18px);
    }
    @media screen and (min-width: 985px) {
      height: 111px;
    }
    display: block;
  }
  &:hover {
    opacity: 0.8;
  }
  &.articleform__mainimagepreview {
    border-radius: 0px;
    border: 0px;
    margin-top: 0px;
    border-radius: 3px;
    width: 100%;
    cursor: default;
    img {
      width: 100%;
      height: calc(42vw - 44px);
      border-radius: 3px;
      @media screen and (min-width: 985px) {
        height: 355px;
      }
    }
    &:hover {
      opacity: 1;
    }
  }
}

.articleform__title {
  height: 26px;
  width: 99%;
  font-size: 17px;
  border: 0;
  padding: 20px 0px 15px;
  font-weight: 600;
  color: var(--body-color);
  resize: none;
  background: transparent;
  font-family: $monospace;
  @media screen and (min-width: 600px) {
    font-size: 29px;
    height: 50px;
  }
  &::placeholder {
    color: var(--form-placeholder-color);
  }
  &.articleform__titlepreview {
    margin-bottom: 0px;
    margin-bottom: 1px;
    @media screen and (min-width: 600px) {
      height: 43px;
      margin-bottom: 7px;
    }
  }
}

.articleform__titleTooLong {
  position: relative;
  &::before {
    content: 'Title Too Long';
    top: 5px;
    left: 5px;
    position: absolute;
    font-size: 0.8em;
    font-weight: bold;
  }
  .articleform__title {
    background: darken($red, 8%);
    border-radius: 3px;
  }
}

.articleform__detailfields {
  display: flex;
  flex-direction: row;
  position: relative;
}
.articleform__tagswrapper {
  display: inline-block;
  flex-grow: 1;
  float: left;
  padding-right: 15px;
  @media screen and (min-width: 500px) {
    padding-right: 0px;
  }
}

.articleform__tags {
  height: 40px;
  width: 100%;
  border-radius: 3px;
  padding: 8px 8px 7px;
  @media screen and (min-width: 500px) {
    width: 98%;
  }
  @media screen and (min-width: 600px) {
    height: 19px;
    border-radius: 100px;
    padding-left: 17px;
  }
  margin-left: -4px;
  resize: none;
  border: 0;
  font-size: 16px;
  font-family: $monospace;
  font-weight: bold;
  background: var(--form-bg);
  color: var(--body-color);
}

.articleform__tagsoptions {
  position: absolute;
  left: -4px;
  right: 3px;
  top: 50px;
  @media screen and (min-width: 600px) {
    top: 30px;
    left: 8px;
    right: 155px;
  }
  background: var(--card-bg);
  border: 1px solid var(--body-color);
  font-family: $monospace;
  z-index: 20;
}
.articleform__tagoptionrow {
  padding: 10px;
  font-weight: bold;
  cursor: pointer;
  position: relative;
  &:hover {
    background: var(--button-primary-bg-hover);
    color: var(--button-primary-color-hover);
  }
}

.articleform__tagsoptionsbottomrow {
  padding: 12px 10px 10px;
  font-weight: bold;
  cursor: pointer;
  position: relative;
  font-size: 0.7em;
  font-style: italic;
  border-top: 1px solid $medium-gray;
  color: var(--body-color);
}

.articleform__tagsoptionrulesbutton {
  position: absolute;
  right: 7px;
  top: 7px;
  border: 0;
  border-radius: 3px;
  background: var(--button-primary-bg);
  color: var(--button-primary-color);
  font-size: 0.8em;
  width: 130px;
  padding: 6px 0px;
}

.articleform__tagrules--inactive {
  display: none;
}

.articleform__tagrules--active {
  font-size: 0.76em;
  max-height: 270px;
  overflow: auto;
  border: 1px solid $medium-gray;
  border-radius: 3px;
  margin-top: 8px;
  padding: 0px 8px;
}

.articleform__tagoptionrow--active {
  background: var(--button-primary-bg);
  color: var(--button-primary-color);
}

.articleform__tagoptionsummary {
  color: var(--card-color-secondary);
  font-weight: 400;
}

.articleform__detailsButton {
  color: var(--button-secondary-color);
  background: var(--form-bg);
  border: 0px;
  border-radius: 300px;
  padding: 3px 18px;
  font-family: $helvetica-condensed;
  font-size: 14.4px;
  height: 34px;
  width: 60px;
  display: none;
  @media screen and (min-width: 600px) {
    display: inline-block;
  }
  margin-left: 25px;
  &:hover {
    background: var(--button-secondary-bg-hover);
  }
  img {
    width: 18px;
    height: 18px;
    vertical-align: -4px;
    display: inline-block;
    filter: var(--theme-social-icon-invert, invert(0));
  }
  &.articleform__detailsButton--moreconfig {
    margin-left: 5px;
    &.articleform__detailsButton--bottom {
      margin-left: 5px;
      width: 50px;
    }
  }
  &.articleform__detailsButton--bottom {
    margin-left: 2px;
    margin-top: 10px;
    margin-bottom: 8px;
    display: inline-block;
    padding: 2px 15px;
    border-radius: 3px;
    width: 110px;
    @media screen and (min-width: 600px) {
      margin-left: -5px;
      display: none;
    }
    img {
      margin-right: 0.3rem;
    }
  }
}

.articleform__form--v1 {
  .articleform__detailsButton--bottom {
    @media screen and (min-width: 600px) {
      display: inline-block;
    }
  }
}

.articleform__description {
  height: 30px;
}

.articleform__body {
  min-height: calc(80vh - 370px);
  width: 98%;
  border: 0;
  font-size: 15px;
  resize: none;
  padding: 20px 6px;
  font-family: $monospace;
  // scrollbars not needed because the preact-textarea-autosize package
  // automatically resizes the article form
  overflow: hidden;
  background: var(--card-bg);
  color: var(--card-color);
  @media screen and (min-width: 600px) {
    font-size: 18px;
    min-height: calc(85vh - 280px);
  }
  &::placeholder {
    color: var(--form-placeholder-color);
  }
}
.articleform__form--v1 {
  .articleform__body {
    min-height: calc(90vh - 370px);
    @media screen and (min-width: 600px) {
      font-size: 18px;
      min-height: calc(95vh - 280px);
    }
  }
}

.articleform__buttons {
  padding-bottom: 5px;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  position: fixed;
  flex-wrap: wrap-reverse;
  bottom: 0px;
  left: 0;
  right: 0;
  background: var(--card-bg);
  z-index: 20;
  &::after {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    width: 100%;
    background: var(--body-color);
    opacity: 0.1;
    content: '';
    height: 1px;
  }

  * {
    margin: 4px calc(0.7vw);
  }

  span {
    display: -webkit-inline-flex;
    display: -ms-inline-flexbox;
    display: inline-flex;
    flex-direction: column;
    max-width: 90%;
    width: 290px;
    @media screen and (min-width: 430px) {
      max-width: 90%;
      width: auto;
    }
    p {
      display: inline-block;
      margin-bottom: 2px;
      font-size: 11px;
      color: var(--card-color-secondary);
      font-style: italic;
      margin-left: -2px;
    }
    button {
      margin-top: 0px;
      margin-left: -1px;
    }
    .hidden {
      visibility: 'hidden';
    }
    .clear-button {
      // in part from https://css-tricks.com/overriding-default-button-styles/
      display: inline-block;
      border: none;
      margin: 0;
      text-decoration: none;
      background: none;
      border: none;
      box-shadow: none;
      color: $medium-gray;
      color: var(--card-color-secondary);
      font-family: sans-serif;
      font-size: 1rem;
      cursor: pointer;
      text-align: center;
      transition: background 250ms ease-in-out, transform 150ms ease;
      -webkit-appearance: none;
      -moz-appearance: none;
      text-decoration: underline;
      margin: 0px;
      padding: 0px;
      cursor: pointer;
      font-size: 12.5px;
      font-style: italic;
      display: inline;
      width: fit-content;
    }
    .clear-button:hover {
      background: none;
      color: #666;
    }
    .clear-button:focus {
      outline: 1px solid #fff;
      outline-offset: -4px;
    }

    .clear-button:active {
      transform: scale(0.99);
    }
  }
  button,
  a {
    margin-top: 5px;
    margin-bottom: 5px;
    cursor: pointer;
    background: var(--button-secondary-bg);
    font-family: $helvetica-condensed;
    font-size: 14.5px;
    border: 0px;
    border-radius: 113px;
    padding: 6px 13px;
    display: inline-block;
    text-align: center;
    color: var(--button-secondary-color);
    white-space: nowrap;
    @media screen and (min-width: 430px) {
      margin-top: 23px;
      margin-bottom: 8px;
    }
    &:hover {
      background: var(--button-secondary-bg-hover);
    }
    &:focus {
      background: var(--button-secondary-bg-hover);
      outline: 0;
    }
    &.active {
      background: $green;
      color: $black;
    }
    &.previewbutt {
      min-width: 95px;
    }
    &.articleform__buttons--small {
      width: 45px;
      border: white;
    }
    &.articleform__buttons--publish {
      background: $bold-blue;
      color: white;
      &:hover {
        opacity: 0.9;
      }
    }
    @media screen and (min-width: 630px) {
      font-size: 15px;
    }
  }
}

.articleform__overlay {
  position: absolute;
  top: 0px;
  left: 0;
  right: 0;
  bottom: 0;
  background: $dark-gray;
  color: white;
  padding: 4%;
  text-align: center;
  border-radius: 3px;
  overflow-y: scroll;
  clipboard-copy {
    cursor: pointer;
    img {
      display: inline-block;
      max-width: 24px;
      margin: -10px 5px;
      position: relative;
      filter: invert(100%);
    }
    input {
      cursor: pointer;
    }

    #image-markdown-copy-link-input {
      margin-left: 24px;
    }
    #image-markdown-copy-link-announcer {
      display: block;
      padding-top: 10px;

      &[hidden] {
        display: none;
      }
    }
  }
  h2 {
    color: $green;
    font-size: 1.9em;
    font-family: $helvetica-condensed;
  }
  p {
    font-size: 0.8em;
    padding: 20px 0px;
    code {
      background: $black;
      padding: 1px 4px;
      border-radius: 3px;
    }
  }
  input[type='file'] {
    width: 90%;
    background: $black;
    padding: 20px;
    border-radius: 3px;
    margin: 20px auto;
    display: block;
    cursor: pointer;
  }
  input[type='text'],
  textarea {
    width: calc(80% - 20px);
    padding: 10px 20px;
    border-radius: 3px;
    margin: 5px auto 0px;
    display: inline-block;
    border: 0px;
    font-size: 1em;
    @media screen and (min-width: 600px) {
      width: calc(100% - 270px);
      border-top-left-radius: 0px;
      border-bottom-left-radius: 0px;
      margin: 20px auto 0px;
    }
  }
  label {
    margin-top: 20px;
    display: inline-block;
    width: 80%;
    font-weight: bold;
    color: white;
    font-size: 1em;
    background: $medium-gray;
    padding: 10px;
    border-radius: 3px;
    @media screen and (min-width: 600px) {
      width: 180px;
      border-top-right-radius: 0px;
      border-bottom-right-radius: 0px;
    }
  }
  small {
    display: block;
    font-size: 0.8em;
    color: $light-medium-gray;
    text-align: left;
    width: 80%;
    margin: 7px auto;
    font-style: oblique;
    @media screen and (min-width: 600px) {
      width: calc(100% - 40px);
    }
    button {
      margin-left: 5px;
      background: $bold-blue;
    }
  }
  .articleform__exitbutton {
    position: absolute;
    color: white;
    font-size: 37px;
    font-weight: bold;
    left: 1%;
    top: 0%;
    background: transparent;
    border: 0px;
    cursor: pointer;
  }
  button {
    background: $red;
    color: white;
    border: 0px;
    padding: 4px 10px;
    font-size: 14px;
    border-radius: 3px;
    font-weight: bold;
  }
  .articleform__donebutton {
    display: block;
    font-size: 22px;
    background: $green;
    color: $black;
    padding: 10px 40px;
    margin: 20px auto;
  }
  img {
    display: block;
    margin: 10px auto;
    width: 200px;
    height: 84px;
    border-radius: 8px;
  }
}

.articleform__notice {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 25px 0px;
  color: white;
  background: $green;
  text-align: center;
  font-size: 2em;
  font-weight: bold;
  z-index: 50;
  &.articleform__notice--draft {
    background: $yellow;
    color: $black;
  }
}

.articleform_titlepreviewsmall {
  font-size: calc(1.9vw + 22px) !important;
  @media screen and (min-width: 1600px) {
    font-size: 50px !important;
  }
}

.articleform__uploaderror {
  color: darken($red, 8%);
  font-size: 0.8em;
}
