/* Optimized Form Builder SCSS */

// Variables for consistent theming
$primary-color: #4a6cf7;
$secondary-color: #338ac6;
$light-blue: #d6e1e9;
$border-color: #e1e4ea;
$background-color: #f9f9f9;
$hover-color: #f0f2f8;
$text-color: #333;
$text-light: #666873;
$new-tag-color: teal;
$pro-tag-color: #147ed3;
$shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
$border-radius: 8px;

// Mixins
@mixin flex($direction: row, $justify: center, $align: center) {
  display: flex;
  flex-direction: $direction;
  justify-content: $justify;
  align-items: $align;
}

@mixin sticky($top: 0) {
  position: sticky;
  top: $top;
  z-index: 10;
}

@mixin thin-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: $light-blue transparent;

  &::-webkit-scrollbar {
    width: 4px;
  }

  &::-webkit-scrollbar-thumb {
    background-color: $light-blue;
    border-radius: 2px;
  }

  &::-webkit-scrollbar-track {
    background-color: transparent;
  }
}

// Reset & Global Styles
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

button {
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;

  &:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  }
}







// Form Header
.form-header {
  @include flex(column);
  width: 100%;
  padding: 15px 20px;
  background: white;
  box-shadow: $shadow;
  border-radius: $border-radius;
  margin-bottom: 20px;
  transition: all 0.3s ease;

  h2 {
    @include flex(row);
    gap: 10px;
    margin: 0 0 15px 0;
    font-size: 1.5rem;
    color: $text-color;

    svg {
      color: $primary-color;
      width: 28px;
      height: 28px;
    }
  }

  .checkbox-wrapper {
    width: 100%;
    @include flex(column, flex-start, flex-start);
    gap: 1px;
    // margin-top: 12px;

    .form-fields-header {
      width: 100%;
      overflow: hidden;
      transition: all 0.3s ease-in-out;
      max-height: 1000px;
      /* Set a large enough value to contain all content */
      opacity: 1;
    }

    .form-fields-header.hide {
      max-height: 0;
      opacity: 0;
      margin: 0;
      padding-top: 0;
      padding-bottom: 0;
      pointer-events: none;
    }

    .form-fields-header.show {
      display: flex;
    }

    .toggle-form-fields {
      padding: 4px 14px;
      border-radius: 4px;
      background-color: #ffffff;
      cursor: pointer;
      transition: background-color 0.2s ease;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .toggle-form-fields:hover {
      background-color: #e0e0e0;
      border: 1px solid #ddd;
    }

    .toggle-form-fields i {
      transition: transform 0.3s ease;
    }

    .toggle-form-fields i.fa-chevron-up {
      transform: rotate(0deg);
    }

    .toggle-form-fields i.fa-chevron-down {
      transform: rotate(180deg);
    }
  }

  .form-fields-header {
    @include flex(row, space-between, center);
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
    height: auto;
    text-align: left;

    .position-description {
      line-height: 1.6;
      color: #6c757d;
      margin-bottom: 2rem;

      .tip-highlight {
        color: #4a6cf7;
        font-weight: 600;
      }

      .code-example {
        background-color: #f5f7fa;
        padding: 0.25rem 0.5rem;
        border-radius: 4px;
        font-family: monospace;
        margin: 0 0.25rem;
      }

      .tip-theme-list {
        font-style: italic;
      }
    }

  }

  .formname,
  .btn_name {
    flex: 1;
    min-width: 200px;

    label {
      display: block;
      margin-bottom: 5px;
      font-weight: 500;
      color: #555;
    }

    input {
      width: 100%;
      padding: 10px;
      border-radius: 4px;
      border: 1px solid $border-color;
      transition: border 0.3s ease;

      &:focus {
        border-color: $primary-color;
        outline: none;
        box-shadow: 0 0 0 2px rgba($primary-color, 0.2);
      }
    }
  }

  .button-sub-group-simple-form {
    @include flex(row, flex-end, center);
    gap: 10px;
    margin-top: 10px;
    margin-left: 0;
  }

  button {
    padding: 8px 15px;
    border-radius: 4px;
    @include flex(row, center, center);
    gap: 5px;
    font-weight: 500;

    &.jsonbtn {
      background: #f5f5f5;
      color: $text-color;
    }

    &#saveData {
      background: $primary-color;
      color: white;
    }

    &.form-preview-button {
      background: #f5f5f5;
      color: $text-color;
      padding: 8px;
      border-radius: 50%;

      svg {
        width: 20px;
        height: 20px;
        color: #555;
      }
    }
  }

  .formname.copy-shortcode {
    width: 100%;
    max-width: 500px;

    h4.copythe-shortcode {
      padding: 6px 17px;
      font-weight: 400;
      font-size: 14px;
      line-height: 21px;
      color: $text-color;
      background: #ffffff;
      border: 1px solid $border-color;
      @include flex(row);
      white-space: nowrap;
      cursor: pointer;
      transition: box-shadow 0.2s ease-out 0s;
      margin-top: 5px;
      border-radius: 5px;
      margin-left: 0;
      height: 47px;

      &:hover {
        box-shadow: $hover-color 0px 0px 0px 5px;
      }

      &.btn-success {
        color: #FF7E47;
      }
    }
  }
}

