@import '../../../core/Variables';

.builder-config-section {
  padding: 0 25px 0 15px;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  text-align: center;

  @media (max-width: @screen-md) {
    padding: 0 10px;
  }

  &.centered {
    justify-content: center;
  }
  &.larger {
    flex: 2 1 0;
  }

  &.no-spread {
    flex: 0 1 auto;
    max-width: 450px;

    &.larger {
      flex: 0 1 650px;
      max-width: none;
    }
  }

  & + & {
    border-left: 1px solid #E8E8E8;
  }

  &.preview-config-section {
    @media (max-width: @screen-md) {
      display: none;
    }
  }

  &.size-image {
    .section-content.horizontal {
      .config-item {
        justify-content: flex-start;
        flex: 1 1 30%;


        &[data-value="large"] {
          flex-basis: 40%;
        }

        .config-image {
          margin-bottom: 12px;
        }
      }
    }
  }

  .title {
     margin-top: 0;
     margin-bottom: 12px;
     flex: 0 1 auto;
  }

  .section-content {
    margin: 0;
    display: flex;

    .config-item:not(.preview-item) {
      cursor: pointer;
    }

    .config-item.preview-item.horizontal {
      justify-content: center;
      position: relative;

      .responsive-preview-title {
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        z-index: 0;
      }
    }

    &.centered {
      justify-content: center;
    }

    &.vertical-list {
      flex-direction: column;

      .config-item {
        padding: 1px 5px;
        font-size: inherit;
        line-height: 150%;

        &:nth-child(n+2) {
          margin-top: 3px;
        }
      }

      &.checkmarks {
        .config-item {
          background: transparent;
          padding: 0;
        }

        .check {
          cursor: pointer;
          white-space: nowrap;
        }

        .text {
          white-space: nowrap;
        }
      }
    }

    &.two-pane {
      align-items: center;
      margin: auto;
    }

    &.content-hidden {
      display: none;
    }

    &[name=slides] {
      display: none;
    }

    &.no-slides {
      display: none;
    }

    &.fit-fill {
      flex: 4 1 auto;
      justify-content: space-between;

      .crop-check {
          padding-left: 5px;
          display: flex;

        .check {
          margin-bottom: 0;
          flex: 50;
          text-align: left;
          padding-left: 8px;
        }
      }
    }

    &.crop-tall {
      font-size: 12px;

      &.disabled {
        opacity: 0.5;
        pointer-events: none;
      }

      .check {
        margin-bottom: -10px;
        display: flex;
        align-items: center;
        line-height: 1.3;
        text-align: left;

        input {
          margin-top: 0;
          margin-right: 6px;
          min-width: 11px;
        }
      }
    }

    &[data-mode="fit"], &[data-mode="fill"] {
      flex: 1 0 auto;
    }

    &.fit-content-container {
      justify-content: center;
    }
  }

  ul.section-content {
    flex: 1 1 auto;
    list-style-type: none;
    padding-left: 0;
  }

  select.section-content {
    flex: 0 1 40px;
  }

  .aside {
    flex: 0 1 auto;
    font-size: 13px;
    font-style: italic;
    line-height: 1.3;
    margin-top: 7px;
  }

  /* SIZE PANEL */
  .section-content.horizontal {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;

    &.preview-section {
      justify-content: flex-start;
      flex-wrap: nowrap;
      margin-left: 30px;
    }

    &.section-appearance-container {
      flex-wrap: nowrap;
    }

    .config-item {
      display: flex;
      flex: 0 1 auto;
      align-items: center;
      flex-direction: column;
      justify-content: space-around;
      position: relative;
    }

    .config-item + .config-item {
      padding-left: 10px;
    }

    .config-image {
      flex: 0 1 auto;
      height: auto;
    }

    .config-label {
      padding: 1px 10px;
      transition: all 0.25s ease; // less harsh state change
    }

    .config-item {
      &:hover .config-label {
        background: @gray-dark;
        color: #fff;
      }
      &:active .config-label {
        background: #000;
        color: #fff;
      }

      &.selected {
        .config-label {
          background: @gray-base;
          color: #fff;
        }

        .check-mark {
          display: block;
        }
      }

      .check-mark {
        display: none;
        position: absolute;
        z-index: 0;
        right: -12px;
        font-size: 2.0em;
        top: -15px;
        color: #196fa6;
        text-shadow: -1px 0px 2px #ffffff;
      }
    }
  }

  .section-content.button {
    flex-direction: column;
    justify-content: space-around;

    .button {
      padding: 15px;
      box-shadow: 0px 0px 11px 4px #CCC;
      cursor: pointer;
      border-radius: 2px;
      text-align: center;
      font-size: 14px;
      border: none;
      line-height: inherit;
      white-space: normal;

      &:nth-child(n+2) {
        margin-top: 10px;
      }
    }

    .config-icon {
      margin-right: 2px;
    }

    .whisper {
      font-size: 13px;
    }

    .image-preview {
      display: none;
      background-image: url('https://placehold.it/600x400');
      flex: 1 1 auto;
      background-position: center center;
      background-size: cover;
    }

    .overlay {
      background: rgba(0,0,0,0.5);
      color: white;
      display: flex;
      justify-content: flex-end;

      .icon {
        cursor: pointer;
      }
    }

    &.image-show .image-preview {
      display: block;
    }

    &.image-show .button {
      display: none;
    }
  }

  .responsive-frame-container {
    position: relative;

    .responsive-backing {
      position: absolute;
      background: #CCC;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      z-index: 0;

      &.backing-vertical {
        top: 10%;
        bottom: 10%;
        left: 7%;
        right: 7%;
      }

      &.backing-horizontal {
        left: 10%;
        right: 10%;
        top: 7%;
        bottom: 7%;
      }
    }

    .responsive-preview {
      background-color: #FFF;
      background-size: cover;
      background-repeat: no-repeat;
      background-position: 50% 50%;
      position: absolute;
      z-index: 1;

      &.preview-horizontal {
        top: 8%;
        left: 11%;
        width: 78%;
        height: 84%;

        &.preview-title {
          top: 50%;
          height: 53%;
          transform: translateY(-50%);
        }
      }
      &.preview-vertical {
        left: 8%;
        top: 11%;
        height: 78%;
        width: 84%;

        &.preview-title {
          top: 50%;
          height: 30%;
          transform: translateY(-50%);
        }
      }
    }

    .responsive-frame {
      max-width: 100%;
      position: relative;
      z-index: 2;

      &.frame-horizontal {
        width: 200px;
        height: auto;
      }

      &.frame-vertical {
        width: 105px;
        height: auto;
      }
    }
  }

  &.section-appearance {
    .title {
      margin-bottom: 0;
    }

    .section-content.horizontal .config-item + .config-item {
      margin-left: 5%;
    }

    .section-content.horizontal {
      .config-item[data-type="style"] {
        max-width: 21%;
      }

      .config-image {
        max-width: 100%;
      }
    }
  }
}

