// Customise area

// email templates

.content-editor {
  min-height: 500px;
  float: left;
  width: 54.054%;
  margin-left: 1.8018%;
  p.description {
    color: $primary;
  }
  .controls {
    margin-top: 10px;
  }
  textarea.plain {
    width: 98%;
    height: 200px;
  }
  .d-editor-input {
    width: 98%;
    height: 200px;
  }
  .ace-wrapper {
    position: relative;
    height: 600px;
    width: 100%;
  }
  .ace_editor {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
  }
}

.email-template {
  input {
    width: 100%;
  }
  label {
    font-weight: bold;
  }
}

.create-theme-modal {
  div.input {
    margin-bottom: 12px;
    .label {
      width: 20%;
      display: inline-block;
    }
  }

  .error {
    color: $danger;
  }
}

.admin-customize.admin-customize-themes {
  .admin-container {
    padding: 0;
  }
  .error-message {
    margin-top: 5px;
    margin-bottom: 5px;
    .fa {
      color: $danger;
    }
  }
  .raw-error {
    background-color: $primary-very-low;
    padding: 5px;
  }
}

.admin-customize {
  h1 {
    margin-bottom: 10px;
    input {
      margin-bottom: 0;
      font-size: $font-down-2;
    }
  }

  .field-error {
    margin-top: 10px;
    margin-bottom: 10px;
    background-color: $quaternary-low;
    padding: 5px;
  }

  .admin-container {
    padding-left: 10px;
    padding-right: 10px;
  }
  .admin-footer {
    margin-top: 20px;
  }
  .color-schemes li {
    .d-icon {
      margin-right: 0.25em;
      color: $primary-medium;
    }
  }
  .show-current-style {
    display: inline-block;
    vertical-align: top;

    .btn {
      line-height: $line-height-medium; // Temporary button-height fix
    }

    .title {
      font-size: $font-up-4;
      font-weight: bold;
      margin-bottom: 10px;
      a {
        font-size: $font-down-2;
      }
      .btn {
        line-height: $line-height-small;
      }
    }

    .theme-description {
      display: block;
      margin: 10px 0;
    }

    .metadata {
      .authors,
      .version {
        display: block;

        .heading {
          font-weight: bold;
        }
      }
    }

    div.remote-url {
      font-size: $font-down-1;
      margin-bottom: 7px;
    }

    a.remote-url,
    a.about-url,
    a.license-url {
      display: inline-block;
      margin-right: 10px;
      .d-icon {
        margin-left: 5px;
      }
    }

    .mini-title {
      font-size: $font-up-1;
      font-weight: bold;
      margin-bottom: 7px;
    }
    .control-unit {
      margin-bottom: 25px;
      margin-top: 15px;
    }
    .control {
      margin-bottom: 10px;
    }
    .description {
      margin-bottom: 12px;
    }
  }
  .add-component-button {
    vertical-align: middle;
  }
  .themes-list {
    display: inline-block;
    .create-actions {
      margin-top: 0.5em;
    }
  }

  .themes-list-header {
    width: 100%;
    border-bottom: 1px solid $primary-low;
    border-top: 1px solid $primary-low;
    border-right: 1px solid $primary-low;
    display: flex;

    .tab {
      padding: 1em;
      width: 50%;
      box-sizing: border-box;
      text-align: center;

      &.active {
        font-weight: 700;
      }

      &:last-child {
        border-left: 1px solid $primary-low;
      }
    }
  }

  .themes-list-container {
    overflow-y: auto;
    box-sizing: content-box;
    max-height: 60vh;
    @media screen and (max-height: 1000px) {
      max-height: 50vh;
    }
    @media screen and (max-height: 800px) {
      max-height: 40vh;
    }
    border-right: 1px solid $primary-low;
    border-bottom: 1px solid $primary-low;
    width: 100%;

    .themes-list-item:last-child {
      border-bottom: none;
    }
    .themes-list-item {
      color: $primary;
      border-bottom: 1px solid $primary-low;
      display: flex;
      border-left: 1px solid $primary-low;

      &.inactive-indicator {
        border-right: 0;
        border-left: 0;
        font-weight: bold;
        color: $primary-medium;

        span.empty {
          padding-left: 5px;
          padding-top: 15px;
        }
      }
      &:not(.inactive-indicator):not(.selected):hover {
        background-color: $primary-very-low;
        .component {
          border-color: $primary-low-mid;
        }
      }

      &.selected {
        color: $secondary;
        background-color: $tertiary;
        .components-list {
          color: $secondary;
        }
        .fa {
          color: inherit;
        }
      }
      &:not(.selected) {
        .broken-indicator {
          color: $danger;
        }
        .fa {
          opacity: 0.7;
        }
        .default-indicator {
          color: $success;
        }
      }

      .light-grey-icon {
        color: $primary-medium;
      }

      .info {
        overflow: hidden;
        display: flex;
        font-weight: bold;
        font-size: $font-up-1;

        .icons {
          margin-left: auto;
        }
      }

      .components-list {
        margin-top: 5px;
        display: inline-block;
        font-size: $font-down-1;
        align-items: baseline;
        color: $primary-high;

        .others-count,
        .others-count:hover {
          color: $primary-high;
          text-decoration: underline;
        }
      }

      .inner-wrapper {
        padding: 10px;
        cursor: pointer;
      }

      span.empty {
        padding: 3px 10px 3px 10px;
      }

      .inner-wrapper,
      span.empty {
        color: inherit;
        width: 100%;
      }
    }
  }

  .theme.settings {
    .theme-setting {
      min-height: 35px;
    }
    .theme-translation {
      padding-bottom: 0;
      margin-top: 18px;
      min-height: 35px;
    }
    .setting-label {
      width: 25%;
      word-wrap: break-word;
      h3 {
        margin-top: 0;
        margin-bottom: 0.5rem;
      }
    }
  }

  .current-style.maximized {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: z("fullscreen");
    background-color: white;
    width: 100%;
    padding: 0;
    margin: 0;
    .wrapper {
      position: absolute;
      top: 20px;
      bottom: 10px;
      left: 20px;
      right: 20px;
    }
  }

  .content-list,
  .current-style {
    float: left;
  }
  .content-list ul {
    margin-bottom: 10px;
  }
  .current-style {
    width: 100%;

    .admin-container {
      margin: 0;
    }

    .edit-main-nav .nav-pills > li a.active {
      background-color: $quaternary;
      color: $secondary;
    }

    .edit-main-nav ul {
      padding-bottom: 0;
    }

    .nav-pills {
      li {
        margin-right: 0;
        display: flex;

        &.spacer {
          flex-grow: 1;
        }

        &:last-of-type > a {
          margin-right: 0;
        }

        a.no-text .d-icon {
          margin-right: 0;
        }

        label {
          padding: 6px 12px;
          margin-bottom: 0;
        }

        a.active {
          background: $primary-medium;
          color: $secondary;
        }

        a.blank:not(.active) {
          color: $primary-medium;
        }

        input {
          margin-bottom: 0;
          margin-left: 6px;
        }

        button {
          margin-right: 0;
        }
      }
    }

    .ace-wrapper {
      position: relative;
      height: 600px;
      width: 100%;
    }

    &.maximized {
      .admin-container {
        position: absolute;
        bottom: 50px;
        top: 80px;
        width: 100%;
      }
      .admin-footer {
        position: absolute;
        bottom: 10px;
      }
      .ace-wrapper {
        height: calc(100vh - 200px);
      }
    }

    .ace_editor {
      position: absolute;
      left: 0;
      right: 0;
      top: 0;
      bottom: 0;
    }

    .status-actions {
      float: right;
      margin-top: 7px;
      span {
        margin-right: 10px;
      }
    }

    .buttons {
      float: left;
      width: 200px;
      .saving {
        padding: 5px 0 0 0;
        margin-left: 10px;
        width: 80px;
        color: $primary;
      }
    }
  }
  .color-scheme {
    .controls {
      button,
      a {
        margin-right: 10px;
      }
    }
  }
  .colors {
    thead th {
      border: none;
    }
    td.hex {
      width: 160px;
    }
    td.actions {
      width: 200px;
    }
    .hex-input {
      width: 80px;
      margin-bottom: 0;
      margin-right: 6px;
    }
    .hex {
      text-align: center;
    }
    .color-input {
      display: flex;
    }
    h3 {
      margin: 0;
    }
    .description {
      margin: 0.15em 0 0;
      color: $primary-high;
      font-size: $font-down-1;
      line-height: $line-height-medium;
    }

    .invalid .hex input {
      background-color: white;
      color: black;
      border-color: $danger;
    }
  }

  .status-message {
    display: block;
    font-size: $font-down-1;
    margin-top: 8px;
  }

  .removable-list {
    list-style: none;
    margin-left: 0;
    li {
      &.disabled-child {
        .child-link {
          color: $primary-medium;
          &:hover {
            text-decoration: underline;
          }
        }
      }
      .btn {
        margin-left: 5px;
      }
      display: table-row;
      .col.child-link {
        padding-right: 10px;
        padding-bottom: 10px;
        min-width: 80px;
      }
      .col {
        display: table-cell;
      }
    }
  }
}

