:root {
  --sp-admin-color: #2271b1;
  --sp-success-green: rgba(70, 180, 80, 0.16);
  --sp-success-green-text: #155724;
  --sp-maybe-orange: rgba(255, 140, 0, 0.16);
  --sp-maybe-orange-text: #8f5400;
  --sp-warning-red: rgba(238, 46, 79, 0.14);
  --sp-warning-red-text: #721c24;
}

.sp-gallery-settings-page input[type="number"] {
  width: 100px;
}

.sp-gallery-settings-page input[type="text"],
.sp-gallery-settings-page input[type="email"] {
  width: 400px;
}

.sp_gallery_email_footer_editor_ifr {
  height: 400px;
}

.sp-gallery-collapsible-media-box {
  margin-bottom: 10px;
  margin-top: 10px;
}

.sp-gallery-collapsible-media-box.collapsed {
  max-height: 600px;
  overflow-y: auto;
}

.sp-gallery-toggle-expand-btn {
  margin-right: 6px;
  padding: 3px;
  height: 20px;
  font-size: 14px;
  line-height: 1em;
  cursor: pointer;
  border: none;
  background-color: inherit;
}

.handle-actions {
  display: flex;
  align-items: center;
}

.block-editor-page .rwmb-custom-image-select {
  --color: var(--wp-admin-theme-color, #2271b1);
}

.post-type-sp_gallery_template,
.post-type-shutterpress-gallery {
  .rwmb-field:not(:last-of-type) {
    margin: 15px 0 !important;
  }
  .rwmb-field:last-of-type {
    margin: 10px 0 !important;
  }

  .rwmb-custom-image-select {
    width: 80px;
    height: 80px;
    border: 3px solid #d8d8d8;
    border-radius: 4px;
    padding: 1px;
    cursor: pointer;

    --color: #2271b1;
  }

  .rwmb-custom-image-select-row {
    display: flex;
    flex-direction: row;
    gap: 10px;
    flex-wrap: wrap;
  }

  .rwmb-custom-image-select-container {
    display: flex;
    flex-direction: column;
    gap: 5px;

    .rwmb-custom-image-select-option-name {
      text-align: center;
    }
  }

  .rwmb-field.sp-gallery-template-number .rwmb-slider-inner {
    justify-content: flex-start;
    .rwmb-slider-ui {
      max-width: 300px;
    }
    .rwmb-slider-label {
      margin: 0 20px;
      background-color: #f0f0f0;
      border: 1px solid #7e8993;
      border-radius: 4px;
      align-items: center;
      padding: 4px 8px;
      width: 2em;
      text-align: center;
    }
  }

  .rwmb-custom-image-select img {
    width: 75%;
    height: 75%;
    object-fit: cover;
    margin: 12.5%;
  }

  .rwmb-custom-image-select:hover,
  .rwmb-custom-image-select:has(:checked) {
    border-color: var(--color);
  }

  .rwmb-custom_image_select.rwmb-custom_image_select {
    display: none;
  }

  .rwmb-field.sp-gallery-three-column,
  .rwmb-field.sp-gallery-four-column {
    fieldset {
      display: flex;
      flex-direction: row;
      column-gap: 10px;
      row-gap: 5px;
      flex-wrap: wrap;
      .sp-gallery-fieldset-text-box {
        display: flex;
        flex-direction: column;
        gap: 5px;
      }
    }
  }

  .rwmb-field.sp-gallery-template-number {
    .rwmb-input input[type="number"] {
      width: auto;
    }
  }
  /* Container for the entire field */
  .rwmb-button_group-wrapper.sp-gallery-icon-position {
    margin-top: 20px;
  }

  /* Icon position controls */
  .sp-gallery-icon-position {
    .rwmb-label {
      margin-bottom: 10px;
    }

    /* The container for the radio buttons and icons */
    .rwmb-button-input-list {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 0;
      justify-items: center;
      align-items: center;
      padding: 0;
      width: 90px;
      border: solid 1px;
      border-radius: 3px;

      label {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        width: 30px;
        height: 30px;
        margin: 0;
        border: 0px solid #ccc;
        border-radius: 0 !important;
        transition:
          border-color 0.3s ease,
          background-color 0.3s ease;
        padding: 0px;

        &.selected,
        input:checked + i {
          border-color: var(--wp-admin-theme-color);
          // background-color: rgba(0, 115, 170, 0.1);
        }

        &:hover {
          border-color: var(--wp-admin-theme-color);
          background-color: rgba(0, 160, 210, 0.1);
        }

        i {
          font-size: 16px;
          color: #555;
          transition: color 0.3s ease;
        }

        &.selected i,
        input:checked + i {
          color: #ffffff;
        }

        &:hover i {
          color: var(--wp-admin-theme-color);
        }
      }
    }

    .dashicons.tl,
    .dashicons.br {
      transform: rotate(-45deg);
    }

    .dashicons.tr,
    .dashicons.bl {
      transform: rotate(45deg);
    }

    .rwmb-button_group {
      display: none;
    }
  }
}

.sp-help .sp-help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 16px;
}

.sp-help .sp-card {
  background: #fff;
  border: 1px solid #dcdcde;
  border-radius: 4px;

  &.sp-card-pro {
    grid-column: span 2;
  }

  .sp-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #dcdcde;
    background: #f8f8f8;
    h2 {
      margin: 0;
    }
  }

  .sp-card-content {
    padding: 20px;
  }

  &.sp-card-resources {
    .sp-card-content {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 20px;
    }
  }

  &.sp-card-signup {
    .sp-card-content {
      display: grid;
      grid-template-columns: 1fr;
      gap: 20px;
    }
    .sp-card-signup-left {
      .sp-form-container {
        background-color: #f8f8f8;
        border: 1px solid #dcdcde;
        padding: 20px;
        border-radius: 5px;

        .sp-form-success {
          display: none;
        }

        form {
          display: flex;
          flex-direction: column;
          gap: 20px;
          align-items: flex-start;
        }
      }
    }
    img {
      max-width: 100%;
      height: auto;
    }
  }

  &.sp-card-pro {
    .sp-card-content {
      ul {
        list-style: disc;
        padding: 20px;
      }
    }
  }
}
.sp-help input[type="email"] {
  min-width: 260px;
}
.sp-help .sp-kv {
  margin: 0;
  padding-left: 18px;
}

#performance {
  &:has(#sp_gallery_enable_virtualiser_input:not(:checked)) {
    .sp-gallery-low-conflict-mode {
      color: rgba(0, 0, 0, 0.3);
      pointer-events: none;

      input {
        opacity: 0.3;
      }

      .description {
        color: rgba(0, 0, 0, 0.3);
      }
    }
  }
}

@media (max-width: 1200px) {
  .sp-help .sp-help-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 782px) {
  .sp-help {
    .sp-help-grid {
      grid-template-columns: 1fr;
    }
    .sp-card {
      &.sp-card-signup,
      &.sp-card-resources {
        .sp-card-content {
          grid-template-columns: 1fr;
        }
      }
      &.sp-card-pro {
        grid-column: span 1;
      }
    }
  }
}