// this probably isn't the best place for this,
// but it's the same style for webmap and webscene...
.webmap-name,
.webscene-name {
  width: 96%;
  padding-bottom: 5px;
  border-bottom: 1px solid #ccc;
  margin: 0 10px 15px;
  font-size: 1.5em;
  flex: 0 0 auto;

  @media (max-width: @screen-md) {
    font-size: 1.2em;
  }
}

.alt-text-container {
  width: 96%;
  padding: 15px 0 0 0;
  border-top: 1px solid #ccc;
  margin: 15px 10px 0 10px;
  display: flex;
  // flex: 0 0 auto;

  @media (max-width: @screen-md) {
    font-size: 1.2em;
  }
}

.alt-text-icon {
  display: flex;
  margin: 12px 5px;
}

.alt-text-text {
  display: flex;
  padding-left: 10px;
  width: 100%;
  resize: vertical;
  min-height: 50px;
  max-height: 100px;
  line-height: 150%;
  font-size: 14px;
}

.alt-text-text::placeholder {
  font-style: italic;
  color: darkgray;
}


// screwy stuff happening with flex layout in webmap-name,
// but not webscene, so adjusting...
.webscene-name {
  padding-bottom: 15px;
}

.overview-thumbnail {
  cursor: crosshair;
  max-height: 250px;
  max-width: 250px;
  -webkit-user-drag: none;

  @media (max-width: 1120px) {
    max-width: 220px;
  }
}

.safari-specific {
  @media (max-width: @screen-md) {
    max-width: 172px;
  }

  .overview-thumbnail {
    max-width: 100%;
  }
}

.crop-info {
  color: #666;
  font-size: 1.8rem;
  margin-top: 5px;
  flex: 1;
}

.tall-crop-info {
  color: #666;
  font-size: 1.8rem;
  padding-right: 8px;
  margin-top: 12px;
}

.content-pane.overview-thumbnail-pane {
  position: relative;

  .overview-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    border-radius: 20px;
    background-color: #005e95;
    transform: translate(-50%, -50%);
    border: 2px solid white;
    cursor: move;

    &:before {
      content: '';
      width: 8px;
      height: 8px;
      background: white;
      position: absolute;
      top: 50%;
      left: 50%;
      border-radius: 10px;
      transform: translate(-50%, -50%);
    }
  }
}

.content-pane.fit-content {
  display: flex;
  align-items: center;

  .fit-palette {
    list-style-type: none;
    padding-left: 0;
    display: flex;
    flex-wrap: wrap;
    max-width: 112px;

    @media (max-width: 1120px) {
      max-width: 88px;
    }
  }

  .fit-palette-item {
    width: 30px;
    height: 30px;
    background: black;
    margin: 0 8px 8px 0;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0px 0px 2px 0px #666;

    &.palette-selected {
      border: 2px solid white;
      box-shadow: 0 0 0 3px black;
    }

    &:nth-child(3n) {
      margin-right: 0;
    }

    &:nth-child(n+6) {
      margin-bottom: 0;
    }

    @media (max-width: 1120px) {
      width: 20px;
      height: 20px;
      margin: 0 5px 5px 0;
    }
  }

  .fit-color-picker {
    display: flex;
    flex-direction: column;
    position: relative;

    &.not-alone {
      padding: 20px 0 20px 25px;
      margin-left: 25px;
      border-left: 1px solid #E8E8E8;

      @media (max-width: 1120px) {
        padding-left: 20px;
        margin-left: 20px;
      }
    }

    .color-picker-icons {
      display: flex;
      align-items: flex-end;
      position: relative;
      cursor: pointer;
    }

    .fit-brush {
      font-size: 40px;
    }

    .fit-down-arrow {
      position: absolute;
      bottom: 0;
      right: 0;
      z-index: 0;
    }

    .fit-color-picker-color {
      height: 15px;
      margin-top: 4px;
      box-shadow: 0 0 1px 0 #444;
    }

    .sp-container {
      top: auto !important;
      left: auto !important;
      bottom: 0 !important;
      right: 75% !important;
    }
  }
}

.content-pane.fit-loading {
  flex: 1 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;

  .fit-loading-icon {
    width: 40px;
    height: 47px;
    background-size: 40px 47px;
    margin: 0;
  }
}

.edit-media-icons {
  position: relative;
  display: inline-block;
  vertical-align: middle;
}

.icon-image,
.icon-globe,
.icon-map {
  position: relative;
  display: inline-block;
  font-size: 1.3em;
}
