@import "form-settings/conditional";
@import "form-settings/post-submission";

.eacf7-form-settings {
  margin-top: 30px;
  border: 1px solid #ddd;
  background: rgba(255, 255, 255, 1);

  * {
    box-sizing: border-box;
  }

  &-header {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    border-bottom: 1px solid #ddd;
    align-items: center;

    .header-logo {
      display: flex;
      gap: 12px;
      align-items: center;

      img {
        max-width: 100%;
        width: 180px;
      }

      h2 {
        padding: 0 !important;
        margin: 0 !important;
        font-size: 18px !important;
        font-weight: 600;
        color: rgba(33, 33, 33, 1);
      }

      p {
        margin: 0;
        font-size: 16px;
        line-height: 22px;
        color: rgba(77, 77, 77, 1);
        font-style: italic;
      }
    }

    .header-actions {
      display: flex;
      gap: 10px;

      a {
        img {
          width: 20px;
          margin-right: 7px;
        }

        &.upgrade-now-btn {
          border-color: #ff8000;
          color: #ff8000;
          background: #fff;

          &:hover {
            background: #F4C430;
            border-color: #F4C430;
            color: #fff;
          }
        }

        &.documentation-btn {
          &:hover {
            img {
              filter: brightness(0) invert(1);
            }
          }
        }
      }
    }
  }

  &-main {
    display: flex;
  }

  &-sidebar {
    width: 250px;
    border-right: 1px solid #ddd;

    .sidebar-item {
      padding: 12px;
      cursor: pointer;
      font-size: 1rem;
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      margin-bottom: 0;

      img {
        width: 22px;
        height: 22px;
        margin-right: 7px;
      }

      &:last-child {
        border-bottom: none;
        margin-bottom: 0;
      }

      &:hover,
      &.active {
        background: rgba(30, 98, 185, 1);
        color: #fff;

        img {
          filter: brightness(0) invert(1);
        }
      }

      .integrations-items {
        width: 100%;
        display: flex;
        flex-direction: column;
        background: #fff;
        margin-top: 12px;
        border-radius: 5px;
        border: 1px solid #ccc;

        .integration-item {
          cursor: pointer;
          padding: 8px 10px;
          transition: all 0.3s ease-in-out;
          margin-bottom: 3px;
          display: flex;
          align-items: center;

          img {
            margin-right: 7px;
            filter: grayscale(1);
            width: 20px;
          }

          &-status {
            margin-left: auto;
            font-size: 12px;
            padding: 4px 7px;
            border-radius: 5px;
            line-height: normal;

            &.disabled {
              background: #f5f5f5;
              color: #999;
            }

            &.active {
              background: rgba($eacf7_color, 0.875);
              color: #fff;
            }
          }

          &.active,
          &:hover {
            color: $eacf7_color;
            background: rgba($eacf7_color, 0.1);

            img {
              filter: none;
            }
          }
        }
      }

      .eacf7-pro-icon{
        margin-left: auto;
      }

    }
  }

  &-content {
    background: rgba(245, 246, 250, 1);
    flex: 1;
    padding: 20px;

    .settings-content {
      .integrations-empty {
        background: #fff;
        padding: 30px 35px;
        border-radius: 10px;
        border: 1px solid #ddd;
        max-width: 450px;
        margin: 60px auto 0;
        text-align: center;

        img {
          margin-bottom: 35px;
          max-width: 100%;
          width: 150px;
        }

        h3 {
          color: #212121;
          font-size: 20px;
          font-weight: 500;
          margin-top: 0;
          margin-bottom: 15px;
        }

        p {
          font-size: 15px;
          color: #4d4d4d;
          margin-bottom: 30px;
        }

        a {
          background: #1e62b9;
          color: #fff;
          font-size: 15px;
          font-weight: 500;
          line-height: 1.2;
          border-radius: 5px;
          padding: 10px 16px;
        }
      }
    }

    .settings-field {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      margin-bottom: 15px;
      background: #fff;
      border-radius: 10px;
      padding: 20px 20px;
      border: 1px solid #eee;

      .pro-feature {
          opacity: 0.5;
      }

      &-label {
        width: 180px;
        font-size: 0.9rem;
        font-weight: 500;
        display: flex;
        justify-content: space-between;
        margin-right: 30px;
        line-height: 1.5;
        margin-top: 0;
        margin-bottom: 0;
        align-items: center;

        &:after {
          content: ":";
          margin-left: auto;
        }
      }

      &-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        width: 100%;

        .eacf7-color-picker-wrapper {
          width: max-content;
        }

        .eacf7-url {
          input {
            height: 40px !important;
          }
        }

        .eacf7-form-control {
          width: max-content;
        }

        .eacf7-radio-control {
          .components-flex {
            flex-direction: row !important;
            justify-content: flex-start !important;
            gap: calc(10px);
          }
        }

        .settings-field-upload {
          position: relative;
          width: 100px;

          .eacf7-img {
            max-width: 100%;
            width: 100px;
            height: auto;
            display: block;
            margin-bottom: 10px;
          }

          .eacf7-delete-img {
            position: absolute;
            top: 0;
            right: 0;
            cursor: pointer;
          }
        }

        .eacf7-upload-btn {
          width: max-content;
          background-color: $eacf7_color;
        }

        .eacf7-text-control {
          width: 100%;
          max-width: 300px;

          input {
            border-color: #ddd !important;
            border-radius: 5px !important;
          }
        }

        .telegram-bot-status {
          .eacf7-btn {
            width: max-content;

            &.eacf7-btn-online {
              background-color: rgba($eacf7_color, 1);
              color: #fff;
            }
          }

          p {
            margin-top: 5px;
            margin-bottom: 0;
          }
        }

        &.disabled {
          button,
          .eacf7-select,
          .components-form-toggle {
            opacity: 0.5;
          }
        }

        .progressbar-style-wrap {
          display: flex;
          flex-wrap: wrap;
          flex-direction: row;
          gap: 15px;

          .progressbar-style {
            display: flex;
            align-items: center;
            justify-content: center;
            background: #fff;
            border: 1px solid #ddd;
            position: relative;
            border-radius: 0.5rem;
            cursor: pointer;
            padding: 10px;
            width: 31%;

            &.active {
              border-color: $eacf7_color;
            }

            img {
              max-width: 100%;
              height: auto;
            }

            .active-badge {
              position: absolute;
              top: 5px;
              right: 5px;
              color: #fff;
              padding: 3px 7px;
              background: $eacf7_color;
              border-radius: 50%;
              height: 20px;
              width: 20px;
              display: flex;
              align-items: center;
              justify-content: center;
              border: 1px solid #7c5dee;
            }
          }
        }

        & > .components-base-control {
          .components-base-control__field {
            margin-bottom: 0;
          }

          input[type="text"],
          input[type="url"],
          input[type="date"],
          input[type="time"],
          input[type="email"],
          input[type="number"],
          select,
          textarea {
            width: 300px;
            height: 40px;
            border-color: #ddd;
            border-radius: 5px !important;
            max-width: 100%;

            &.folder-naming-template {
              width: 500px;
            }

            &:focus {
              border-color: inherit;
              box-shadow: none;
            }
          }

          textarea {
            height: auto !important;

            &:focus {
              border-color: #ddd !important;
            }
          }
        }

        .settings-sub-field-content {
          .metafield-wrap {
            .metafield-item:first-child {
              margin-top: 15px;
            }
          }
        }

        .checkbox-group-wrap {
          display: flex;
          flex-wrap: wrap;
          gap: 5px 10px;
        }

        p {
          margin-bottom: 0;
        }
      }

      &.has-sub-field {
        align-items: flex-start;

        > .settings-field-label {
          margin-top: 10px;
        }

        > .settings-field-content {
          .settings-sub-field-content {
            .airtable-fields {
              background: transparent;
              border: 1px dashed #ddd;
              padding: 12px;
              border-radius: 8px;

              .metafield-item {
                &-header {
                  padding: 18px 12px;

                  .header-title {
                    .components-input-control__container {
                      width: 200px;
                    }
                  }
                }

                &:first-child {
                  margin-top: 0;
                }
              }

              .add-meta-btn {
                margin-top: 0;
              }
            }
          }
        }
      }

      &-delete {
        cursor: pointer;
        line-height: 1;

        img {
          width: 20px;
          height: 20px;
        }
      }

      .description {
        margin-top: 7px;
        margin-bottom: 0;
        color: #666;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        font-size: 0.875rem;

        .eacf7-btn {
          margin-left: 15px;
        }

        strong {
          margin-right: 3px;

          &:not(:first-child) {
            margin-left: 3px;
          }
        }
      }

      &.field-conditional {
        flex-direction: column;
        align-items: flex-start;

        & > .settings-field-label {
          width: 100%;
          margin-bottom: 0;

          &:after {
            content: "";
          }
        }

        & > .description {
          margin-bottom: 20px;
          margin-top: 5px;
        }
      }

      &.field-custom-css {
        flex-direction: column;
        align-items: flex-start;

        .settings-field-label {
          width: 100%;
          font-size: 20px;
          line-height: 1;
          margin-bottom: 5px;

          &:after {
            content: "";
          }
        }

        .igd-textarea,
        textarea {
          width: 100%;
          max-width: 100%;
        }

        .description {
          font-size: 1rem;
          margin-bottom: 20px;
        }

        .CodeMirror {
          border: 1px solid #ddd;
          border-radius: 5px;
        }
      }

      &.field-style-preset {
        .customize-preset-toggle-wrap {
          display: flex;
          align-items: center;
          margin-top: 15px;

          .customize-preset-title {
            font-size: 0.875rem;
            color: #333;
            margin: 0 0 0 10px;
          }
        }
      }

      &-sub {
        display: flex;
        flex-direction: column;
        margin-top: 5px;
        width: 100%;

        .settings-field {
          flex-direction: column;
          align-items: flex-start;
          margin-top: 15px;
          margin-left: 210px;
          margin-bottom: 0;
          display: flex;
          border: 1px dashed #ddd;
          padding: 15px;
          border-radius: 7px;
          max-width: 100%;

          &-label {
            margin-bottom: 10px;
            margin-right: 0;
            width: auto;

            &:after {
              content: "";
              display: none;
            }
          }

          &-content {
            width: 100%;
            margin-left: 0;

            & + .settings-field-label {
              margin-top: 10px;
            }
          }
        }
      }
    }

    .collapse-wrapper {
      border: 1px solid #eee;
      background: #fff;
      border-radius: 10px;
      padding: 15px 20px;
      margin-bottom: 15px;

      .collapse-header {
        display: flex;
        align-items: center;
        cursor: pointer;

        .header-title {
          h3 {
            font-size: 18px;
            margin-top: 0;
            margin-bottom: 5px;
            color: #333;
            line-height: 1;
            display: flex;
            align-items: center;

            img {
              margin-right: 5px;
              width: 25px;
            }
          }

          p {
            margin-bottom: 0;
            margin-top: 5px;
            color: #555;
          }
        }

        .collapse-toggle {
          margin-left: auto;
          cursor: pointer;
        }
      }

      .collapse-content {
        margin-top: 15px;

        .metafield-wrap {
          .components-input-control__backdrop {
            height: 33px;
          }
        }

        .settings-field {
          background: rgba(245, 246, 250, 1);

          &.full-width {
            h4 {
              width: 100%;
              margin-right: 0;
              margin-bottom: 10px;

              &::after {
                content: "";
              }
            }
          }

          &.conditional {
            h4 {
              margin-bottom: 10px;
            }
          }

          &:last-child {
            margin-bottom: 0;
          }
        }
      }
    }

    .eacf7-upload-wrap {
      display: flex;
      align-items: center;

      input {
        max-width: 300px;
        height: 40px;
        border: 1px solid #ddd;
        border-radius: 5px;
        box-shadow: none;
        outline: none;
        font-size: 14px;
        padding: 5px 10px;
        color: #333;
      }

      .input-wrap {
        flex: 1;
        display: flex;
        align-items: center;
        position: relative;
      }

      button {
        margin-left: 7px;
        display: flex;
        align-items: center;
        background: #fff;
        border-radius: 7px;
        height: 40px;

        &.remove-file-btn {
          color: #ff8000;
          border: 1px solid rgba(#ff8000, 0.5);
          position: absolute;
          right: 0;
          border-top-left-radius: 0;
          border-bottom-left-radius: 0;

          &:hover {
            background: #ffd8b3;
          }
        }

        &.select-file-btn {
          color: $eacf7_color;
          border: 1px solid rgba(#5cb85c, 0.5);

          &:hover {
            background: #d5f0db;
          }
        }

        i {
          width: auto;
          height: auto;
          font-size: 24px;
        }

        span:nth-child(2) {
          margin-left: 5px;
        }
      }

      .thumbnail-preview {
        width: 40px;
        border-radius: 7px;
        margin-right: 5px;
        height: 40px;
        aspect-ratio: 1;
      }
    }
  }

  .settings-header {
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;

    .header-content {
      display: flex;
      align-items: center;

      img {
        margin-right: 10px;
        width: 32px;
      }

      .header-title {
        display: flex;
        flex-direction: column;

        h3 {
          font-size: 20px;
          font-weight: 500;
          margin-top: 0;
          margin-bottom: 5px;
          color: #333;
        }

        p {
          font-size: 0.9rem;
          margin: 0;
          color: #555;
          line-height: 1.3;
        }
      }
    }

    a {
      white-space: nowrap;
      margin-left: 7px;

      i {
        margin-right: 5px;
      }
    }
  }

  .components-input-control__backdrop,
  input {
    border-color: #ddd !important;
    border-radius: 5px;
    height: 35px;
  }

  .components-input-control__container {
    width: 300px;
  }

  .components-input-control__backdrop {
    border-color: #ddd !important;
    border-radius: 5px !important;
    height: 40px;
  }

  .components-range-control {
    width: 300px;

    .components-range-control__wrapper {
      color: $eacf7_color;
      margin-bottom: 0;

      .components-range-control__mark-label {
        top: 20px;
      }

      .components-range-control__thumb-wrapper {
        span {
          background: $eacf7_color;
        }
      }
    }

    .components-input-control__input {
      width: auto;
      height: auto;
      padding: 0 0 0 10px;
    }

    .components-input-control__backdrop {
      border-color: #ddd;
      height: 32px !important;
    }

    .components-range-control__reset {
      background-color: #f8d7da;
      color: #d8000c;
      box-shadow: none;
      border: 1px solid rgba(#d8000c, 0.3);
      border-radius: 5px;
    }

    .components-number-control {
      .components-input-control__container {
        width: 70px;

        .components-input-control__input {
          padding: 0 10px;
          width: 100%;
          height: 32px !important;
        }
      }
    }
  }

  .eacf7-color-palette {
    max-width: 100%;
    position: relative;
    border: 1px solid #e5e5e5;
    padding: 11px;
    border-radius: 10px;
    background: #fff;
    width: 400px;

    legend {
      display: none;
    }

    .components-dropdown {
      width: max-content;
    }

    .components-color-palette__custom-color-button {
      width: 300px;
      height: 40px;
      border-radius: 5px;

      .components-truncate {
        display: none;
      }

      .components-color-palette__custom-color-value {
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
      }
    }

    .components-popover {
      left: 0 !important;

      .components-popover__content {
        outline-color: rgba(#ddd, 0.5);
        border-radius: 5px;
        box-shadow: rgba(0, 0, 0, 0.16) 0px 10px 36px 0px,
          rgba(0, 0, 0, 0.06) 0px 0px 0px 1px;

        .react-colorful {
          & + div {
            padding-top: 0;
            display: flex;

            & > div {
              &:first-child {
                width: auto;
                padding-right: 0;

                & > button {
                  margin-left: 5px;
                }
              }

              &:last-child {
                padding: 5px;
                flex: 1;
              }
            }
          }
        }

        .react-colorful__saturation {
          height: 100px;
          margin-bottom: 10px;
        }

        .components-input-control__container {
          width: 100%;

          .components-spacer {
            margin-left: 10px;
          }

          input {
            height: 30px;
            min-height: 30px;
            padding-right: 5px;
          }

          select {
            height: auto !important;
          }

          .components-input-control__backdrop {
            border-color: #ddd;
            border-radius: 5px;
            height: auto !important;
          }
        }

        /* width */
        &::-webkit-scrollbar {
          width: 5px;
        }

        /* Track */
        &::-webkit-scrollbar-track {
          background: #f1f1f1;
        }

        /* Handle */
        &::-webkit-scrollbar-thumb {
          background: #888;
        }

        /* Handle on hover */
        &::-webkit-scrollbar-thumb:hover {
          background: #555;
        }
      }
    }

    .components-circular-option-picker__custom-clear-wrapper {
      position: absolute;
      margin: 0;
      right: 14px;
      top: 15px;

      button {
        color: #675ed5 !important;
        background: #fff !important;
        border: 1px solid rgba(#675ed5, 0.25) !important;
        box-shadow: none;
        font-size: 0.875rem;
        height: 32px;
        width: 60px;
        text-align: center;
        border-radius: 5px;
        padding: 5px 12px;

        &:hover {
          color: #fff;
          background: #675ed5;
          border: 1px solid rgba(#675ed5, 0.25);
        }
      }
    }

    .components-color-palette__custom-color-text-wrapper {
      position: absolute;
      box-shadow: none;
      pointer-events: none;
    }

    .components-circular-option-picker__option {
      &:before,
      &:after {
        width: auto;
        height: auto;
      }

      .components-tooltip {
        display: none;
      }
    }

    .components-select-control {
      .components-input-control__backdrop {
        display: block;
        border-color: #ddd !important;
        border-radius: 5px !important;
      }
    }

    &.disabled {
      opacity: 0.5;
    }
  }

  .eacf7-textarea {
    max-width: 500px;

    textarea {
      border-color: #ddd;
      border-radius: 5px !important;
    }
  }
}