// Main Container
.form-builder-container {
  @include flex(row, space-between, flex-start);
  gap: 15px;
  margin: 20px 0;

  @media (max-width: 1200px) {
    flex-direction: column;
  }
}

// Form Builder Layout
.form-builder {
  @include flex(row, space-between, flex-start);
  width: 100%;
  // margin: 10px 0;
  // border: 1px solid $border-color;
  // padding: 15px; 
  background-color: white;
  border-radius: $border-radius;

  @media (max-width: 1200px) {
    flex-direction: column;
  }
}

// Form Fields (Left Section)
.form-fields {
  width: 25%;
  border: unset;
  padding: 15px;
  background-color: white;
  // border-radius: $border-radius;
  position: sticky;
  top: 35px;
  z-index: 10;

  h3 {
    margin-bottom: 15px;
    color: $text-color;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
  }

  .draggable-field-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-gap: 10px;
    overflow: hidden;
    @include sticky(190px);
    max-height: calc(100vh - 220px);
    overflow-y: auto;
    @include thin-scrollbar;

    @media (max-width: 1400px) {
      grid-template-columns: 1fr;
    }

    .draggable-field {
      background: white;
      color: $text-color;
      border: 1px solid $light-blue;
      border-radius: $border-radius;
      position: relative;
      padding: 12px;
      transition: all 0.2s ease;
      cursor: grab;
      @include flex(row, flex-start, center);

      &:hover {
        background: $light-blue;
        transform: translateY(-2px);
        box-shadow: $shadow;
      }

      &.locked {
        opacity: 0.5;
        pointer-events: none;
      }

      .field-icon {
        margin-right: 8px;

        svg {
          fill: $secondary-color;
          width: 18px;
          height: 18px;
        }
      }

      .field-name {
        font-size: 14px;
        font-weight: 500;
      }

      .NEW_TAG {
        align-items: center;
        background: $new-tag-color;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        color: #fff;
        font-size: 10px;
        height: 18px;
        position: absolute;
        right: 5px;
        top: 5px;
        text-align: center;
        width: 29px;
        padding: 2px;
      }

      .PRO_TAG {
        background: $pro-tag-color;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        color: #fff;
        font-size: 8px;
        height: 16px;
        left: 5px;
        top: 5px;
        position: absolute;
        text-align: center;
        width: 24px;
        padding: 2px;
      }
    }
  }
}

// Form Canvas (Middle Section)
.form-canvas {
  width: 80%;
  border: 1px solid $border-color;
  padding: 15px;
  background-color: white;
  border-radius: $border-radius;

  @media (max-width: 1200px) {
    width: 100%;
    margin: 15px 0;
  }

  h1 {
    font-size: 32px;
  }

  h2 {
    font-size: 28px;
  }

  h3 {
    font-size: 24px;
  }

  h4 {
    font-size: 20px;
  }

  h5 {
    font-size: 18px;
  }

  h6 {
    font-size: 16px;
  }

  .form-canvas-container {
    min-height: calc(100vh - 200px);
    background-color: #fff;
    border: 2px dashed $light-blue;
    padding: 15px;
    border-radius: $border-radius;
    overflow-y: auto;
    @include thin-scrollbar;

    .draggable-field {
      background-color: #fff;
      border: 1px solid $border-color;
      padding: 15px;
      margin-bottom: 10px;
      border-radius: $border-radius;
      position: relative;
      transition: all 0.2s ease;

      &:hover {
        border-color: $primary-color;
      }

      &.remove-background {
        border: 2px dotted #ff6b6b;
        background-color: rgba(255, 107, 107, 0.05);
      }

      button.form-edit,
      button.form-remove {
        position: absolute;
        top: 5px;
        background: white;
        border-radius: 50%;
        width: 28px;
        height: 28px;
        @include flex;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);

        &:hover {
          background-color: #f5f5f5;
        }

        svg {
          width: 16px;
          height: 16px;
        }
      }

      button.form-edit {
        right: 40px;

        &.remove-background {
          background: #dbd4ff;
        }
      }

      button.form-remove {
        right: 5px;
      }
    }
  }

  // Form Elements Styling
  .simple-form-text {

    input,
    textarea,
    select {
      width: 100%;
      padding: 14px 20px 15px 45px;
      background: #ffffff;
      border: 1px solid #e1e4ea;
      border-radius: 4px;
      font-weight: 400;
      font-size: 14px;
      line-height: 21px;
      color: #666873;
      outline: none;
      height: 5%;
      transition: border 0.3sease;

      &:focus {
        border-color: $primary-color;
        box-shadow: 0 0 0 2px rgba($primary-color, 0.1);
      }
    }

    input.image-field {
      width: 40%;
      height: 5%;
    }

    textarea {
      min-height: 100px;
      resize: vertical;
    }
  }

  .button-field,
  .submit-btn {
    border: none;
    border-radius: 5px;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    height: auto;
    margin-top: 15px;
    background: $primary-color;
    color: white;
    transition: all 0.2s ease;

    &:hover {
      opacity: 0.9;
      transform: translateY(-2px);
      box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    }
  }
}

