.enspireplugins-acfw-admin-wrapper {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  *,*::before, *::after {
    box-sizing: border-box;
  }

  // Base container
  .fields-container {
    margin-top: 30px;
    background: #ffffff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
  }

  // Header section
  .fields-header {
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 24px;
    border-bottom: 2px solid #f3f4f6;

    h3 {
      margin: 0;
      color: #1f2937;
      font-size: 24px;
      font-weight: 700;
    }

    p {
      margin: 8px 0 0 0;
      color: #6b7280;
      font-size: 14px;
    }

    #add-field {
      @extend %button-primary;
      gap: 8px;

      .dashicons {
        font-size: 18px;
        width: 18px;
        height: 18px;
      }
    }
  }

  // Button mixins
  %button-primary {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    cursor: pointer;

    &:hover {
      transform: translateY(-2px);
      box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
      background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    }
  }

  %button-danger {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: white;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);

    &:hover {
      transform: translateY(-1px);
      box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
      background: linear-gradient(135deg, #b91c1c, #991b1b);
    }
  }

  // Table styles
  #enspireplugins_acfw-fields-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;

    th {
      background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
      font-weight: 700;
      padding: 20px 16px;
      color: #374151;
      font-size: 13px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      border-bottom: 2px solid #e5e7eb;

      &:first-child { border-top-left-radius: 12px; }
      &:last-child { border-top-right-radius: 12px; }
    }

    td {
      padding: 20px 16px;
    //   border-bottom: 1px solid #f3f4f6;
      vertical-align: middle;
      transition: background-color 0.2s ease;
    }

    tbody tr {
      &:hover td {
        background-color: #f8fafc;
      }

      &:last-child td {
        border-bottom: none;

        &:first-child { border-bottom-left-radius: 12px; }
        &:last-child { border-bottom-right-radius: 12px; }
      }
    }
  }

  // Column widths
  .move-column { width: 100px; text-align: center; }
  .field-name-column { width: 35%; }
  .field-type-column { width: 15%; }
  .status-column { width: 20%; }
  .actions-column { width: 120px; text-align: center; }

  // Move handle
  .move-handle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: grab;
    justify-content: center;

    &:active { cursor: grabbing; }

    .move-icon {
      color: #9ca3af;
      font-size: 20px;
      width: 20px;
      height: 20px;
      transition: color 0.2s ease;
    }

    &:hover .move-icon {
      color: #3b82f6;
    }
  }

  .order-number {
    font-weight: 700;
    color: #6b7280;
    font-size: 14px;
    background: #f3f4f6;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  // Field content
  .field-name {
    strong {
      display: block;
      margin-bottom: 6px;
      color: #111827;
      font-size: 16px;
      font-weight: 600;
    }
  }

  .field-id {
    font-size: 12px;
    color: #6b7280;

    code {
      background: #f3f4f6;
      padding: 3px 8px;
      border-radius: 6px;
      font-size: 11px;
      font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
      color: #374151;
      border: 1px solid #e5e7eb;
    }
  }

  // Field type badges
  .field-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 2px solid;
  }

  // Field type colors
  .field-type-text { 
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1e40af;
    border-color: #3b82f6;
  }
  .field-type-number { 
    background: linear-gradient(135deg, #fae8ff, #e9d5ff);
    color: #7c3aed;
    border-color: #8b5cf6;
  }
  .field-type-email { 
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    color: #059669;
    border-color: #10b981;
  }
  .field-type-url { 
    background: linear-gradient(135deg, #fed7aa, #fdba74);
    color: #ea580c;
    border-color: #f97316;
  }
  .field-type-textarea { 
    background: linear-gradient(135deg, #fce7f3, #fbcfe8);
    color: #be185d;
    border-color: #ec4899;
  }
  .field-type-select { 
    background: linear-gradient(135deg, #e0f2fe, #b3e5fc);
    color: #0277bd;
    border-color: #0288d1;
  }
  .field-type-checkbox { 
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    color: #15803d;
    border-color: #22c55e;
  }
  .field-type-radio { 
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    color: #d97706;
    border-color: #f59e0b;
  }

  // Status indicators
  %status-indicator {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;

    &::before {
      content: "●";
      font-size: 12px;
    }
  }

  .status-active {
    @extend %status-indicator;
    color: #059669;

    &::before { color: #10b981; }
  }

  .status-inactive {
    @extend %status-indicator;
    color: #dc2626;

    &::before { color: #ef4444; }
  }

  .required-indicator {
    font-size: 10px;
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    align-self: flex-start;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.3);
  }

  // Field actions
  .field-actions {
    display: flex;
    gap: 8px;
    justify-content: center;

    .button {
      padding: 8px 12px;
      min-height: 36px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 8px;
      font-weight: 600;
      transition: all 0.2s ease;
      border: none;
      cursor: pointer;

      .dashicons {
        font-size: 16px;
        width: 16px;
        height: 16px;
      }
    }

    .edit-field {
      @extend %button-primary;
    }

    .delete-field {
      @extend %button-danger;
      padding: 8px 12px;
      min-height: 36px;
    }
  }

  // Empty state
  .no-fields-message {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
  }

  .no-fields-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    font-size: 16px;

    .dashicons {
      font-size: 48px;
      width: 48px;
      height: 48px;
      color: #9ca3af;
      background: #f3f4f6;
      border-radius: 50%;
      padding: 16px;
      margin-bottom: 8px;
	  box-sizing: content-box;
    }
  }

  // Sortable elements
  .sortable-placeholder {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    border: 2px dashed #3b82f6;
    visibility: visible !important;
    border-radius: 8px;

    td { border: none; }
  }

  .ui-sortable-helper {
    background: white;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    transform: rotate(2deg);
  }

  // Save button
  #save-fields {
    margin-top: 32px;
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(135deg, #059669, #047857);
    border: none;
    color: white;
    border-radius: 10px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
    cursor: pointer;

    &:hover {
      transform: translateY(-2px);
      box-shadow: 0 6px 20px rgba(5, 150, 105, 0.4);
      background: linear-gradient(135deg, #047857, #065f46);
    }
  }

  // Form elements
  .enspireplugins-acfw-field-form .form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    transition: all 0.2s ease;

    &:focus {
      border-color: #3b82f6;
      box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
      outline: none;
    }
  }

  // Options container
  #options-container {
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  }

  .option-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    align-items: center;

    .option-label,
    .option-value {
      flex: 1;
      padding: 10px 14px;
      border: 2px solid #e5e7eb;
      border-radius: 8px;
      font-size: 14px;
      transition: border-color 0.2s ease;

      &:focus {
        border-color: #3b82f6;
        outline: none;
      }
    }

    .remove-option {
      @extend %button-danger;
      padding: 10px;
      min-width: 40px;
      height: 40px;

      &:hover {
        transform: scale(1.05);
      }
    }
  }

  #add-option {
    @extend %button-primary;
    gap: 8px;
  }

  // Animations
  @keyframes slideInUp {
    from {
      opacity: 0;
      transform: translateY(20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
  }

  .field-row {
    animation: slideInUp 0.3s ease-out;
	overflow: hidden;
  }
}

//  MODAL
.swal2-container {
  .swal2-popup {
    border-radius: 12px !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
    padding: 0 !important;
    max-height: 90vh !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;

    .swal2-header {
      padding: 2rem 2rem 0 !important;
      flex-shrink: 0 !important;
    }

    .swal2-title {
      color: #1f2937 !important;
      font-size: 1.5rem !important;
      font-weight: 600 !important;
      margin-bottom: 1.5rem !important;

      &::before {
        content: "";
        display: block;
        width: 40px;
        height: 3px;
        background: linear-gradient(90deg, #0073aa, #3b96d1);
        margin: 0 auto 1rem;
        border-radius: 2px;
      }
    }

    .swal2-html-container {
      margin: 0 !important;
      padding: 0 2rem !important;
      overflow-y: auto !important;
      overflow-x: hidden !important;
      flex: 1 !important;
      max-height: calc(90vh - 200px) !important;

      &::-webkit-scrollbar {
        width: 8px;
      }

      &::-webkit-scrollbar-track {
        background: #f3f4f6;
        border-radius: 4px;
      }

      &::-webkit-scrollbar-thumb {
        background: #9ca3af;
        border-radius: 4px;

        &:hover {
          background: #6b7280;
        }
      }
    }

    .modal-form-container {
      min-height: 100%;
      display: flex;
      flex-direction: column;
    }

    .swal2-actions {
      margin: 0 !important;
      padding: 1.5rem 2rem 2rem !important;
      gap: 1rem !important;
      flex-shrink: 0 !important;
      border-top: 1px solid #e5e7eb !important;
      background: rgba(249, 250, 251, 0.8) !important;
      backdrop-filter: blur(10px) !important;

      .swal2-confirm {
        background: linear-gradient(135deg, #0073aa, #005a87) !important;
        border: none !important;
        border-radius: 8px !important;
        padding: 12px 24px !important;
        font-weight: 500 !important;
        font-size: 14px !important;
        transition: all 0.2s ease !important;
        box-shadow: 0 4px 6px -1px rgba(0, 115, 170, 0.3) !important;

        &:hover {
          background: linear-gradient(135deg, #005a87, #004a73) !important;
          transform: translateY(-1px) !important;
          box-shadow: 0 6px 8px -1px rgba(0, 115, 170, 0.4) !important;
        }

        &:focus {
          box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.2) !important;
        }
      }

      .swal2-cancel {
        background: #ffffff !important;
        color: #4b5563 !important;
        border: 2px solid #d1d5db !important;
        border-radius: 8px !important;
        padding: 10px 24px !important;
        font-weight: 500 !important;
        font-size: 14px !important;
        transition: all 0.2s ease !important;

        &:hover {
          background: #f9fafb !important;
          border-color: #9ca3af !important;
          color: #374151 !important;
          transform: translateY(-1px) !important;
        }

        &:focus {
          box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.2) !important;
        }
      }
    }
  }

  .form-table {
    border-collapse: collapse;
    width: 100%;
    margin: 0;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    table-layout: fixed;

    th {
      background: linear-gradient(135deg, #f9fafb, #f3f4f6);
      color: #374151;
      font-weight: 600;
      font-size: 14px;
      text-align: left;
      padding: 16px 20px;
      vertical-align: top;
      border-bottom: 1px solid #e5e7eb;
      position: relative;
      width: 30%;
      word-wrap: break-word;

      label {
        margin: 0;
        font-weight: 600;
        color: #374151;
      }
    }

    td {
      padding: 16px 20px;
      border-bottom: 1px solid #f3f4f6;
      vertical-align: top;
      width: 70%;
      word-wrap: break-word;

      &:last-child {
        border-right: none;
      }
    }

    tr {
      transition: background-color 0.2s ease;

      &:hover {
        background: rgba(0, 115, 170, 0.02);
      }

      &:last-child {
        th,
        td {
          border-bottom: none;
        }
      }
    }
  }

  input[type="text"],
  input[type="email"],
  input[type="url"],
  input[type="number"],
  textarea,
  select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    color: #374151;
    transition: all 0.2s ease;
    font-family: inherit;

    &:focus {
      outline: none;
      border-color: #0073aa;
      box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
      background: rgba(0, 115, 170, 0.02);
    }

    &:hover:not(:focus) {
      border-color: #d1d5db;
    }

    &::placeholder {
      color: #9ca3af;
      font-style: italic;
    }

    &:invalid {
    //   border-color: #d63638;
      box-shadow: 0 0 0 px rgba(214, 54, 56, 0.1);
    }
  }

  select {
    width: 100%;
    max-width: initial !important;
    border-color: #e5e7eb !important;
    border-radius: 8px !important;

    option {
      padding: 8px 12px;
      background: #ffffff !important;
      color: #374151 !important;
      border: none;
      font-size: 14px;

      &:hover,
      &:focus,
      &:active {
        background: #f9fafb !important;
      }

      &[value=""] {
        color: #9ca3af !important;
        font-style: italic;
      }
    }

    input[type="checkbox"],
    input[type="radio"] {
      width: 18px;
      height: 18px;
      margin-right: 8px;
      cursor: pointer;
      border: 2px solid #d1d5db;
      background: #ffffff;
      transition: all 0.2s ease;

      &:checked {
        background: #0073aa;
        border-color: #0073aa;
      }

      &:focus {
        box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.2);
      }
    }

    input[type="checkbox"] {
      border-radius: 4px;

      &:checked::before {
        content: "";
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='white'%3e%3cpath d='m13.854 3.646-7.5 7.5a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6 10.293l7.146-7.147a.5.5 0 0 1 .708.708z'/%3e%3c/svg%3e") !important;
        background-repeat: no-repeat;
        background-position: center;
        background-size: 12px;
      }
    }

    input[type="radio"] {
      border-radius: 50%;

      &:checked {
        background-image: radial-gradient(circle, white 30%, transparent 30%);
      }
    }

    // Dynamic field options
    .swal-field-option {
      transition: all 0.3s ease;

      &[style*="none"] {
        opacity: 0;
        transform: translateY(-10px);
      }

      &[style*="table-row"] {
        opacity: 1;
        transform: translateY(0);
      }
    }

    #options-container {
      max-height: 200px;
      overflow-y: auto;
      padding-right: 4px;

      &::-webkit-scrollbar {
        width: 6px;
      }

      &::-webkit-scrollbar-track {
        background: #f3f4f6;
        border-radius: 3px;
      }

      &::-webkit-scrollbar-thumb {
        background: #9ca3af;
        border-radius: 3px;

        &:hover {
          background: #6b7280;
        }
      }

      > div {
        display: flex;
        align-items: center;
        margin-bottom: 12px;
        animation: slideIn 0.3s ease;

        input {
          flex: 1;
          margin: 0;
          margin-right: 12px;
          min-width: 0;
        }

        button {
          background: linear-gradient(135deg, #d63638, #b32d2f);
          color: white;
          border: none;
          border-radius: 6px;
          padding: 8px 12px;
          cursor: pointer;
          font-weight: 500;
          font-size: 14px;
          transition: all 0.2s ease;
          min-width: 36px;
          height: 36px;
          display: flex;
          align-items: center;
          justify-content: center;
          flex-shrink: 0;

          &:hover {
            background: linear-gradient(135deg, #c12b2d, #a12728);
            transform: scale(1.05);
          }

          &:active {
            transform: scale(0.95);
          }
        }
      }
    }

    #add-option-btn {
      background: linear-gradient(135deg, #00a32a, #008a24);
      color: white;
      border: none;
      border-radius: 8px;
      padding: 12px 20px;
      cursor: pointer;
      font-weight: 500;
      font-size: 14px;
      transition: all 0.2s ease;

      &:hover {
        background: linear-gradient(135deg, #009527, #007a1f);
        transform: translateY(-1px);
      }

      &:active {
        transform: translateY(0);
      }
    }

    p {
      margin: 8px 0 0;
      font-size: 12px;
      color: #6b7280;
      font-style: italic;

      &.error-text {
        color: #d63638;
        font-weight: 500;
      }

      &.success-text {
        color: #00a32a;
        font-weight: 500;
      }
    }

    label {
      display: flex;
      align-items: center;
      cursor: pointer;
      font-weight: 500;
      color: #374151;
      margin-bottom: 4px;
      transition: color 0.2s ease;

      &:hover {
        color: #1f2937;
      }

      .required {
        color: #d63638;
        margin-left: 4px;
        font-weight: 700;
      }
    }

    .field-error {
      input,
      select,
      textarea {
        //   border-color: #d63638 !important;
        box-shadow: 0 0 0 3px rgba(214, 54, 56, 0.1) !important;
      }
    }

    .field-success {
      input,
      select,
      textarea {
        //   border-color: #00a32a !important;
        box-shadow: 0 0 0 3px rgba(0, 163, 42, 0.1) !important;
      }
    }

    .loading {
      position: relative;
      pointer-events: none;
      opacity: 0.6;

      &::after {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        width: 20px;
        height: 20px;
        margin: -10px 0 0 -10px;
        border: 2px solid transparent;
        border-top: 2px solid #0073aa;
        border-radius: 50%;
        animation: spin 1s linear infinite;
      }
    }

    // Animation keyframes
    @keyframes slideIn {
      from {
        opacity: 0;
        transform: translateY(-10px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    @keyframes spin {
      0% {
        transform: rotate(0deg);
      }
      100% {
        transform: rotate(360deg);
      }
    }
  }
}
