.arraysubs-mae-items-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.arraysubs-mae-item {
  border: 1px solid #dcdcde;
  border-radius: 4px;
  background: #fff;
  transition: opacity 0.2s;

  &--dragging {
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  }

  &--disabled {
    opacity: 0.55;
  }

  &--custom {
    border-left: 3px solid #2271b1;
  }

  &__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    min-height: 44px;
  }

  &__drag {
    background: none;
    border: none;
    color: #999;
    cursor: grab;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding: 4px;
    border-radius: 3px;
    touch-action: none;

    &:hover {
      background: #f0f0f0;
      color: #1d2327;
    }

    &:active {
      cursor: grabbing;
    }
  }

  &__label {
    flex: 1;
    font-weight: 500;
    font-size: 13px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  &__type-badge {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 3px;
    background: #f0f0f0;
    color: #666;
    flex-shrink: 0;
  }

  &--custom &__type-badge {
    background: #e7f0f8;
    color: #2271b1;
  }

  &__actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
  }

  &__toggle-btn,
  &__expand-btn,
  &__remove-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    color: #666;
    transition:
      color 0.15s,
      background 0.15s;

    &:hover {
      background: #f0f0f0;
      color: #1d2327;
    }

    &:disabled {
      opacity: 0.3;
      cursor: not-allowed;
    }
  }

  &__remove-btn:hover {
    color: #d63638;
    background: #fce4e4;
  }

  &__body {
    border-top: 1px solid #eee;
    padding: 16px 12px;
    background: #fafafa;
  }

  &__row {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;

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

    @media (max-width: 782px) {
      flex-direction: column;
      gap: 12px;
    }
  }

  &__col {
    flex: 1;

    > label {
      display: block;
      font-weight: 500;
      font-size: 12px;
      margin-bottom: 4px;
      color: #1d2327;
    }

    input[type="text"] {
      width: 100%;
    }

    &--checkbox {
      display: flex;
      flex-direction: column;
      justify-content: center;

      > label {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        font-weight: normal;
        cursor: pointer;
      }
    }
  }

  &__hint {
    display: block;
    font-size: 11px;
    color: #999;
    margin-top: 4px;
  }
}

.arraysubs-mae-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.arraysubs-mae-empty {
  padding: 20px;
  text-align: center;
  color: #666;
  background: #fafafa;
  border: 1px dashed #dcdcde;
  border-radius: 4px;
  margin-bottom: 16px;

  p {
    margin: 0;
  }
}

.arraysubs-mae-info {
  ul {
    margin: 0;
    padding: 0 0 0 20px;

    li {
      margin-bottom: 6px;
      font-size: 13px;
      color: #50575e;
    }
  }
}

// Content Search Dropdown
.arraysubs-mae-content-search {
  position: relative;

  &__trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #fff;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: #1d2327;
    min-width: 200px;
    text-align: left;
    width: 100%;

    > span {
      flex: 1;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    &:hover {
      border-color: #2271b1;
    }
  }

  &__dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
    margin-top: 4px;
    max-height: 300px;
    display: flex;
    flex-direction: column;
  }

  &__input-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-bottom: 1px solid #eee;

    input {
      flex: 1;
      border: none;
      outline: none;
      font-size: 13px;

      &:focus {
        box-shadow: none;
      }
    }

    svg {
      flex-shrink: 0;
      color: #999;
    }

    .spin {
      animation: arraysubs-spin 1s linear infinite;
    }
  }

  &__results {
    overflow-y: auto;
    max-height: 240px;
  }

  &__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 10px;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
    font-size: 13px;

    &:hover {
      background: #f0f6fc;
    }

    &--selected {
      background: #e7f0f8;
      font-weight: 500;
    }
  }

  &__item-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  &__item-type {
    font-size: 11px;
    color: #999;
    background: #f0f0f0;
    padding: 1px 6px;
    border-radius: 3px;
    flex-shrink: 0;
    margin-left: 8px;
  }

  &__empty {
    padding: 16px;
    text-align: center;
    color: #999;
    font-size: 13px;
  }
}

@keyframes arraysubs-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}