// Edit Field Form (Right Section)
.edit-field-form {
  width: 35%;
  border: 1px solid $border-color;
  padding: 20px;
  background-color: white;
  border-radius: $border-radius;
  @include sticky(40px);
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  @include thin-scrollbar;

  @media (max-width: 1200px) {
    width: 100%;
    position: relative;
    top: 0;
  }

  h3 {
    margin-bottom: 15px;
    color: $text-color;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
  }

  .edit-fields-section {
    max-height: 100%;
    overflow-y: auto;
    padding-right: 5px;
    @include thin-scrollbar;
  }

  .form-btn-group {
    @include flex(row, center, center);
    gap: 10px;
    margin-bottom: 20px;

    button {
      padding: 8px 15px;
      border-radius: 4px;
      background: $light-blue;
      color: $text-color;
      font-weight: 500;

      &:hover {
        background: darken($light-blue, 5%);
      }

      &.active {
        background: $primary-color;
        color: white;
      }
    }
  }

  @mixin flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .simple-form-id-panel {
    @include flex(row, flex-start, center);
    margin-bottom: 15px;
    position: relative;

    label {
      width: 30%;
      white-space: nowrap;
      font-weight: 500;
      color: $text-color;
    }

    input[type="text"],
    .select-type-class,
    select {
      width: 70%;
      padding: 4px 5px;
      border: 1px solid #e1e4ea;
      border-radius: 4px;
      font-size: 13px;

      &:focus {
        border-color: $primary-color;
        outline: none;
      }
    }

    input[type="checkbox"] {
      margin-left: 10px;

      &:checked {
        accent-color: $primary-color;
      }
    }
  }

  .select-fields-panel {
    @include flex(row, flex-start, stretch);
    gap: 10px;
    position: relative;

    .option-group {
      position: relative;
      @include flex(row, space-between, center);

      input {
        width: calc(100% - 35px);
        padding: 8px 10px;
        border: 1px solid $border-color;
        border-radius: 4px;

        &:focus {
          border-color: $primary-color;
          outline: none;
        }
      }


    }

    button.option-remover,
    button.option-remover-multiple {
      width: 20px;
      height: 20px;
      border-radius: 4px;
      background-color: #f1f1f1;
      border: 1px solid #e0e0e0;
      @include flex-center;
      transition: all 0.2s ease;
      cursor: pointer;
      position: absolute;
      right: 2px;
      top: -8px;

      &:hover {
        background-color: rgba(#f44336, 0.1);
        border-color: #f44336;
      }

      @include flex;

      &:hover {
        background: #e5e5e5;
      }

      svg {
        width: 16px;
        height: 16px;
        color: #ff6b6b;
      }
    }

    button.add-option {
      align-self: flex-start;
      padding: 5px 10px;
      background: $light-blue;
      border-radius: 4px;
      font-size: 14px;

      &:hover {
        background: darken($light-blue, 5%);
      }
    }
  }

  // Add option button styling for select add radio option
  button.jsonbtn {
    @include flex-center;
    padding: 10px 16px;
    background-color: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    color: #4a6cf7;
    font-weight: 500;
    margin-top: 16px;
    cursor: pointer;
    transition: all 0.2s ease;

    svg {
      width: 18px;
      height: 18px;
      margin-right: 8px;
      color: #4a6cf7;
    }

    &:hover {
      background-color: rgba(#4a6cf7, 0.1);
      border-color: #4a6cf7;
    }

    &:active {
      transform: scale(0.98);
    }
  }

}

// JSON Preview
pre {
  white-space: pre-wrap;
  word-wrap: break-word;
  padding: 15px;
  background-color: #1e1e1e;
  color: white;
  border: none;
  border-radius: 8px;
  margin: 20px 11px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 14px;
  width: 500px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 20px;

  &::-webkit-scrollbar {
    width: 3px;
  }

  &::-webkit-scrollbar-thumb {
    background-color: #666;
    border-radius: 4px;
  }

  &::-webkit-scrollbar-track {
    background-color: #2d2d2d;
  }
}

// Responsive Adjustments
@media (max-width: 768px) {
  .form-header {
    padding: 12px 15px;

    h2 {
      font-size: 1.2rem;
    }

    .form-fields-header {
      flex-direction: column;
    }

    .formname,
    .btn_name {
      width: 100%;
    }

    .button-sub-group-simple-form {
      width: 100%;
      justify-content: space-between;
      align-self: center;
    }
  }
}

@media (max-width: 480px) {
  .form-header h2 {
    font-size: 1.1rem;
  }

  .button-sub-group-simple-form {
    flex-direction: column;
    width: 100%;

    button {
      width: 100%;
      justify-content: center;
    }
  }

  .form-fields .draggable-field-container {
    grid-template-columns: 1fr;
  }
}



//------------------Row and Column
.form-canvas-rows {
  width: 100%;

  .form-row {
    margin-bottom: 15px;
    border: 1px dashed #ccc;
    border-radius: 5px;
    padding: 10px;
    transition: all 0.3s ease;

    &.active-row {
      border-color: #4a90e2;
      box-shadow: 0 0 5px rgba(74, 144, 226, 0.5);
    }

    .row-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 10px;
      padding-bottom: 5px;
      border-bottom: 1px solid #eee;

      span {
        font-weight: 500;
        color: #555;
      }

      .row-controls {
        display: flex;
        gap: 5px;

        button {
          background: none;
          border: none;
          cursor: pointer;
          padding: 3px;
          border-radius: 3px;
          display: flex;
          align-items: center;
          justify-content: center;

          &:hover {
            background-color: #f0f0f0;
          }

          &.layout-toggle {
            &.horizontal {
              color: #4a90e2;
            }
          }

          &.remove-row-btn {
            color: #e24a4a;
          }
        }
      }
    }
  }
}

.form-canvas-container {
  min-height: 80px;
  width: 100%;

  &.horizontal-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;

    .draggable-field {
      flex: 1;
      min-width: 200px;

      &.field-horizontal {
        margin-right: 10px;
      }
    }
  }

  &.vertical-layout {
    display: flex;
    flex-direction: column;

    .draggable-field {
      width: 100%;
      margin-bottom: 10px;
    }
  }
}