.add-upload-modal {
  input[type="file"] {
    display: block;
    margin-bottom: 0.25em;
    + label {
      color: $primary-medium;
    }
  }
  label {
    display: inline-block;
  }
}

#custom_emoji {
  width: 100%;
}

.modal-body .inputs .branch {
  margin-top: 10px;
}

.modal-body .inputs .check-private {
  margin-top: 10px;
  label {
    padding-left: 0;
  }
  label input {
    width: auto;
    margin: 3px 0;
  }

  .public-key {
    margin-top: 10px;
    textarea {
      cursor: auto;
      height: 150px;
    }
  }
}

// Permalinks
.permalinks {
  .url,
  .topic,
  .category,
  .external_url,
  .post {
    @include ellipsis;
    max-width: 100px;
    @include breakpoint(tablet) {
      max-width: 100%;
    }
  }

  &.grid tr.admin-list-item {
    grid-template-columns: unset;
  }
}

.permalink-search {
  text-align: left;
  @include breakpoint(tablet, min-width) {
    text-align: right;
  }
}

.permalink-form {
  align-items: flex-start;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  @include breakpoint(tablet, min-width) {
    align-items: center;
    flex-direction: row;
  }

  .select-kit {
    width: 200px;
  }
  input {
    margin: 5px 0;
    @include breakpoint(tablet, min-width) {
      margin: 0 5px;
    }
  }
}