.add-row-btn {
  background: #4a90e2;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  margin-left: 10px;

  svg {
    margin-left: 5px;
    font-size: 16px;
  }

  &:hover {
    background: #3a7bc8;
  }
}

/* Tha
nk You Page Settings Styles */
.thankyou-page-settings {
  margin-top: 15px;
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;

  .thankyou-page-toggle {
    margin-bottom: 15px;

    label {
      display: flex;
      align-items: center;
      font-weight: 500;
      color: #333;
      cursor: pointer;

      input[type="checkbox"] {
        margin-right: 8px;
        transform: scale(1.1);
      }
    }
  }

  .thankyou-page-select {
    label {
      display: block;
      margin-bottom: 5px;
      font-weight: 500;
      color: #333;
    }

    select {
      width: 100%;
      padding: 8px 12px;
      border: 1px solid #ddd;
      border-radius: 4px;
      background-color: white;
      font-size: 14px;
      color: #333;

      &:focus {
        outline: none;
        border-color: #4a6cf7;
        box-shadow: 0 0 0 2px rgba(74, 108, 247, 0.1);
      }
    }
  }
}

/* Compact Form Header Styles */
.compact-form-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 12px 16px;
  border-radius: 12px 12px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  gap: 16px;
  min-height: 56px;
  margin-top: -8px;

  .header-main {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;

    .header-icon {
      font-size: 20px;
      color: rgba(255, 255, 255, 0.9);
      flex-shrink: 0;
    }

    .title-section {
      flex-shrink: 0;

      h2 {
        font-size: 20px;
        font-weight: 600;
        margin: 0;
        line-height: 1.2;
        color: #ffffff;
      }

      .subtitle {
        font-size: 11px;
        color: rgba(255, 255, 255, 0.75);
        margin-top: 1px;
        margin-left: -24px;
      }
    }

    .form-name-input {
      flex: 1;
      max-width: 300px;
      min-width: 150px;
      margin-top: 15px;

      .form-name-field {
        width: 100%;
        padding: 8px 12px;
        border: 1px solid rgba(255, 255, 255, 0.25);
        border-radius: 6px;
        background: rgba(255, 255, 255, 0.1);
        color: white;
        font-size: 14px;
        backdrop-filter: blur(5px);
        transition: all 0.2s ease;

        &::placeholder {
          color: rgba(255, 255, 255, 0.6);
        }

        &:focus {
          outline: none;
          border-color: rgba(255, 255, 255, 0.4);
          background: rgba(255, 255, 255, 0.15);
        }
      }
    }

    .shortcode-section {
      display: flex;
      align-items: center;
      gap: 6px;
      flex-shrink: 0;

      .shortcode-display {
        background: rgba(0, 0, 0, 0.2);
        color: #e2e8f0;
        padding: 6px 8px;
        border-radius: 4px;
        font-family: 'Monaco', 'Menlo', monospace;
        font-size: 11px;
        border: 1px solid rgba(255, 255, 255, 0.1);
      }

      .copy-btn {
        background: rgba(255, 255, 255, 0.15);
        color: white;
        border: none;
        border-radius: 4px;
        padding: 6px;
        cursor: pointer;
        transition: all 0.2s ease;
        display: flex;
        align-items: center;
        justify-content: center;

        &:hover {
          background: rgba(255, 255, 255, 0.25);
        }
      }
    }
  }

  .header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;

    .action-btn {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 5px 8px;
      border: none;
      border-radius: 6px;
      font-size: 12px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.2s ease;
      white-space: nowrap;
      width: 80px;
      height: 25px;

      svg {
        flex-shrink: 0;
        width: 15px;
      }

      &.settings-btn,
      &.preview-btn,
      &.json-btn {
        background: rgba(255, 255, 255, 0.1);
        color: white;
        border: 1px solid rgba(255, 255, 255, 0.2);

        &:hover {
          background: rgba(255, 255, 255, 0.2);
        }
      }

      &.save-btn {
        background: linear-gradient(135deg, #28a745, #20c997);
        color: white;
        font-weight: 600;
        border: none;
        box-shadow: 0 2px 8px rgba(40, 167, 69, 0.25);

        &:hover {
          background: linear-gradient(135deg, #218838, #1ea085);
          transform: translateY(-1px);
          box-shadow: 0 3px 12px rgba(40, 167, 69, 0.35);
        }
      }
    }
  }

  // Tablet Responsive
  @media (max-width: 1024px) {
    .header-main {
      .form-name-input {
        max-width: 200px;
      }

      .shortcode-section {
        .shortcode-display {
          font-size: 10px;
          padding: 5px 6px;
        }
      }
    }
  }

  // Mobile Responsive - Stack vertically
  @media (max-width: 768px) {
    flex-direction: column;
    padding: 12px;
    gap: 12px;
    min-height: auto;

    .header-main {
      width: 100%;
      flex-direction: column;
      gap: 12px;
      align-items: stretch;

      .header-icon {
        font-size: 18px;
        align-self: center;
      }

      .title-section {
        text-align: center;
        align-self: center;

        h2 {
          font-size: 14px;
        }

        .subtitle {
          font-size: 10px;
        }
      }

      .form-name-input {
        max-width: 100%;
        min-width: 100%;
        order: 1;

        .form-name-field {
          padding: 10px 12px;
          font-size: 14px;
          text-align: center;
        }
      }

      .shortcode-section {
        order: 2;
        justify-content: center;
        width: 100%;

        .shortcode-display {
          flex: 1;
          text-align: center;
          font-size: 10px;
          padding: 8px;
        }
      }
    }

    .header-actions {
      width: 100%;
      justify-content: center;
      flex-wrap: wrap;
      gap: 8px;
      order: 3;

      .action-btn {
        flex: 1;
        // min-width: 80px;
        justify-content: center;
        padding: 10px 8px;
        width: 80px;
        height: 25px;

        .btn-text {
          display: block;
        }
      }
    }
  }

  // Small Mobile - More compact
  @media (max-width: 480px) {
    padding: 10px;
    gap: 10px;

    .header-main {
      gap: 10px;

      .title-section {
        h2 {
          font-size: 13px;
        }

        .subtitle {
          font-size: 9px;
        }
      }

      .form-name-input {
        .form-name-field {
          padding: 8px 10px;
          font-size: 13px;
        }
      }

      .shortcode-section {
        .shortcode-display {
          font-size: 9px;
          padding: 6px;
        }

        .copy-btn {
          padding: 4px;
        }
      }
    }

    .header-actions {
      gap: 6px;

      .action-btn {
        // min-width: 70px;
        padding: 8px 6px;
        font-size: 11px;
        width: 80px;
        height: 25px;

        .btn-text {
          font-size: 10px;
        }
      }
    }
  }

  // Extra Small Mobile - Icon only buttons
  @media (max-width: 360px) {
    .header-actions {
      .action-btn {
        min-width: 40px;
        padding: 8px;

        .btn-text {
          display: none;
        }
      }
    }
  }
}

/* Form Settings Modal Styles */
.form-settings-modal {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  max-width: 600px;
  width: 90vw;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;

  .modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;

    h3 {
      margin: 0;
      font-size: 20px;
      font-weight: 600;
    }

    .close-btn {
      background: rgba(255, 255, 255, 0.2);
      border: none;
      border-radius: 50%;
      width: 36px;
      height: 36px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      color: white;
      transition: all 0.3s ease;

      &:hover {
        background: rgba(255, 255, 255, 0.3);
        transform: rotate(90deg);
      }
    }
  }




  .modal-content {
    padding: 30px;
    overflow-y: auto;
    flex: 1;

    .settings-section {
      margin-bottom: 30px;

      &:last-child {
        margin-bottom: 0;
      }

      h4 {
        color: #2d3748;
        font-size: 18px;
        font-weight: 600;
        margin: 0 0 20px 0;
        padding-bottom: 10px;
        border-bottom: 2px solid #e2e8f0;
      }

      .form-group {
        margin-bottom: 20px;

        &:last-child {
          margin-bottom: 0;
        }

        label {
          display: block;
          color: #4a5568;
          font-weight: 500;
          margin-bottom: 8px;
          font-size: 14px;

          &.checkbox-label {
            display: flex;
            align-items: center;
            cursor: pointer;
            padding: 12px;
            border: 2px solid #e2e8f0;
            border-radius: 8px;
            transition: all 0.3s ease;

            &:hover {
              border-color: #cbd5e0;
              background: #f7fafc;
            }

            input[type="checkbox"] {
              margin-right: 12px;
              width: 18px;
              height: 18px;
              accent-color: #667eea;
            }
          }
        }

        .radio-group {
          display: flex;
          gap: 1rem;
          margin-bottom: 1rem;

          .radio-label {
            display: flex;
            align-items: center;
            cursor: pointer;
            font-weight: 500;
            padding: 8px 12px;
            border: 2px solid #e2e8f0;
            border-radius: 8px;
            transition: all 0.3s ease;

            &:hover {
              border-color: #cbd5e0;
              background: #f7fafc;
            }

            input[type="radio"] {
              margin-right: 8px;
              width: 18px;
              height: 18px;
              accent-color: #667eea;
            }

            input[type="radio"]:checked {
              &+span {
                color: #667eea;
                font-weight: 600;
              }
            }

            input[type="radio"]:disabled {
              cursor: not-allowed;
              opacity: 0.5;
            }
          }

          .radio-label:has(input[type="radio"]:checked) {
            border-color: #667eea;
            background: rgba(102, 126, 234, 0.05);
          }
        }

        .email-input-group {
          display: flex;
          align-items: center;
          gap: 8px;
          margin-bottom: 8px;

          input[type="email"] {
            flex: 1;
            padding: 8px 12px;
            border: 2px solid #e2e8f0;
            border-radius: 6px;
            font-size: 14px;
            transition: all 0.3s ease;

            &:focus {
              outline: none;
              border-color: #667eea;
              box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
            }
          }

          .remove-email-btn {
            width: 32px;
            height: 32px;
            background: #ef4444;
            color: white;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 18px;
            font-weight: bold;
            transition: all 0.2s ease;

            &:hover:not(:disabled) {
              background: #dc2626;
              transform: scale(1.05);
            }

            &:disabled {
              background: #d1d5db;
              cursor: not-allowed;
              transform: none;
            }
          }
        }

        .add-email-btn {
          background: #10b981;
          color: white;
          border: none;
          border-radius: 6px;
          padding: 8px 16px;
          font-size: 14px;
          font-weight: 500;
          cursor: pointer;
          transition: all 0.2s ease;
          margin-bottom: 8px;

          &:hover:not(:disabled) {
            background: #059669;
            transform: translateY(-1px);
          }

          &:disabled {
            background: #d1d5db;
            cursor: not-allowed;
            transform: none;
          }
        }

        textarea {
          width: 100%;
          padding: 12px 16px;
          border: 2px solid #e2e8f0;
          border-radius: 8px;
          font-size: 14px;
          color: #2d3748;
          background: white;
          transition: all 0.3s ease;
          resize: vertical;
          min-height: 80px;
          font-family: inherit;

          &:focus {
            outline: none;
            border-color: #667eea;
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
          }

          &::placeholder {
            color: #a0aec0;
          }
        }
      }

      input[type="text"],
      select {
        width: 100%;
        padding: 12px 16px;
        border: 2px solid #e2e8f0;
        border-radius: 8px;
        font-size: 14px;
        color: #2d3748;
        background: white;
        transition: all 0.3s ease;

        &:focus {
          outline: none;
          border-color: #667eea;
          box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
        }

        &::placeholder {
          color: #a0aec0;
        }
      }

      select {
        cursor: pointer;
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
        background-position: right 12px center;
        background-repeat: no-repeat;
        background-size: 16px;
        padding-right: 40px;
      }

      .help-text {
        color: #718096;
        font-size: 12px;
        margin-top: 6px;
        line-height: 1.4;
      }

      .locked-feature {
        color: #e74c3c;
        font-style: italic;
        font-size: 12px;
        margin-top: 8px;
        display: flex;
        align-items: center;
        gap: 6px;

        &::before {
          content: "🔒";
          font-size: 14px;
        }
      }

      .shortcode-container {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px;
        background: #f7fafc;
        border: 2px solid #e2e8f0;
        border-radius: 8px;

        .shortcode-display {
          flex: 1;
          background: #2d3748;
          color: #e2e8f0;
          padding: 8px 12px;
          border-radius: 6px;
          font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
          font-size: 13px;
          border: none;
        }

        .copy-shortcode-btn {
          background: #667eea;
          color: white;
          border: none;
          border-radius: 6px;
          padding: 8px;
          cursor: pointer;
          transition: all 0.3s ease;
          display: flex;
          align-items: center;
          justify-content: center;

          &:hover {
            background: #5a67d8;
            transform: translateY(-1px);
          }
        }
      }

      .advanced-examples {
        .example-item {
          margin-bottom: 12px;
          padding: 12px;
          background: #f7fafc;
          border-radius: 6px;
          border-left: 4px solid #667eea;

          code {
            display: block;
            background: #2d3748;
            color: #e2e8f0;
            padding: 6px 10px;
            border-radius: 4px;
            font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
            font-size: 12px;
            margin-bottom: 4px;
          }

          small {
            color: #718096;
            font-size: 11px;
          }
        }
      }
    }
  }
}