.permalink-title {
  margin-bottom: 10px;
}

.permalink-description {
  color: $primary-medium;
}

// embedding
.embeddable-hosts {
  margin-bottom: 2em;
  table.grid {
    margin-bottom: 1em;
    tr td {
      word-wrap: break-word;
      max-width: 25vw;
      align-self: start;
    }
    td.controls {
      min-width: 6em;
    }
    .select-kit.combo-box.category-chooser {
      width: calc(100% - 10px);
    }
  }
  @media screen and (max-width: 880px) {
    table.grid {
      thead {
        display: none;
      }
      div.label {
        display: block;
        font-size: $font-down-1;
        color: $primary-medium;
      }
      td.controls,
      td.editing-controls {
        align-self: end;
      }
      tr {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
      }
    }
  }

  @media screen and (max-width: 580px) {
    table.grid {
      tr td.editing-input {
        grid-column-start: 1;
        grid-column-end: 4;
        max-width: 100%;
        input {
          width: calc(100% - 20px);
        }
      }
      td.editing-controls {
        margin-top: 1em;
        max-width: 100%;
      }
    }
  }

  @include breakpoint(mobile-medium) {
    table.grid tr {
      grid-template-columns: repeat(2, 1fr);
      td.controls {
        text-align: left;
      }
    }
  }
}

.embedding-secondary {
  h3 {
    margin: 1em 0;
  }
  margin-bottom: 2em;
  .embed-setting {
    input[type="text"] {
      width: 50%;
    }
    margin: 0.75em 0;
  }
  p.description {
    color: $primary-medium;
    margin-bottom: 1em;
    max-width: 700px;
  }
}

.embedding td input {
  margin-bottom: 0;
}

.user-fields {
  h2 {
    margin-bottom: 10px;
  }
  .user-field {
    padding: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid $primary-low;
    .form-display {
      width: 25%;
      display: inline-block;
      float: left;
    }
    .form-element,
    .form-element-desc {
      float: left;
      min-height: 30px;
      padding: 0.25em 0;
      &.input-area {
        width: 75%;
        .value-list,
        .select-kit,
        input[type="text"] {
          width: 50%;
        }

        .value-list {
          .select-kit {
            width: 100%;
          }
        }
      }
      &.label-area {
        width: 25%;
        label {
          margin: 0.5em 1em 0 0;
          text-align: right;
          font-weight: bold;
        }
      }
    }
    .controls {
      float: right;
      text-align: right;
    }
    .clearfix {
      clear: both;
    }
  }
}

.reseed-modal {
  .options-group-title {
    font-size: $font-up-2;
    font-weight: bold;
    margin: 8px 0;
  }

  .option {
    margin-left: 1em;
  }
}

.robots-txt-edit {
  div.overridden {
    background: $highlight-medium;
    padding: 7px;
    margin-bottom: 7px;
  }
  .robots-txt-input {
    width: 100%;
    box-sizing: border-box;
    height: 55vh;
  }
}

.admin-customize-email-templates {
  .email-template,
  .controls {
    margin-top: 1em;
  }

  .d-editor {
    height: 50vh;
  }
}

.admin-customize-email-style {
  .ace-wrapper {
    position: relative;
    width: 100%;
    height: 400px;
    .ace_editor {
      position: absolute;
      left: 0;
      right: 0;
      top: 0;
      bottom: 0;
    }
  }
}