.modal-footer {
  padding: 20px 30px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;

  .btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;

    &.secondary {
      background: #e2e8f0;
      color: #4a5568;
      border: none;

      &:hover {
        background: #cbd5e0;
      }
    }
  }
}

// Responsive design
@media (max-width: 768px) {
  // width: 95vw;
  // max-height: 90vh;

  .modal-header {
    padding: 15px 20px;

    h3 {
      font-size: 18px;
    }
  }

  .modal-content {
    padding: 20px;

    .settings-section {
      margin-bottom: 25px;

      h4 {
        font-size: 16px;
      }
    }
  }

  .modal-footer {
    padding: 15px 20px;
  }
}

// Modal settings checkbox checked marker 
input[type=radio]:checked::before {
  content: "";
  border-radius: 50%;
  width: 0.5rem;
  height: .5rem;
  margin: .1875rem;
  background-color: #3582c4;
  line-height: 1.14285714;
  display: flex;
  position: relative;
  left: 1px;
  top: 1px;
}

/* Cond
itional Logic Styles */
.conditional-logic-section {
  margin-top: 20px;
  padding: 15px;
  border: 1px solid #e1e4ea;
  border-radius: 8px;
  background-color: #f9f9f9;

  h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 14px;
    font-weight: 600;
  }

  h5 {
    margin: 15px 0 10px 0;
    color: #666;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
  }

  .conditions-list {
    margin-top: 15px;
  }

  .condition-item {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px;
    background-color: white;
    border: 1px solid #e1e4ea;
    border-radius: 6px;

    .select-type-class {
      flex: 1;
      min-width: 120px;
    }

    input[type="text"] {
      flex: 1;
      min-width: 100px;
    }

    .option-remover-multiple {
      background: #ff4757;
      border: none;
      border-radius: 4px;
      padding: 5px;
      cursor: pointer;
      color: white;
      display: flex;
      align-items: center;
      justify-content: center;
      min-width: 30px;
      height: 30px;

      &:hover {
        background: #ff3742;
      }

      .add-options {
        font-size: 16px;
      }
    }
  }

  .jsonbtn {
    background: #4a6cf7;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;

    &:hover {
      background: #338ac6;
    }
  }
}

/* Page Break Progress Indicator Styles */
.page-break-options {
  margin-top: 15px;
  padding: 15px;
  border: 1px solid #e1e4ea;
  border-radius: 8px;
  background-color: #f9f9f9;

  h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 14px;
    font-weight: 600;
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .condition-item {
    flex-direction: column;
    align-items: stretch;

    .select-type-class,
    input[type="text"] {
      min-width: auto;
      width: 100%;
    }

    .option-remover-multiple {
      align-self: flex-end;
      margin-top: 10px;
    }
  }
}


/* ============================================
   FORM SETTINGS MODAL - ENHANCED STYLES
   ============================================ */

.form-settings-modal {
  .modal-content {
    max-width: 900px;
    max-height: 85vh;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .modal-header {
    padding: 24px 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom: none;
    
    h2 {
      margin: 0;
      font-size: 24px;
      font-weight: 600;
      display: flex;
      align-items: center;
      gap: 12px;
      color: #ffffff;
      
      svg {
        width: 28px;
        height: 28px;
      }
    }
    
    p {
      margin: 8px 0 0 0;
      opacity: 0.9;
      font-size: 14px;
      font-weight: 400;
    }
  }

  .modal-body {
    padding: 32px;
    overflow-y: auto;
    flex: 1;
    @include thin-scrollbar;
    
    &::-webkit-scrollbar {
      width: 8px;
    }
    
    &::-webkit-scrollbar-thumb {
      background: #e0e0e0;
      border-radius: 4px;
      
      &:hover {
        background: #c0c0c0;
      }
    }
  }

  .settings-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
    
    &:hover {
      border-color: #dee2e6;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    }
    
    &:last-child {
      margin-bottom: 0;
    }
    
    h4 {
      margin: 0 0 20px 0;
      font-size: 18px;
      font-weight: 600;
      color: #2d3748;
      display: flex;
      align-items: center;
      gap: 10px;
      
      &:before {
        content: '';
        width: 4px;
        height: 20px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border-radius: 2px;
      }
    }
  }

  .form-group {
    margin-bottom: 20px;
    
    &:last-child {
      margin-bottom: 0;
    }
    
    label {
      display: block;
      margin-bottom: 8px;
      font-size: 14px;
      font-weight: 500;
      color: #4a5568;
      
      &:not(.checkbox-label):not(.toggle-label) {
        &:after {
          content: '';
          display: block;
          width: 30px;
          height: 2px;
          background: linear-gradient(90deg, #667eea 0%, transparent 100%);
          margin-top: 4px;
        }
      }
    }
    
    input[type="text"],
    input[type="email"],
    input[type="url"],
    input[type="tel"],
    input[type="number"],
    select,
    textarea {
      width: 100%;
      padding: 12px 16px;
      border: 2px solid #e2e8f0;
      border-radius: 8px;
      font-size: 14px;
      color: #2d3748;
      background: white;
      transition: all 0.3s ease;
      font-family: inherit;
      
      &:focus {
        outline: none;
        border-color: #667eea;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
      }
      
      &:disabled {
        background: #f7fafc;
        color: #a0aec0;
        cursor: not-allowed;
      }
      
      &::placeholder {
        color: #a0aec0;
      }
    }
    
    textarea {
      resize: vertical;
      min-height: 100px;
      line-height: 1.6;
    }
    
    select {
      cursor: pointer;
      appearance: none;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234a5568' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right 12px center;
      padding-right: 40px;
    }

    .toggle-wrapper {
      display: flex;
      gap: 10px;
      text-align: center;
      align-items: center;
  }
    
    .help-text {
      display: block;
      margin-top: 6px;
      font-size: 13px;
      color: #718096;
      line-height: 1.5;
      
      &.locked-feature {
        color: #e53e3e;
        font-weight: 500;
      }
      
      strong {
        color: #4a5568;
        font-weight: 600;
      }
    }
  }

  /* Toggle Switch Styles */
  .toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    padding: 14px 18px;
    background: white;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
    min-height: 56px;
    
    &:hover {
      border-color: #cbd5e0;
      background: #f7fafc;
    }
    
    input[type="checkbox"] {
      position: absolute;
      opacity: 0;
      pointer-events: none;
    }
    
    .toggle-text {
      flex: 1;
      font-size: 14px;
      font-weight: 500;
      color: #2d3748;
      line-height: 1.5;
      padding-right: 16px;
    }
    
    .toggle-switch {
      position: relative;
      width: 52px;
      height: 28px;
      background: #cbd5e0;
      border-radius: 14px;
      transition: all 0.3s ease;
      flex-shrink: 0;
      order: 2;
      
      &:after {
        content: '';
        position: absolute;
        top: 3px;
        left: 3px;
        width: 22px;
        height: 22px;
        background: white;
        border-radius: 50%;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
      }
    }
    
    input[type="checkbox"]:checked ~ .toggle-switch {
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      
      &:after {
        left: 27px;
      }
    }
    
    input[type="checkbox"]:disabled ~ .toggle-switch {
      opacity: 0.5;
      cursor: not-allowed;
    }
    
    &:has(input[type="checkbox"]:disabled) {
      cursor: not-allowed;
      opacity: 0.6;
    }
  }

  /* Email Input Group */
  .email-input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    
    input {
      flex: 1;
    }
    
    .remove-email-btn {
      width: 40px;
      height: 44px;
      background: #fed7d7;
      color: #c53030;
      border: none;
      border-radius: 8px;
      font-size: 20px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.3s ease;
      flex-shrink: 0;
      
      &:hover {
        background: #fc8181;
        color: white;
        transform: scale(1.05);
      }
    }
  }

  .add-email-btn {
    width: 100%;
    padding: 10px 16px;
    background: white;
    color: #667eea;
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
    
    &:hover {
      border-color: #667eea;
      background: #f7fafc;
      transform: translateY(0);
    }
  }

  /* Radio Group */
  .radio-group {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    
    .radio-label {
      display: flex;
      align-items: center;
      gap: 8px;
      cursor: pointer;
      padding: 10px 16px;
      background: white;
      border: 2px solid #e2e8f0;
      border-radius: 8px;
      transition: all 0.3s ease;
      flex: 1;
      
      &:hover {
        border-color: #cbd5e0;
        background: #f7fafc;
      }
      
      input[type="radio"] {
        display: none;
      }
      
      .radio-checkmark {
        width: 20px;
        height: 20px;
        border: 2px solid #cbd5e0;
        border-radius: 50%;
        position: relative;
        transition: all 0.3s ease;
        flex-shrink: 0;
        
        &:after {
          content: '';
          position: absolute;
          top: 50%;
          left: 50%;
          transform: translate(-50%, -50%) scale(0);
          width: 10px;
          height: 10px;
          background: white;
          border-radius: 50%;
          transition: all 0.3s ease;
        }
      }
      
      input[type="radio"]:checked ~ .radio-checkmark {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border-color: #667eea;
        
        &:after {
          transform: translate(-50%, -50%) scale(1);
        }
      }
    }
  }

  /* Shortcode Container */
  .shortcode-container {
    display: flex;
    gap: 8px;
    align-items: center;
    
    .shortcode-display {
      flex: 1;
      padding: 12px 16px;
      background: #2d3748;
      color: #68d391;
      border-radius: 8px;
      font-family: 'Courier New', monospace;
      font-size: 14px;
      border: 2px solid #4a5568;
    }
    
    .copy-shortcode-btn {
      width: 44px;
      height: 44px;
      background: #667eea;
      color: white;
      border: none;
      border-radius: 8px;
      cursor: pointer;
      transition: all 0.3s ease;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      
      &:hover {
        background: #5a67d8;
        transform: scale(1.05);
      }
      
      svg {
        width: 18px;
        height: 18px;
      }
    }
  }

  /* Advanced Examples */
  .advanced-examples {
    margin-top: 12px;
    
    .example-item {
      padding: 12px;
      background: white;
      border-radius: 8px;
      margin-bottom: 8px;
      border: 1px solid #e2e8f0;
      
      &:last-child {
        margin-bottom: 0;
      }
      
      code {
        display: block;
        padding: 8px 12px;
        background: #2d3748;
        color: #68d391;
        border-radius: 6px;
        font-family: 'Courier New', monospace;
        font-size: 13px;
        margin-bottom: 6px;
        overflow-x: auto;
      }
      
      small {
        display: block;
        color: #718096;
        font-size: 12px;
      }
    }
  }

  /* Modal Footer */
  .modal-footer {
    padding: 20px 32px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    
    .btn {
      padding: 10px 24px;
      border-radius: 8px;
      font-size: 14px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.3s ease;
      border: none;
      
      &.secondary {
        background: white;
        color: #4a5568;
        border: 2px solid #e2e8f0;
        
        &:hover {
          background: #f7fafc;
          border-color: #cbd5e0;
        }
      }
      
      &.primary {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        
        &:hover {
          transform: translateY(-2px);
          box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
        }
      }
    }
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .form-settings-modal {
    .modal-content {
      max-width: 95%;
      max-height: 90vh;
      border-radius: 12px;
    }
    
    .modal-header {
      padding: 20px 24px;
      
      h2 {
        font-size: 20px;
      }
    }
    
    .modal-body {
      padding: 24px;
    }
    
    .settings-section {
      padding: 20px;
      
      h4 {
        font-size: 16px;
      }
    }
    
    .radio-group {
      flex-direction: column;
    }
    
    .modal-footer {
      padding: 16px 24px;
      
      .btn {
        flex: 1;
      }
    }
  }
}

/* Animation */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.form-settings-modal .modal-content {
  animation: slideIn 0.3s ease;
}
